---
title: "Chapter 8. Conditional Expectation and Information"
---
::: {.chapter-objectives}
## Learning Goals
By the end of this chapter, students should be able to:
- describe information mathematically using sigma-algebras and filtrations;
- compute conditional probabilities and conditional expectations in finite-state models;
- interpret $\mathbb E[X\mid \mathcal G]$ as the best prediction of $X$ given the information $\mathcal G$;
- prove and use the tower property, the taking-out-what-is-known property, and the smoothing identity;
- explain why discounted asset prices are martingales under a risk-neutral measure;
- derive conditional-expectation pricing formulas in one-period and multi-period models;
- connect conditional expectation with regression and statistical prediction;
- implement conditional expectation, tree pricing, and martingale checks in Python;
- use AI tools to audit conditional-expectation calculations, identify invalid information sets, and test numerical finance code.
:::
::: {.hero-box}
Mathematical finance is not only about randomness. It is about **randomness seen through information**.
At time $t$, a trader does not know every future outcome. The trader knows only the information available at time $t$, denoted by $\mathcal F_t$. Conditional expectation is the mathematical operation that converts a future random quantity into its best present prediction given current information:
$$
\mathbb E[X\mid \mathcal F_t].
$$
This chapter develops conditional expectation carefully because it is the language of martingales, dynamic pricing, hedging, filtering, and risk forecasting.
:::
## 8.1 Why Information Matters in Finance
Consider a payoff $X$ paid at time $T$. At time $0$, before any uncertainty is resolved, the natural prediction of $X$ under a probability measure $\mathbb P$ is $\mathbb E[X]$. At an intermediate time $t$, some information has arrived: perhaps the stock has moved up or down, an interest rate has changed, or a default event has occurred. The prediction must now use that information.
The correct mathematical object is not a number but a random variable:
$$
\mathbb E[X\mid \mathcal F_t].
$$
It is random because different histories up to time $t$ lead to different predictions. For example, in a two-period binomial model, the time-$1$ value of a call option has one value after an up move and another value after a down move.
The key idea is:
::: {.definition}
### Definition 8.1: Conditional expectation as information-based prediction
The conditional expectation $\mathbb E[X\mid\mathcal G]$ is the best prediction of a random variable $X$ using only the information contained in the sigma-algebra $\mathcal G$.
:::
This statement has three layers:
1. $\mathcal G$ specifies what is known;
2. $\mathbb E[X\mid\mathcal G]$ must depend only on what is known;
3. among all such predictions, $\mathbb E[X\mid\mathcal G]$ is optimal in mean-square error.
The rest of the chapter makes these statements precise.
## 8.2 Probability Spaces and Events
A probability model is a triple
$$
(\Omega,\mathcal F,\mathbb P),
$$
where:
- $\Omega$ is the sample space;
- $\mathcal F$ is a sigma-algebra of events;
- $\mathbb P$ is a probability measure.
In a finite model, $\Omega=\{\omega_1,\ldots,\omega_m\}$ and $\mathcal F$ is often the collection of all subsets of $\Omega$. In larger models, especially continuous-time models, it is important to distinguish between all possible subsets and measurable events.
::: {.definition}
### Definition 8.2: Sigma-algebra
A collection $\mathcal F$ of subsets of $\Omega$ is a sigma-algebra if:
1. $\Omega\in\mathcal F$;
2. if $A\in\mathcal F$, then $A^c\in\mathcal F$;
3. if $A_1,A_2,\ldots\in\mathcal F$, then $\bigcup_{n=1}^\infty A_n\in\mathcal F$.
:::
A sigma-algebra represents the events whose occurrence can be determined from the available information. In finite finance models, we can understand this through partitions.
Suppose
$$
\Omega=\{\omega_1,\omega_2,\omega_3,\omega_4\}.
$$
The sigma-algebra
$$
\mathcal G=\{\varnothing,\Omega,\{\omega_1,\omega_2\},\{\omega_3,\omega_4\}\}
$$
does not distinguish $\omega_1$ from $\omega_2$, and does not distinguish $\omega_3$ from $\omega_4$. It only tells us which block occurred:
$$
\{\omega_1,\omega_2\}
\quad\text{or}\quad
\{\omega_3,\omega_4\}.
$$
Thus information can be coarse. Conditional expectation averages over states that cannot be distinguished by the available information.
## 8.3 Random Variables and Measurability
A random variable is a measurable function
$$
X:\Omega\to\mathbb R.
$$
If $\mathcal G\subseteq \mathcal F$ is a smaller sigma-algebra, then $X$ is $\mathcal G$-measurable if the value of $X$ is determined by the information in $\mathcal G$.
In a finite partition model, this has a simple interpretation.
::: {.definition}
### Definition 8.3: Measurability in a finite partition model
Let $\mathcal G$ be generated by a partition $B_1,\ldots,B_k$ of $\Omega$. A random variable $Y$ is $\mathcal G$-measurable if and only if $Y$ is constant on each block $B_j$.
:::
For example, if $\mathcal G$ only tells us whether an asset moved up or down in the first period, then a $\mathcal G$-measurable quantity may depend on the first move but cannot depend on what happens afterward.
::: {.warning}
In finance, a trading strategy must be adapted to available information. A strategy that uses tomorrow's price to decide today's position is not admissible, even if the formula looks algebraically correct.
:::
## 8.4 Filtrations: Information Through Time
In a dynamic model, information grows over time.
::: {.definition}
### Definition 8.4: Filtration
A filtration is an increasing sequence of sigma-algebras
$$
\mathcal F_0\subseteq \mathcal F_1\subseteq \cdots \subseteq \mathcal F_T.
$$
The sigma-algebra $\mathcal F_t$ represents the information available at time $t$.
:::
The condition $\mathcal F_t\subseteq \mathcal F_{t+1}$ means that information is not forgotten. A future observer can know at least everything a past observer knew.
In a stock-price model, a standard filtration is the natural filtration generated by the price process:
$$
\mathcal F_t^S=\sigma(S_0,S_1,\ldots,S_t).
$$
This is the information contained in the observed price history up to time $t$.
::: {.definition}
### Definition 8.5: Adapted process
A stochastic process $(X_t)_{t=0}^T$ is adapted to a filtration $(\mathcal F_t)_{t=0}^T$ if $X_t$ is $\mathcal F_t$-measurable for every $t$.
:::
Asset prices are usually modeled as adapted processes. Trading strategies must be predictable: the position held over $(t,t+1]$ must be determined by information available at time $t$.
## 8.5 Conditional Expectation in a Finite Model
Let $X$ be an integrable random variable and let $\mathcal G$ be generated by a finite partition
$$
B_1,\ldots,B_k.
$$
Then $\mathbb E[X\mid\mathcal G]$ is constant on each block. If $\omega\in B_j$, then
$$
\mathbb E[X\mid\mathcal G](\omega)
=
\mathbb E[X\mid B_j]
=
\frac{\sum_{\omega_i\in B_j}X(\omega_i)\mathbb P(\omega_i)}{\mathbb P(B_j)}.
$$
Thus conditional expectation is a weighted average inside each information block.
::: {.example}
### Example 8.1: A four-state model
Suppose
$$
\Omega=\{\omega_1,\omega_2,\omega_3,\omega_4\},
$$
with probabilities
$$
(0.20,0.30,0.10,0.40),
$$
and payoff
$$
X=(10,4,8,2).
$$
Let
$$
\mathcal G=\sigma(\{\omega_1,\omega_2\},\{\omega_3,\omega_4\}).
$$
Then
$$
\mathbb E[X\mid\mathcal G](\omega_1)
=
\mathbb E[X\mid\mathcal G](\omega_2)
=
\frac{10(0.20)+4(0.30)}{0.20+0.30}=6.4,
$$
and
$$
\mathbb E[X\mid\mathcal G](\omega_3)
=
\mathbb E[X\mid\mathcal G](\omega_4)
=
\frac{8(0.10)+2(0.40)}{0.10+0.40}=3.2.
$$
Therefore
$$
\mathbb E[X\mid\mathcal G]=(6.4,6.4,3.2,3.2).
$$
:::
## 8.6 The Abstract Definition
For finite models, the partition formula is enough. For continuous-time finance, we need the general definition.
::: {.definition}
### Definition 8.6: Conditional expectation
Let $X$ be integrable and let $\mathcal G\subseteq\mathcal F$ be a sigma-algebra. The conditional expectation of $X$ given $\mathcal G$ is a random variable $Y$ such that:
1. $Y$ is $\mathcal G$-measurable;
2. for every $A\in\mathcal G$,
$$
\int_A Y\,d\mathbb P=\int_A X\,d\mathbb P.
$$
We write
$$
Y=\mathbb E[X\mid\mathcal G].
$$
:::
The first condition says that the prediction uses only the information in $\mathcal G$. The second condition says that $Y$ gives the correct average value of $X$ over every event that can be observed using $\mathcal G$.
Conditional expectation is unique up to events of probability zero.
::: {.theorem}
### Theorem 8.1: Finite partition formula
If $\mathcal G$ is generated by a finite partition $B_1,\ldots,B_k$ with $\mathbb P(B_j)>0$, then
$$
\mathbb E[X\mid\mathcal G]
=
\sum_{j=1}^k
\left(\frac{\mathbb E[X\mathbf 1_{B_j}]}{\mathbb P(B_j)}\right)\mathbf 1_{B_j}.
$$
:::
::: {.proof}
The right-hand side is constant on each block $B_j$, so it is $\mathcal G$-measurable. If $A\in\mathcal G$, then $A$ is a union of some blocks. On each block $B_j$,
$$
\int_{B_j}
\frac{\mathbb E[X\mathbf 1_{B_j}]}{\mathbb P(B_j)}\,d\mathbb P
=
\frac{\mathbb E[X\mathbf 1_{B_j}]}{\mathbb P(B_j)}\mathbb P(B_j)
=
\mathbb E[X\mathbf 1_{B_j}]
=
\int_{B_j}X\,d\mathbb P.
$$
Adding over the blocks contained in $A$ proves the defining property.
:::
## 8.7 Interactive Demo: Information Blocks and Conditional Averages
The following activity shows how changing the information set changes the conditional expectation.
::: {.interactive-card}
### Interactive 8.1: Coarse information versus full information
The payoff $X$ has four possible state values. Choose an information level. The conditional expectation averages $X$ within each information block.
<div class="mf-controls">
<label for="mf-ch08-info-level">Information level</label>
<select id="mf-ch08-info-level">
<option value="coarse">Coarse: two blocks</option>
<option value="medium">Medium: three blocks</option>
<option value="full">Full: four states</option>
</select>
</div>
<div id="mf-ch08-info-plot" class="plotly-demo"></div>
<div id="mf-ch08-info-output" class="mf-output"></div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const select = document.getElementById("mf-ch08-info-level");
const plotDiv = document.getElementById("mf-ch08-info-plot");
const output = document.getElementById("mf-ch08-info-output");
if (!select || !plotDiv || typeof Plotly === "undefined") return;
const states = ["omega1", "omega2", "omega3", "omega4"];
const probs = [0.20, 0.30, 0.10, 0.40];
const payoff = [10, 4, 8, 2];
const partitions = {
coarse: [[0, 1], [2, 3]],
medium: [[0], [1, 2], [3]],
full: [[0], [1], [2], [3]]
};
function conditionalExpectation(blocks) {
const ce = new Array(payoff.length).fill(0);
blocks.forEach(block => {
let p = 0;
let xp = 0;
block.forEach(i => {
p += probs[i];
xp += probs[i] * payoff[i];
});
const avg = xp / p;
block.forEach(i => ce[i] = avg);
});
return ce;
}
function blockText(blocks, ce) {
return blocks.map((block, j) => {
const names = block.map(i => states[i]).join(", ");
return `Block ${j + 1}: {${names}} gives conditional mean ${ce[block[0]].toFixed(3)}`;
}).join("<br>");
}
function update() {
const blocks = partitions[select.value];
const ce = conditionalExpectation(blocks);
const unconditional = probs.reduce((s, p, i) => s + p * payoff[i], 0);
Plotly.react(plotDiv, [
{
x: states,
y: payoff,
type: "bar",
name: "Payoff X",
text: payoff.map(v => v.toFixed(1)),
textposition: "auto"
},
{
x: states,
y: ce,
type: "scatter",
mode: "lines+markers",
name: "E[X | G]",
line: {width: 4, shape: "hv"}
}
], {
title: "Conditional expectation is constant on information blocks",
xaxis: {title: "State"},
yaxis: {title: "Value"},
margin: {t: 55, r: 20, b: 55, l: 55},
legend: {orientation: "h"}
}, {responsive: true});
output.innerHTML =
blockText(blocks, ce) +
`<br><br>Unconditional mean: E[X] = ${unconditional.toFixed(3)}. ` +
`Weighted mean of E[X | G]: ${probs.reduce((s, p, i) => s + p * ce[i], 0).toFixed(3)}.`;
}
select.addEventListener("change", update);
update();
});
</script>
:::
## 8.8 Fundamental Properties
Conditional expectation satisfies several properties that are used constantly in mathematical finance.
::: {.theorem}
### Theorem 8.2: Basic properties of conditional expectation
Let $X,Y$ be integrable random variables and let $\mathcal G\subseteq\mathcal F$. Then:
1. **Linearity:**
$$
\mathbb E[aX+bY\mid\mathcal G]
=a\mathbb E[X\mid\mathcal G]+b\mathbb E[Y\mid\mathcal G].
$$
2. **Monotonicity:** If $X\le Y$, then
$$
\mathbb E[X\mid\mathcal G]\le \mathbb E[Y\mid\mathcal G].
$$
3. **Smoothing:**
$$
\mathbb E[\mathbb E[X\mid\mathcal G]]=\mathbb E[X].
$$
4. **Taking out what is known:** If $Z$ is $\mathcal G$-measurable and bounded, then
$$
\mathbb E[ZX\mid\mathcal G]=Z\mathbb E[X\mid\mathcal G].
$$
5. **Independence:** If $X$ is independent of $\mathcal G$, then
$$
\mathbb E[X\mid\mathcal G]=\mathbb E[X].
$$
:::
The fourth property is especially important in finance. If $Z$ is known at time $t$, then it can be pulled outside a conditional expectation given $\mathcal F_t$.
For example, if $H_t$ is the number of shares chosen at time $t$, then $H_t$ is $\mathcal F_t$-measurable. Hence
$$
\mathbb E[H_t(S_{t+1}-S_t)\mid\mathcal F_t]
=
H_t\mathbb E[S_{t+1}-S_t\mid\mathcal F_t].
$$
This is one reason predictable strategies interact cleanly with martingales.
## 8.9 The Tower Property
The tower property is the central computational identity for dynamic models.
::: {.theorem}
### Theorem 8.3: Tower property
If
$$
\mathcal H\subseteq\mathcal G\subseteq\mathcal F,
$$
and $X$ is integrable, then
$$
\mathbb E[\mathbb E[X\mid\mathcal G]\mid\mathcal H]
=
\mathbb E[X\mid\mathcal H].
$$
:::
In a filtration, if $s\le t\le T$, then
$$
\mathbb E[\mathbb E[X\mid\mathcal F_t]\mid\mathcal F_s]
=
\mathbb E[X\mid\mathcal F_s].
$$
This says that if we first predict $X$ using time-$t$ information and then predict that prediction using time-$s$ information, the result is the same as predicting $X$ directly from time-$s$ information.
::: {.example}
### Example 8.2: Dynamic option pricing
Let $X$ be a payoff at time $T$ and suppose the risk-free asset is used as numeraire. Under a risk-neutral measure $\mathbb Q$, the time-$t$ discounted value is
$$
\widetilde V_t=\mathbb E^{\mathbb Q}[\widetilde X\mid\mathcal F_t].
$$
Then for $s\le t$,
$$
\mathbb E^{\mathbb Q}[\widetilde V_t\mid\mathcal F_s]
=
\mathbb E^{\mathbb Q}[\mathbb E^{\mathbb Q}[\widetilde X\mid\mathcal F_t]\mid\mathcal F_s]
=
\mathbb E^{\mathbb Q}[\widetilde X\mid\mathcal F_s]
=\widetilde V_s.
$$
Thus the discounted value process is a martingale.
:::
## 8.10 Conditional Expectation as Best Prediction
Conditional expectation is not merely a formal averaging rule. It is an optimization solution.
::: {.theorem}
### Theorem 8.4: Best $L^2$ prediction
Assume $X\in L^2(\Omega,\mathcal F,\mathbb P)$. Among all square-integrable $\mathcal G$-measurable random variables $Y$, the unique minimizer of
$$
\mathbb E[(X-Y)^2]
$$
is
$$
Y=\mathbb E[X\mid\mathcal G].
$$
:::
::: {.proof}
Let
$$
Y^*=\mathbb E[X\mid\mathcal G].
$$
For any square-integrable $\mathcal G$-measurable $Y$,
$$
X-Y=(X-Y^*)+(Y^*-Y).
$$
Squaring and taking expectations gives
$$
\mathbb E[(X-Y)^2]
=
\mathbb E[(X-Y^*)^2]
+\mathbb E[(Y^*-Y)^2]
+2\mathbb E[(X-Y^*)(Y^*-Y)].
$$
Since $Y^*-Y$ is $\mathcal G$-measurable,
$$
\mathbb E[(X-Y^*)(Y^*-Y)]
=
\mathbb E\left[(Y^*-Y)\mathbb E[X-Y^*\mid\mathcal G]\right]
=0.
$$
Therefore
$$
\mathbb E[(X-Y)^2]
=
\mathbb E[(X-Y^*)^2]+
\mathbb E[(Y^*-Y)^2]
\ge
\mathbb E[(X-Y^*)^2].
$$
The minimum is attained at $Y=Y^*$.
:::
This theorem explains why conditional expectation is the mathematical foundation of prediction, regression, filtering, and risk forecasting.
## 8.11 Conditional Probability as Conditional Expectation
For an event $A$, the indicator $\mathbf 1_A$ is a random variable. Conditional probability can be defined by conditional expectation:
$$
\mathbb P(A\mid\mathcal G)=\mathbb E[\mathbf 1_A\mid\mathcal G].
$$
In a finite partition model, if $\omega\in B_j$, then
$$
\mathbb P(A\mid\mathcal G)(\omega)
=
\mathbb P(A\mid B_j)
=
\frac{\mathbb P(A\cap B_j)}{\mathbb P(B_j)}.
$$
This connects conditional expectation with Bayesian updating. When information changes, conditional probabilities change, and therefore conditional prices and risk forecasts change.
## 8.12 Conditional Expectation and Martingales
A stochastic process $(M_t)_{t=0}^T$ is a martingale with respect to $(\mathcal F_t)$ if:
1. $M_t$ is $\mathcal F_t$-measurable;
2. $\mathbb E[|M_t|]<\infty$;
3. for $s\le t$,
$$
\mathbb E[M_t\mid\mathcal F_s]=M_s.
$$
Equivalently, for one-step increments,
$$
\mathbb E[M_{t+1}\mid\mathcal F_t]=M_t.
$$
In finance, under a risk-neutral measure $\mathbb Q$, discounted asset prices are martingales:
$$
\mathbb E^{\mathbb Q}[\widetilde S_{t+1}\mid\mathcal F_t]
=
\widetilde S_t.
$$
This means that after discounting, there is no predictable drift under the pricing measure. The expected discounted future price, conditional on current information, equals the current discounted price.
## 8.13 Risk-Neutral Pricing Revisited
Let $B_t$ be the value of the money-market account and define discounted quantities by
$$
\widetilde S_t=\frac{S_t}{B_t},
\qquad
\widetilde X=\frac{X}{B_T}.
$$
If the market is arbitrage-free and $\mathbb Q$ is an equivalent martingale measure, then the time-$t$ price of a claim $X$ is
$$
V_t
=
B_t\mathbb E^{\mathbb Q}\left[\frac{X}{B_T}\mid\mathcal F_t\right].
$$
When the risk-free rate is constant, $B_t=(1+r)^t$ in discrete time. If $X$ is paid at time $T$, then
$$
V_t
=(1+r)^t\mathbb E^{\mathbb Q}\left[\frac{X}{(1+r)^T}\mid\mathcal F_t\right]
=
\frac{1}{(1+r)^{T-t}}\mathbb E^{\mathbb Q}[X\mid\mathcal F_t].
$$
Thus pricing is conditional expectation under the pricing measure, followed by discounting.
::: {.warning}
The measure matters. The real-world measure $\mathbb P$ is used for statistical forecasting and risk estimation. The risk-neutral measure $\mathbb Q$ is used for no-arbitrage pricing. Conditional expectations under $\mathbb P$ and $\mathbb Q$ usually differ.
:::
## 8.14 Interactive Demo: Conditional Pricing in a Two-Step Binomial Tree
The following activity computes the price of a European call option by conditional expectation at each node.
::: {.interactive-card}
### Interactive 8.2: Dynamic pricing by conditional expectation
Move the parameters and observe how the time-$1$ node values and time-$0$ price change. The calculation uses the risk-neutral probability
$$
q=\frac{1+r-d}{u-d}.
$$
<div class="mf-controls">
<label for="mf-ch08-s0">Initial stock price $S_0$</label>
<input id="mf-ch08-s0" type="range" min="60" max="140" step="1" value="100">
<span id="mf-ch08-s0-val">100</span>
<label for="mf-ch08-k">Strike $K$</label>
<input id="mf-ch08-k" type="range" min="60" max="140" step="1" value="100">
<span id="mf-ch08-k-val">100</span>
<label for="mf-ch08-u">Up factor $u$</label>
<input id="mf-ch08-u" type="range" min="1.02" max="1.60" step="0.01" value="1.20">
<span id="mf-ch08-u-val">1.20</span>
<label for="mf-ch08-d">Down factor $d$</label>
<input id="mf-ch08-d" type="range" min="0.40" max="0.98" step="0.01" value="0.85">
<span id="mf-ch08-d-val">0.85</span>
<label for="mf-ch08-r">Risk-free rate $r$ per period</label>
<input id="mf-ch08-r" type="range" min="0.00" max="0.12" step="0.005" value="0.03">
<span id="mf-ch08-r-val">0.030</span>
</div>
<div id="mf-ch08-tree-plot" class="plotly-demo"></div>
<div id="mf-ch08-tree-output" class="mf-output"></div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const ids = ["s0", "k", "u", "d", "r"];
const inputs = Object.fromEntries(ids.map(id => [id, document.getElementById(`mf-ch08-${id}`)]));
const vals = Object.fromEntries(ids.map(id => [id, document.getElementById(`mf-ch08-${id}-val`)]));
const plotDiv = document.getElementById("mf-ch08-tree-plot");
const output = document.getElementById("mf-ch08-tree-output");
if (!plotDiv || typeof Plotly === "undefined") return;
function payoff(s, k) { return Math.max(s - k, 0); }
function update() {
let S0 = parseFloat(inputs.s0.value);
let K = parseFloat(inputs.k.value);
let u = parseFloat(inputs.u.value);
let d = parseFloat(inputs.d.value);
let r = parseFloat(inputs.r.value);
if (d >= 1 + r || 1 + r >= u) {
output.innerHTML = "No-arbitrage requires d < 1 + r < u. Adjust u, d, or r.";
}
vals.s0.textContent = S0.toFixed(0);
vals.k.textContent = K.toFixed(0);
vals.u.textContent = u.toFixed(2);
vals.d.textContent = d.toFixed(2);
vals.r.textContent = r.toFixed(3);
const q = (1 + r - d) / (u - d);
const Su = S0 * u;
const Sd = S0 * d;
const Suu = S0 * u * u;
const Sud = S0 * u * d;
const Sdd = S0 * d * d;
const Xuu = payoff(Suu, K);
const Xud = payoff(Sud, K);
const Xdd = payoff(Sdd, K);
const Vu = (q * Xuu + (1 - q) * Xud) / (1 + r);
const Vd = (q * Xud + (1 - q) * Xdd) / (1 + r);
const V0 = (q * Vu + (1 - q) * Vd) / (1 + r);
const x = [0, 1, 1, 2, 2, 2];
const y = [0, 1, -1, 2, 0, -2];
const labels = [
`S0=${S0.toFixed(2)}<br>V0=${V0.toFixed(3)}`,
`Su=${Su.toFixed(2)}<br>Vu=${Vu.toFixed(3)}`,
`Sd=${Sd.toFixed(2)}<br>Vd=${Vd.toFixed(3)}`,
`Suu=${Suu.toFixed(2)}<br>Xuu=${Xuu.toFixed(3)}`,
`Sud=${Sud.toFixed(2)}<br>Xud=${Xud.toFixed(3)}`,
`Sdd=${Sdd.toFixed(2)}<br>Xdd=${Xdd.toFixed(3)}`
];
const edgeX = [0, 1, null, 0, 1, null, 1, 2, null, 1, 2, null, 1, 2, null, 1, 2];
const edgeY = [0, 1, null, 0, -1, null, 1, 2, null, 1, 0, null, -1, 0, null, -1, -2];
Plotly.react(plotDiv, [
{x: edgeX, y: edgeY, mode: "lines", type: "scatter", hoverinfo: "skip", showlegend: false},
{x: x, y: y, mode: "markers+text", type: "scatter", text: labels, textposition: "middle right", marker: {size: 18}, showlegend: false}
], {
title: "Two-step binomial call pricing by conditional expectation",
xaxis: {visible: false, range: [-0.2, 2.7]},
yaxis: {visible: false, range: [-2.4, 2.4]},
margin: {t: 55, r: 20, b: 20, l: 20}
}, {responsive: true});
output.innerHTML =
`Risk-neutral probability: q = ${q.toFixed(4)}.<br>` +
`Time-1 values: Vu = ${Vu.toFixed(4)}, Vd = ${Vd.toFixed(4)}.<br>` +
`Time-0 price: V0 = ${V0.toFixed(4)}.`;
}
Object.values(inputs).forEach(input => input.addEventListener("input", update));
update();
});
</script>
:::
## 8.15 Worked Example: Two-Step Binomial Pricing
Let
$$
S_0=100,
\qquad
u=1.20,
\qquad
d=0.85,
\qquad
r=0.03,
\qquad
K=100.
$$
The risk-neutral probability is
$$
q=\frac{1+r-d}{u-d}
=\frac{1.03-0.85}{1.20-0.85}
\approx 0.5143.
$$
At time $2$, the stock prices are
$$
S_{uu}=144,
\qquad
S_{ud}=102,
\qquad
S_{dd}=72.25.
$$
The European call payoff is
$$
X=(S_2-K)^+.
$$
Thus
$$
X_{uu}=44,
\qquad
X_{ud}=2,
\qquad
X_{dd}=0.
$$
At the up node at time $1$,
$$
V_1^u
=\frac{1}{1+r}\mathbb E^{\mathbb Q}[X\mid \mathcal F_1,\text{ up}]
=\frac{qX_{uu}+(1-q)X_{ud}}{1+r}.
$$
At the down node,
$$
V_1^d
=\frac{qX_{ud}+(1-q)X_{dd}}{1+r}.
$$
Finally,
$$
V_0
=\frac{qV_1^u+(1-q)V_1^d}{1+r}.
$$
This is backward induction written as repeated conditional expectation.
## 8.16 Conditional Expectation and Regression
For statistics students, conditional expectation is familiar through regression. If $X$ is a feature vector and $Y$ is a response, then the regression function is
$$
m(x)=\mathbb E[Y\mid X=x].
$$
The random variable version is
$$
\mathbb E[Y\mid \sigma(X)].
$$
In machine learning language, the conditional expectation is the population-level function that minimizes expected squared prediction error:
$$
f^*\in \arg\min_f \mathbb E[(Y-f(X))^2].
$$
The solution is
$$
f^*(X)=\mathbb E[Y\mid X].
$$
In finance, this appears in many places:
- predicting future returns given current signals;
- estimating conditional volatility;
- estimating default probabilities given borrower covariates;
- filtering latent regimes from observed prices;
- approximating continuation values in American option pricing.
## 8.17 Python Example 1: Conditional Expectation on a Partition
```{python}
import numpy as np
states = np.array(["omega1", "omega2", "omega3", "omega4"])
probs = np.array([0.20, 0.30, 0.10, 0.40])
X = np.array([10.0, 4.0, 8.0, 2.0])
# Information partition: {omega1, omega2}, {omega3, omega4}
partition = [np.array([0, 1]), np.array([2, 3])]
CE = np.zeros_like(X)
for block in partition:
block_prob = probs[block].sum()
block_mean = np.sum(probs[block] * X[block]) / block_prob
CE[block] = block_mean
print("States:", states)
print("X:", X)
print("E[X | G]:", CE)
print("E[X] =", np.sum(probs * X))
print("E[E[X | G]] =", np.sum(probs * CE))
```
The last two numbers agree, illustrating the smoothing property
$$
\mathbb E[\mathbb E[X\mid\mathcal G]]=\mathbb E[X].
$$
## 8.18 Python Example 2: Checking the Defining Property
```{python}
# Check the defining property on each information block.
for j, block in enumerate(partition, start=1):
lhs = np.sum(probs[block] * CE[block])
rhs = np.sum(probs[block] * X[block])
print(f"Block {j}: integral of CE = {lhs:.6f}, integral of X = {rhs:.6f}")
```
For every event observable under $\mathcal G$, the conditional expectation and the original random variable have the same average value.
## 8.19 Python Example 3: Conditional Expectation as Best Prediction
```{python}
# Compare mean-square error for different G-measurable predictors.
# A G-measurable predictor must be constant on each block.
grid1 = np.linspace(0, 12, 61)
grid2 = np.linspace(0, 12, 61)
best_mse = np.inf
best_pair = None
for a in grid1:
for b in grid2:
Y = np.array([a, a, b, b])
mse = np.sum(probs * (X - Y) ** 2)
if mse < best_mse:
best_mse = mse
best_pair = (a, b)
ce_mse = np.sum(probs * (X - CE) ** 2)
print("Best grid predictor values:", best_pair)
print("Conditional expectation values:", (CE[0], CE[2]))
print("Best grid MSE:", best_mse)
print("Conditional expectation MSE:", ce_mse)
```
The grid search recovers the conditional means on the two information blocks.
## 8.20 Python Example 4: Two-Step Binomial Pricing
```{python}
def two_step_call_price(S0=100, K=100, u=1.20, d=0.85, r=0.03):
q = (1 + r - d) / (u - d)
if not (0 < q < 1):
raise ValueError("No-arbitrage requires d < 1 + r < u.")
Suu = S0 * u * u
Sud = S0 * u * d
Sdd = S0 * d * d
Xuu = max(Suu - K, 0)
Xud = max(Sud - K, 0)
Xdd = max(Sdd - K, 0)
Vu = (q * Xuu + (1 - q) * Xud) / (1 + r)
Vd = (q * Xud + (1 - q) * Xdd) / (1 + r)
V0 = (q * Vu + (1 - q) * Vd) / (1 + r)
return {
"q": q,
"terminal_payoffs": (Xuu, Xud, Xdd),
"time_1_values": (Vu, Vd),
"time_0_price": V0,
}
result = two_step_call_price()
for key, value in result.items():
print(key, value)
```
This is the same calculation as the interactive demo, written in reusable Python form.
## 8.21 Python Example 5: Martingale Check Under the Risk-Neutral Measure
```{python}
S0 = 100
u = 1.20
d = 0.85
r = 0.03
q = (1 + r - d) / (u - d)
# One-period check: discounted stock should be a martingale under Q.
expected_S1_given_F0 = q * S0 * u + (1 - q) * S0 * d
print("E_Q[S1 | F0] =", expected_S1_given_F0)
print("(1+r) S0 =", (1 + r) * S0)
print("Discounted martingale check:", expected_S1_given_F0 / (1 + r), "vs", S0)
```
The risk-neutral probability is chosen precisely so that
$$
\mathbb E^{\mathbb Q}\left[\frac{S_1}{1+r}\mid\mathcal F_0\right]=S_0.
$$
## 8.22 Python Example 6: Regression as Approximate Conditional Expectation
```{python}
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
rng = np.random.default_rng(7243)
n = 2000
# Signal observed today
Z = rng.normal(0, 1, size=n)
# Future return has nonlinear conditional mean plus noise
noise = rng.normal(0, 0.4, size=n)
Y = 0.03 + 0.08 * Z - 0.05 * Z**2 + noise
# Linear approximation to E[Y | Z]
model = LinearRegression()
model.fit(Z.reshape(-1, 1), Y)
Y_hat = model.predict(Z.reshape(-1, 1))
print("Estimated intercept:", model.intercept_)
print("Estimated slope:", model.coef_[0])
print("MSE of linear conditional-mean approximation:", mean_squared_error(Y, Y_hat))
print("MSE of unconditional mean predictor:", mean_squared_error(Y, np.repeat(Y.mean(), n)))
```
The true conditional expectation is nonlinear:
$$
\mathbb E[Y\mid Z]=0.03+0.08Z-0.05Z^2.
$$
The linear model gives only a linear approximation. This illustrates why a fitted regression model should not automatically be confused with the true conditional expectation.
## 8.23 AI Component: Explaining Conditional Expectation Carefully
::: {.ai-box}
### AI-assisted explanation prompt
Ask an AI tool:
> Explain conditional expectation to a graduate student in applied mathematics using a finite-state financial model. Your explanation must distinguish $\mathbb E[X]$, $\mathbb E[X\mid A]$, and $\mathbb E[X\mid\mathcal G]$. Include one example where $\mathcal G$ is generated by a partition.
Then check the response against these criteria:
1. Does it explain that $\mathbb E[X\mid\mathcal G]$ is a random variable, not usually a number?
2. Does it state that $\mathbb E[X\mid\mathcal G]$ must be $\mathcal G$-measurable?
3. Does it mention that conditional expectation averages over states that cannot be distinguished by the information set?
4. Does it avoid treating conditional expectation as ordinary division by an event?
:::
## 8.24 AI Component: Proof Audit
::: {.ai-box}
### AI-assisted proof audit
Give an AI tool the following claim:
> If $X$ is independent of $\mathcal G$, then $\mathbb E[X\mid\mathcal G]=\mathbb E[X]$.
Ask it to provide a proof using the defining property of conditional expectation. Then audit the proof:
- Did it show that $\mathbb E[X]$ is $\mathcal G$-measurable?
- Did it verify $\int_A \mathbb E[X]d\mathbb P=\int_A Xd\mathbb P$ for all $A\in\mathcal G$?
- Did it use independence in the correct place?
- Did it avoid assuming that $X$ is constant?
:::
## 8.25 AI Component: Code Review for Look-Ahead Bias
::: {.ai-box}
### AI-assisted code-review prompt
Give an AI tool the following task:
> Review this trading-signal code for look-ahead bias. A valid signal at time $t$ may use only information available at time $t$ or earlier. Identify any line that uses future information.
Then provide it with code such as:
```python
returns = prices.pct_change()
signal = returns.shift(-1).rolling(20).mean()
position = np.where(signal > 0, 1, -1)
pnl = position * returns
```
Expected issue: `shift(-1)` uses future returns to construct today's signal. This violates adaptedness. In the language of this chapter, the position is not $\mathcal F_t$-measurable.
:::
## 8.26 Common Mistakes
::: {.warning}
### Mistake 1: Treating $\mathbb E[X\mid\mathcal G]$ as a number
Conditional expectation given a sigma-algebra is generally a random variable. It becomes a number only when the information set is trivial or when we condition on a specific event and then evaluate the average on that event.
:::
::: {.warning}
### Mistake 2: Ignoring measurability
A proposed conditional expectation must be measurable with respect to the information being conditioned on. In a tree, a time-$t$ value must be constant across terminal states that share the same time-$t$ history.
:::
::: {.warning}
### Mistake 3: Using the physical measure for arbitrage-free pricing
For derivatives pricing, conditional expectations are taken under the risk-neutral measure $\mathbb Q$, not necessarily under the historical measure $\mathbb P$.
:::
::: {.warning}
### Mistake 4: Pulling out a random variable that is not known
The identity
$$
\mathbb E[ZX\mid\mathcal G]=Z\mathbb E[X\mid\mathcal G]
$$
requires $Z$ to be $\mathcal G$-measurable. If $Z$ depends on future information, the identity is invalid.
:::
## 8.27 Chapter Summary
This chapter introduced conditional expectation as the mathematical operation that updates predictions using available information.
The main ideas are:
- a sigma-algebra represents information;
- a filtration represents information through time;
- $\mathbb E[X\mid\mathcal G]$ is a $\mathcal G$-measurable random variable;
- in finite models, conditional expectation averages over information blocks;
- the defining property is
$$
\int_A \mathbb E[X\mid\mathcal G]d\mathbb P=\int_A Xd\mathbb P
\quad\text{for all }A\in\mathcal G;
$$
- conditional expectation is the best mean-square prediction given information;
- the tower property is the backbone of dynamic pricing;
- under a risk-neutral measure, discounted asset prices and discounted derivative values are martingales;
- regression can be interpreted as estimating or approximating conditional expectation.
Conditional expectation is one of the main bridges connecting probability theory, statistics, stochastic processes, and mathematical finance.
## 8.28 Exercises
### Conceptual Exercises
1. Explain why $\mathbb E[X\mid\mathcal G]$ is generally a random variable rather than a number.
2. In a finite model, explain why a $\mathcal G$-measurable random variable must be constant on each information block.
3. What is the difference between $\mathbb E[X\mid A]$ and $\mathbb E[X\mid\mathcal G]$?
4. Explain why a trading strategy must be adapted or predictable.
5. Why is conditional expectation central to martingale pricing?
### Computational Exercises
6. Let $\Omega=\{1,2,3,4,5,6\}$ with equal probabilities and let $X(\omega)=\omega^2$. Let $\mathcal G$ be generated by the partition $\{1,2,3\}$ and $\{4,5,6\}$. Compute $\mathbb E[X\mid\mathcal G]$.
7. Repeat Exercise 6 with the partition into odd and even outcomes.
8. Let $X=(3,7,1,5)$ and $p=(0.1,0.2,0.3,0.4)$. Compute $\mathbb E[X]$ and $\mathbb E[X\mid\mathcal G]$ for $\mathcal G=\sigma(\{\omega_1,\omega_4\},\{\omega_2,\omega_3\})$.
9. Verify the smoothing property numerically for Exercise 8.
10. Construct two different nontrivial sigma-algebras on a four-state space and compute the corresponding conditional expectations of the same payoff.
### Proof Exercises
11. Prove the finite partition formula for conditional expectation.
12. Prove the smoothing property from the defining property of conditional expectation.
13. Prove the tower property in the special case of finite partitions where one partition refines another.
14. Prove the taking-out-what-is-known property in a finite-state model.
15. Prove that if $X$ is independent of $\mathcal G$, then $\mathbb E[X\mid\mathcal G]=\mathbb E[X]$.
### Finance Exercises
16. In a two-step binomial model, write the time-$1$ value of a European put as a conditional expectation under $\mathbb Q$.
17. Show that the discounted value process of a European claim is a martingale under $\mathbb Q$.
18. Explain why the time-$1$ price of a derivative in a tree must be constant across terminal states that share the same time-$1$ node.
19. Give an example of a trading rule that violates adaptedness.
20. Explain the difference between forecasting tomorrow's stock return under $\mathbb P$ and pricing an option payoff under $\mathbb Q$.
### Python Exercises
21. Write a function that takes a payoff vector, probability vector, and partition, and returns the conditional expectation.
22. Use your function to verify the defining property of conditional expectation on all events in a sigma-algebra generated by a partition.
23. Simulate a two-step binomial model and compute conditional expectations at time $0$ and time $1$.
24. Compare the mean-square error of the conditional expectation predictor with several other predictors that are constant on each information block.
25. Simulate data from a nonlinear conditional mean model and compare linear regression, polynomial regression, and a random forest as approximations to $\mathbb E[Y\mid X]$.
### AI-Assisted Exercises
26. Ask an AI tool to explain the tower property using a finance example. Identify any unclear or incorrect statements.
27. Ask an AI tool to generate a finite-state conditional expectation example. Verify every probability and arithmetic calculation by hand.
28. Ask an AI tool to review Python code for a trading signal and identify possible look-ahead bias.
29. Ask an AI tool to distinguish $\mathbb P$ and $\mathbb Q$ in the pricing formula. Improve the explanation if it is too vague.
30. Ask an AI tool to prove the best $L^2$ prediction theorem. Check whether the proof correctly uses orthogonality.