Tutorials › Statistical Theory I - Probability and Distribution Theory › Affine Images and Cross-Covariances of Gaussian Blocks

Gaussian Conditioning and Linear Maps · Tutorial 721 of 994

Affine Images and Cross-Covariances of Gaussian Blocks

Learn to calculate the joint Gaussian law’s mean and covariance after affine transformations of one or more blocks, including cross-covariances between differently sized outputs.

Advanced 10 min read

What You'll Learn

  • Write affine transformations of Gaussian blocks with explicit matrix dimensions.
  • Derive transformed means, variances, and cross-covariances from block covariance matrices.
  • Handle transformations that mix multiple jointly Gaussian blocks.
  • Verify matrix orientation in cross-covariance calculations.
  • Distinguish the effect of a constant offset from the effect of a linear map.

Why affine images of Gaussian blocks matter

Gaussian models are often expressed in terms of several related random vectors, but calculations rarely stop at the original coordinates. A measurement may combine several components, a contrast may subtract one block from another, or a reported quantity may be shifted by a fixed baseline. Each operation changes the mean and covariance in a systematic way. When two transformed quantities are reported together, their cross-covariance is just as important as either marginal covariance.

The key point is that the transformations need not be square or invertible. A matrix can map a long vector to a shorter one, or to a longer one, and different output vectors can have different dimensions. The formulas below apply to all such affine maps. They also include Gaussian vectors with singular covariance matrices; no density or inverse covariance matrix is needed.

Block notation and affine transformations

Let \(X\) be a \(p\)-dimensional random vector and \(Y\) a \(q\)-dimensional random vector. Suppose they are jointly Gaussian, with finite means \(\mu_X=E[X]\) and \(\mu_Y=E[Y]\). Write their covariance matrix in blocks as follows.

$$ \begin{pmatrix} X\\Y \end{pmatrix} \sim N\left( \begin{pmatrix} \mu_X\\\mu_Y \end{pmatrix}, \begin{pmatrix} \Sigma_{XX}&\Sigma_{XY}\\ \Sigma_{YX}&\Sigma_{YY} \end{pmatrix} \right), \qquad \Sigma_{XY}=\operatorname{Cov}(X,Y),\quad \Sigma_{YX}=\Sigma_{XY}^{T}. $$

Here \(\Sigma_{XX}\) is \(p\times p\), \(\Sigma_{YY}\) is \(q\times q\), and \(\Sigma_{XY}\) is \(p\times q\). Consider affine transformations \(U=AX+a\) and \(V=BY+b\), where \(A\) is \(r\times p\), \(B\) is \(s\times q\), \(a\) is a fixed \(r\)-vector, and \(b\) is a fixed \(s\)-vector.

Definition: An affine transformation of a random vector \(X\) is a vector of the form \(AX+a\), where \(A\) is a fixed matrix of compatible dimensions and \(a\) is a fixed vector. The matrix may be rectangular, and it need not have full rank.

The constants \(a\) and \(b\) shift the outputs but are not random. The matrix \(A\) determines how coordinates of \(X\) are combined; \(B\) plays the corresponding role for \(Y\). In particular, the cross-covariance of \(U\) and \(V\) has \(r\) rows and \(s\) columns.

The affine transformation theorem

Theorem: If \((X^T,Y^T)^T\) is jointly Gaussian with mean and covariance blocks as displayed above, then \((U^T,V^T)^T\) is jointly Gaussian. Its mean and covariance are
$$ E\begin{pmatrix}U\\V\end{pmatrix} = \begin{pmatrix}A\mu_X+a\\B\mu_Y+b\end{pmatrix}, \qquad \operatorname{Cov}\begin{pmatrix}U\\V\end{pmatrix} = \begin{pmatrix} A\Sigma_{XX}A^T&A\Sigma_{XY}B^T\\ B\Sigma_{YX}A^T&B\Sigma_{YY}B^T \end{pmatrix}. $$

The diagonal blocks are the covariance matrices of the transformed vectors. The upper-right block is \(\operatorname{Cov}(U,V)\), and the lower-left block is its transpose. Notice the order in \(A\Sigma_{XY}B^T\): it yields an \(r\times s\) matrix, as required.

A more general version allows both outputs to use both original blocks. If \(U=AX+CY+a\) and \(V=DX+EY+b\), define \(Z=(X^T,Y^T)^T\), \(H=(A\ \ C)\), and \(K=(D\ \ E)\). Then \(U=HZ+a\), \(V=KZ+b\), and, writing \(\Sigma=\operatorname{Cov}(Z)\),

$$ E[U]=H E[Z]+a,\qquad E[V]=K E[Z]+b,\qquad \operatorname{Cov}(U,V)=H\Sigma K^T. $$

This form is useful when the outputs are different combinations of the same blocks. The block-specific formulas follow by taking \(H=(A\ \ 0)\) and \(K=(0\ \ B)\).

