Throughout, expectations are integrals against P (Expectation (ii), Expectation (iii), Expectation (iv)); constant functions and pointwise sums, products and matrix products of measurable functions are measurable (Measurable Maps: Generators, Composition, Continuous Maps, Restrictions, and Criteria for Real- and [0,∞]-Valued Maps (iii), Arithmetic of Measurable Real- and [0,∞]-Valued Maps (i), Sums, Products, Transposes, Dot Products and Norms of Measurable Vector- and Matrix-Valued Maps (i), Sums, Products, Transposes, Dot Products and Norms of Measurable Vector- and Matrix-Valued Maps (ii), Vector- and Matrix-Valued Measurable Maps: Components, Entries and Continuous Images (ii)); and for X,Y∈L2(P) we have X,Y∈L1(P), constants lie in L2(P), the centred functions X−EX, Y−EY lie in L2(P), and products of elements of L2(P) lie in L1(P) (Lᵖ Inclusions and Constants on a Finite Measure Space (i), Elementary Properties of the p-Seminorm (i), Lᵖ Inclusions and Constants on a Finite Measure Space (ii), Minkowski's Inequality (i), Hölder's Inequality (ii)).
Events. By Basic Properties of the Integral of Nonnegative Measurable Maps (ii), 1B∈M+(Ω,F) and ∫Ω1BdP=P(B). Since P(B)≤P(Ω)=1 (Basic Properties of a Measure (iii)), the real-valued function 1B is also integrable, with the same integral (Measurable Maps: Generators, Composition, Continuous Maps, Restrictions, and Criteria for Real- and [0,∞]-Valued Maps (vii), Linearity and Monotonicity of the Lebesgue Integral, and the Integrability Criterion (vi)). So E1B=P(B) for either reading of the expectation.
Constants. By Lᵖ Inclusions and Constants on a Finite Measure Space (ii) with exponent 1, the constant c is integrable and
Ec=cP(Ω)=c.
Linearity, monotonicity and absolute value. These are Linearity and Monotonicity of the Lebesgue Integral, and the Integrability Criterion (vii), Linearity and Monotonicity of the Lebesgue Integral, and the Integrability Criterion (ix) and Linearity and Monotonicity of the Lebesgue Integral, and the Integrability Criterion (x) for μ=P.
Affine functions of random vectors. By Rules for Integrals of Vector- and Matrix-Valued Functions (v), AX is integrable and E(AX)=AEX. The constant function b has the constant components bk, so by (ii) it is integrable with Eb=b (Integrable Vector- and Matrix-Valued Functions and Their Integrals (i), Integrable Vector- and Matrix-Valued Functions and Their Integrals (ii)). By Rules for Integrals of Vector- and Matrix-Valued Functions (iii) with both coefficients 1, AX+b is integrable and E(AX+b)=AEX+b.
Covariance and variance formulas. Pointwise,
(X−EX)(Y−EY)=XY−(EY)X−(EX)Y+EXEY,
so (iii) and (ii) give
Cov(X,Y)=E[XY]−EYEX−EXEY+EXEY=E[XY]−EXEY
(Variance and Covariance (i)). For Y=X this is the formula for VarX=Cov(X,X) (Variance and Covariance (ii)).
Variances are nonnegative. Since (X−EX)2≥0 pointwise, (iv) and (ii) give
VarX=E[(X−EX)2]≥E0=0
(Variance and Covariance (i), Variance and Covariance (ii)).
Variance of an affine function. The constant b lies in L2(P) (Lᵖ Inclusions and Constants on a Finite Measure Space (ii)), so aX+b∈L2(P) (Minkowski's Inequality (i)). By (iii) and (ii), E(aX+b)=aEX+b, so (aX+b)−E(aX+b)=a(X−EX), and by Variance and Covariance (i), Variance and Covariance (ii) and (iii),
Var(aX+b)=E[a2(X−EX)2]=a2E[(X−EX)2]=a2VarX.
Covariance is symmetric and bilinear. Symmetry holds because multiplication in R is commutative (Variance and Covariance (i)). Next, aX+bY∈L2(P) (Minkowski's Inequality (i)) and E(aX+bY)=aEX+bEY, so
(aX+bY−E(aX+bY))(Z−EZ)=a(X−EX)(Z−EZ)+b(Y−EY)(Z−EZ),
and (iii) gives Cov(aX+bY,Z)=aCov(X,Z)+bCov(Y,Z). Finally the constant c lies in L2(P) (Lᵖ Inclusions and Constants on a Finite Measure Space (ii)) and Ec=c, so (X−EX)(c−Ec)=0 and Cov(X,c)=E0=0.
Covariance matrices as expectations. The components of X and Y lie in L2(P)⊆L1(P) (Square-Integrable Vector-Valued Functions: Components, Dot Products and Almost-Everywhere Equality (i)), so X and Y are integrable, with (EX)k=EXk (Integrable Vector- and Matrix-Valued Functions and Their Integrals (i), Expectation (iii)). Put Z=X−EX and W=Y−EY, with components Zk=Xk−EXk and Wl=Yl−EYl in L2(P). The entries ZkWl of ZW⊤ lie in L1(P), so ZW⊤ is integrable (Integrable Vector- and Matrix-Valued Functions and Their Integrals (iii)), and for all k∈[n], l∈[r], by Expectation (iv), Variance and Covariance (i) and Variance and Covariance (v),
(E[ZW⊤])kl=E[ZkWl]=Cov(Xk,Yl)=Cov(X,Y)kl.
So Cov(X,Y)=E[ZW⊤]. Moreover Cov(X)=Cov(X,X), both matrices having the entries Cov(Xi,Xj) (Variance and Covariance (iv), Variance and Covariance (v)).
Covariance matrices are positive semidefinite. By (x), Cov(X)ij=Cov(Xi,Xj)=Cov(Xj,Xi)=Cov(X)ji, so Cov(X) is symmetric (Symmetric Real Matrices and the Set S(n) (iii)). Let u∈Rn and Z=X−EX. By The Dot Product on Rn (i) and Matrix-Vector Product (i), then Variance and Covariance (i), then Linearity and Monotonicity of the Lebesgue Integral, and the Integrability Criterion (viii) (for each i, and then for the sum over i),
u⋅(Cov(X)u)=i=1∑nuij=1∑nCov(Xi,Xj)uj=i=1∑nuij=1∑nujE[ZiZj]=E[i=1∑nuij=1∑nujZiZj]=E[(u⋅Z)2]≥0,
the inequality by (iv) and (ii). So Cov(X) is positive semidefinite (Positive Semidefinite and Positive Definite Real Matrices (i)).
Covariance of affine functions. First, AX+b∈L2(P;Rm). With cA=∑i=1m∑j=1nAij2 we have ∥AX(ω)∥2≤cA∥X(ω)∥2 for every ω∈Ω (Algebraic Rules for Matrix Products, Matrix-Vector Products and Transposes (ix)), that is, ∣AX∣2≤cA∣X∣2 for the functions of Square-Integrable Vector-Valued Functions (i); so
∫Ω∣AX∣2dP≤cA∫Ω∣X∣2dP<∞
(Basic Properties of the Integral of Nonnegative Measurable Maps (iii), Basic Properties of the Integral of Nonnegative Measurable Maps (iv), Square-Integrable Vector-Valued Functions (ii)). The constant b has constant components, so it lies in L2(P;Rm) (Lᵖ Inclusions and Constants on a Finite Measure Space (ii), Square-Integrable Vector-Valued Functions: Components, Dot Products and Almost-Everywhere Equality (i)), and AX+b∈L2(P;Rm) by Square-Integrable Vector-Valued Functions: Components, Dot Products and Almost-Everywhere Equality (iii). Likewise CY+d∈L2(P;Rs).
Let Z=X−EX and W=Y−EY. By (vi) and Algebraic Rules for Matrix Products, Matrix-Vector Products and Transposes (v), the centred functions are
(AX+b)−E(AX+b)=AZ,(CY+d)−E(CY+d)=CW.
For i∈[m] and j∈[s], by Matrix-Vector Product (i), Product of Real Matrices (i) and Transpose of a Real Matrix (i),
((AZ)(CW)⊤)ij=(k=1∑nAikZk)(l=1∑rCjlWl)=l=1∑r(k=1∑nAikZkWl)Cjl=((AZW⊤)C⊤)ij.
So, by (xi) for AX+b and CY+d, then Rules for Integrals of Vector- and Matrix-Valued Functions (vi), then (xi) for X and Y,
Cov(AX+b,CY+d)=E[(AZ)(CW)⊤]=E[AZW⊤C⊤]=AE[ZW⊤]C⊤=ACov(X,Y)C⊤.
Taking Y=X, C=A and d=b, and using Cov(X)=Cov(X,X) and Cov(AX+b)=Cov(AX+b,AX+b) ((xi)), gives Cov(AX+b)=ACov(X)A⊤.
Second-moment matrix. The components Xi lie in L2(P) (Square-Integrable Vector-Valued Functions: Components, Dot Products and Almost-Everywhere Equality (i)), so the entries XiXj of XX⊤ lie in L1(P) and XX⊤ is integrable (Integrable Vector- and Matrix-Valued Functions and Their Integrals (iii)). For i,j∈[n], by Variance and Covariance (iv), (vii), Expectation (iv) and Expectation (iii),
Cov(X)ij=Cov(Xi,Xj)=E[XiXj]−EXiEXj=(E[XX⊤])ij−((EX)(EX)⊤)ij,
and matrices with the same entries are equal.