Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Conditional expectation as projection

Conditional expectation is an orthogonal projection when the projected quantity is square integrable. The ambient vectors are random variables, and the inner product is an expectation under a fixed probability law. This gives a precise meaning to the part of a quantity that can be recovered from an observation.

Fix the probability law and the space

Work on a probability space with law PP. The Hilbert space L2(P)L^2(P) consists of real random variables AA with E[A2]<\mathbb E[A^2]<\infty, identifying variables that agree almost surely. Its inner product and norm are

A,BP=E[AB],AP2=E[A2].\langle A,B\rangle_P=\mathbb E[AB],\qquad \|A\|_P^2=\mathbb E[A^2].

Let XX be an observation and σ(X)\sigma(X) the information it generates. Define the subspace

HX=L2(σ(X),P).\mathcal H_X=L^2(\sigma(X),P).

For ordinary real- or vector-valued observations, this is the space of all square-integrable functions g(X)g(X). The space is closed: an L2L^2-convergent sequence of σ(X)\sigma(X)-measurable variables has an almost surely convergent subsequence, and its limit has a σ(X)\sigma(X)-measurable version. Thus its L2L^2 limit belongs to HX\mathcal H_X.

The observation XX itself need not have a finite second moment. It is the projected quantity AA, and each comparison function g(X)g(X), that must be in L2(P)L^2(P).

The residual is orthogonal to every function of the observation

Let m=E[AX]m=\mathbb E[A\mid X]. Conditional Jensen gives E[m2]E[A2]\mathbb E[m^2]\le\mathbb E[A^2], so mHXm\in\mathcal H_X. By the defining property of conditional expectation,

E[(Am)g(X)]=E ⁣[g(X)E[AmX]]=0\mathbb E[(A-m)g(X)] =\mathbb E\!\left[g(X)\mathbb E[A-m\mid X]\right]=0

for bounded gg. For a general g(X)HXg(X)\in\mathcal H_X, truncate gg and pass to the limit using Cauchy–Schwarz. The same identity holds because AmA-m is square integrable. Therefore

ΠXA=E[AX],AΠXAHX.\Pi_X A=\mathbb E[A\mid X],\qquad A-\Pi_X A\perp\mathcal H_X.

This proves the projection claim directly: the candidate lies in the closed subspace and its residual is orthogonal to that subspace. Uniqueness is up to almost sure equality, as it must be in L2(P)L^2(P).

Pythagoras and least-squares prediction

For any g(X)HXg(X)\in\mathcal H_X, write Ag(X)=(Am)+(mg(X))A-g(X)=(A-m)+(m-g(X)). Expanding its squared norm and using orthogonality eliminates the cross term:

E[(Ag(X))2]=E[(Am)2]+E[(mg(X))2].\mathbb E[(A-g(X))^2] =\mathbb E[(A-m)^2]+\mathbb E[(m-g(X))^2].

The first term is independent of gg. Consequently mm uniquely minimizes mean squared prediction error over all square-integrable functions of XX. The theorem concerns a chosen joint law of (A,X)(A,X); it does not by itself give a procedure for learning an unknown conditional mean from finite data.

Taking g=0g=0 also proves ΠXAPAP\|\Pi_XA\|_P\le\|A\|_P. Applying conditional expectation twice changes nothing, so ΠX2=ΠX\Pi_X^2=\Pi_X. These are the contraction and idempotence properties of orthogonal projection.

A nonlinear example

Let XX be uniform on [1,1][-1,1] and let ε\varepsilon be independent of XX with mean zero and variance τ2<\tau^2<\infty. Set A=X2+εA=X^2+\varepsilon. Then

E[AX]=X2.\mathbb E[A\mid X]=X^2.

This is nonlinear in the observed value, but conditional expectation is still a linear operator on random variables: ΠX(aA+bB)=aΠXA+bΠXB\Pi_X(aA+bB)=a\Pi_XA+b\Pi_XB.

If prediction is restricted to affine functions a+bXa+bX, symmetry gives Cov(A,X)=0\operatorname{Cov}(A,X)=0, so the best affine predictor is the constant E[A]=1/3\mathbb E[A]=1/3. Since E[X4]=1/5\mathbb E[X^4]=1/5,

E[(AX2)2]=τ2,E[(A1/3)2]=τ2+1519=τ2+445.\begin{aligned} \mathbb E[(A-X^2)^2]&=\tau^2,\\ \mathbb E[(A-1/3)^2]&=\tau^2+\frac15-\frac19 =\tau^2+\frac4{45}. \end{aligned}

Projecting onto the span of 1 and XX discards a predictable nonlinear component. Projecting onto HX\mathcal H_X retains it.

Vector quantities and total covariance

For a finite-dimensional random vector AA with E[A22]<\mathbb E[\|A\|_2^2]<\infty, apply the scalar result to each component. Writing m=E[AX]m=\mathbb E[A\mid X] and μ=E[A]\mu=\mathbb E[A] gives Aμ=(Am)+(mμ)A-\mu=(A-m)+(m-\mu). Both cross-covariance matrices vanish by the same orthogonality identity. Hence

Cov(A)=Cov(E[AX])+E[Cov(AX)].\operatorname{Cov}(A) =\operatorname{Cov}(\mathbb E[A\mid X]) +\mathbb E[\operatorname{Cov}(A\mid X)].

The second term is positive semidefinite. It measures the variation in AA remaining after XX is known. The scalar version is the law of total variance used in the normal-mixture conditioning example.

In ordinary EM, posterior expectations are computed under the current model law. If they are viewed as projections, that law, and therefore the inner product, must be held fixed for the step. A later missing-information calculation will apply total covariance to a joint score after first proving how its marginal score is obtained.

Continue with Fisher geometry, which uses L2L^2 inner products on scores, or return to the Information Geometry hub.