Proof and derivation

First, the affine image is jointly Gaussian. By the definition of joint Gaussianity, every scalar linear combination of the entries of the output vector must be normally distributed, with a constant allowed as a degenerate normal variable. For arbitrary fixed vectors \(c\in\mathbb{R}^r\) and \(d\in\mathbb{R}^s\),

$$ c^TU+d^TV = \begin{pmatrix}A^Tc\\B^Td\end{pmatrix}^{T} \begin{pmatrix}X\\Y\end{pmatrix} +c^Ta+d^Tb. $$

The first term on the right is a scalar linear combination of a jointly Gaussian vector, so it is normal. Adding the constant \(c^Ta+d^Tb\) preserves normality. Thus every scalar linear combination of \((U^T,V^T)^T\) is normal, proving that the output vector is jointly Gaussian.

Linearity of expectation gives \(E[U]=A\mu_X+a\) and \(E[V]=B\mu_Y+b\). To derive the covariance blocks, subtract these means. Since fixed constants cancel, \(U-E[U]=A(X-\mu_X)\) and \(V-E[V]=B(Y-\mu_Y)\). Therefore,

$$ \begin{aligned} \operatorname{Cov}(U,V) &=E\left[(U-E[U])(V-E[V])^T\right]\\ &=E\left[A(X-\mu_X)(Y-\mu_Y)^TB^T\right]\\ &=A\,E\left[(X-\mu_X)(Y-\mu_Y)^T\right]B^T\\ &=A\Sigma_{XY}B^T. \end{aligned} $$

The matrices \(A\) and \(B\) are fixed, so they can be taken outside the expectation. Applying the same calculation with \(V=U\) gives \(\operatorname{Cov}(U)=A\Sigma_{XX}A^T\); applying it to \(V\) gives \(\operatorname{Cov}(V)=B\Sigma_{YY}B^T\). Finally, covariance symmetry gives \(\operatorname{Cov}(V,U)=\operatorname{Cov}(U,V)^T=B\Sigma_{YX}A^T\). These blocks give the stated joint covariance. \(\square\)

Worked calculations

Worked Example: A Rectangular Map and a Nonzero Offset

Suppose \(X\) is two-dimensional and \(Y\) is scalar, jointly Gaussian, with \(\mu_X=(1,-1)^T\), \(\mu_Y=2\), \(\Sigma_{XX}=\begin{pmatrix}2&1\\1&1\end{pmatrix}\), \(\Sigma_{XY}=(1,0)^T\), and \(\Sigma_{YY}=2\). Let \(U=AX+a\) and \(V=2Y+4\), where \(A=\begin{pmatrix}1&2\\-1&1\end{pmatrix}\) and \(a=(3,-2)^T\).

The map \(A\) is \(2\times2\), while the map from \(Y\) to \(V\) is \(1\times1\); thus \(U\) is two-dimensional and \(V\) is scalar. Their means are

$$ E[U]=A\mu_X+a= \begin{pmatrix}-1\\-2\end{pmatrix} +\begin{pmatrix}3\\-2\end{pmatrix} =\begin{pmatrix}2\\-4\end{pmatrix}, \qquad E[V]=2(2)+4=8. $$

For the covariance of \(U\), first multiply \(A\Sigma_{XX}=\begin{pmatrix}4&3\\-1&0\end{pmatrix}\). Hence

$$ \operatorname{Cov}(U)=A\Sigma_{XX}A^T = \begin{pmatrix}4&3\\-1&0\end{pmatrix} \begin{pmatrix}1&-1\\2&1\end{pmatrix} = \begin{pmatrix}10&-1\\-1&1\end{pmatrix}. $$

The variance of \(V\) is \(2\cdot 2^2=8\). Because the map for \(V\) has coefficient \(2\), its cross-covariance with \(U\) is

$$ \operatorname{Cov}(U,V) =A\Sigma_{XY}(2) = \begin{pmatrix}1&2\\-1&1\end{pmatrix} \begin{pmatrix}1\\0\end{pmatrix}2 = \begin{pmatrix}2\\-2\end{pmatrix}. $$

Thus the joint covariance has upper-right block \((2,-2)^T\) and lower-left block \((2,-2)\). The offsets affect the means, but not these covariance calculations.

Worked Example: Two Outputs Mixing Both Blocks

Let \(X,Y\) be jointly Gaussian scalars with mean \((1,2)^T\) and covariance \(\Sigma=\begin{pmatrix}4&1\\1&2\end{pmatrix}\). This covariance is valid: its leading diagonal entry is positive and its determinant is \(4(2)-1=7>0\). Define \(U=2X-Y+3\) and \(V=X+3Y-1\).

The coefficient rows are \(h=(2,-1)\) and \(k=(1,3)\). The means are \(E[U]=2(1)-2+3=3\) and \(E[V]=1+3(2)-1=6\). To calculate the variance of \(U\), multiply \(\Sigma h^T=(7,0)^T\), so \(\operatorname{Var}(U)=h\Sigma h^T=(2,-1)(7,0)^T=14\).

For \(V\), \(\Sigma k^T=(7,7)^T\), giving \(\operatorname{Var}(V)=k\Sigma k^T=(1,3)(7,7)^T=28\). The cross-covariance is

$$ \operatorname{Cov}(U,V)=h\Sigma k^T =(2,-1)\begin{pmatrix}7\\7\end{pmatrix} =14-7=7. $$

Therefore, the transformed pair has mean \((3,6)^T\) and covariance \(\begin{pmatrix}14&7\\7&28\end{pmatrix}\). The nonzero cross-covariance records that the two different combinations still vary together.

Worked Example: Transforming a Three-Dimensional Vector to Different Output Sizes

Let \(Z\) be Gaussian with mean \((2,0,-1)^T\) and covariance \(\Sigma=\operatorname{diag}(1,4,9)\). Define a two-dimensional output and a scalar output by

$$ U=TZ+a,\quad T=\begin{pmatrix}1&1&0\\0&1&1\end{pmatrix},\quad a=\begin{pmatrix}1\\-2\end{pmatrix}; \qquad V=SZ+b,\quad S=(1,-1,2),\quad b=4. $$

The means are \(E[U]=T(2,0,-1)^T+a=(3,-3)^T\) and \(E[V]=S(2,0,-1)^T+4=4\). For the covariance of \(U\),

$$ T\Sigma= \begin{pmatrix}1&4&0\\0&4&9\end{pmatrix}, \qquad \operatorname{Cov}(U)=T\Sigma T^T =\begin{pmatrix}5&4\\4&13\end{pmatrix}. $$

Also, \(\Sigma S^T=(1,-4,18)^T\), so \(\operatorname{Cov}(U,V)=T\Sigma S^T=(-3,14)^T\). Finally, \(\operatorname{Var}(V)=S\Sigma S^T=1+4+36=41\). The full covariance is therefore \(\begin{pmatrix}5&4&-3\\4&13&14\\-3&14&41\end{pmatrix}\), with a \(2\times1\) cross-covariance block and its \(1\times2\) transpose.

Common mistake: offsets and matrix orientation

A frequent error is to carry an offset into a covariance formula, as if \(\operatorname{Cov}(AX+a,BY+b)\) included a term involving \(a\) or \(b\). Covariance is computed after subtracting the means, and the offsets cancel: \((AX+a)-E[AX+a]=A(X-E[X])\). Another common error is to write \(A\Sigma_{XY}B\) instead of \(A\Sigma_{XY}B^T\). The latter transpose is essential both for the covariance definition and for the result to have the required \(r\times s\) dimensions.

It is also a mistake to infer that two transformed Gaussian vectors are independent merely because they are constructed separately or because their formulas look different. Their cross-covariance must be examined; independence is not a consequence of separate notation. The calculation of cross-covariance is the reliable first step, while the broader relationship between zero cross-covariance and Gaussian independence requires its own result.

Why the formulas are useful

These formulas let a model be moved into whichever coordinates make a statistical question convenient. A contrast matrix can encode comparisons, a rectangular map can compress measurements, and an offset can place the result on a chosen baseline. The transformed covariance quantifies the variability in those coordinates, while the cross-covariance describes how two resulting summaries co-vary.

The calculations do not require the map to be invertible or the covariance matrix to have an inverse. That matters whenever a transformation discards coordinates or creates redundant outputs. The current formulas still give the correct means and covariances in those settings; questions about the resulting rank, support, and degeneracy are separate.

Key takeaway: For jointly Gaussian blocks, apply the linear maps on the left and their transposes on the right: \(\operatorname{Cov}(AX+a,BY+b)=A\operatorname{Cov}(X,Y)B^T\). Fixed offsets change means only, and the transformed blocks remain jointly Gaussian.

Check Your Understanding

Use the affine transformation formulas to answer these questions.

  1. If \(U=AX+a\), \(V=BY+b\), and \(\operatorname{Cov}(X,Y)=\Sigma_{XY}\), what are the dimensions of \(\operatorname{Cov}(U,V)\)?
  2. Which part of the transformed mean changes when the offset \(a\) is replaced by \(a+c\), and which covariance blocks change?
  3. Suppose \(\operatorname{Cov}(X,Y)=0\). What does the cross-covariance formula imply for \(\operatorname{Cov}(AX+a,BY+b)\)?
  4. For \(U=HX+a\) and \(V=KX+b\), write the formula for \(\operatorname{Cov}(U,V)\).
  5. Why does checking the dimensions help detect an incorrect transpose in a cross-covariance formula?