Tutorials › Multivariate Statistics (Graduate) › Deriving the Generalized Eigenvalue Equations

Canonical Correlation Analysis · Tutorial 384 of 975

Deriving the Generalized Eigenvalue Equations

Use Lagrange multipliers to turn the unit-variance canonical-correlation problem into a generalized eigenvalue problem, and identify how its leading eigenvalue relates to the maximum correlation.

Intermediate 12 min read

What You'll Learn

  • Set up the canonical-correlation objective with unit-variance constraints for both linear scores.
  • Derive the two multiplier equations and identify the multipliers with the attained covariance.
  • Eliminate one set of weights to obtain the generalized eigenvalue equations.
  • Show why the largest generalized eigenvalue equals the squared maximum canonical correlation.
  • Check the equations in scalar and two-variable-set examples, including a negative cross-covariance.
  • Avoid sign and scaling errors when interpreting the constrained objective.

From a Constrained Objective to an Eigenvalue Equation

Canonical correlation compares two vectors through linear scores. Its weights are constrained: without fixing the score variances, the weights could be rescaled indefinitely, even though rescaling by a positive constant leaves correlation unchanged. A negative rescaling reverses the correlation's sign, and a zero rescaling makes it undefined. Unit-variance constraints fix the scale; the signs can then be chosen so that the covariance is nonnegative.

Let \(X\) and \(Y\) be centered random vectors of dimensions \(p\) and \(q\), with finite second moments. Write their covariance matrix in blocks

$$ \operatorname{Cov}\begin{pmatrix}X\\Y\end{pmatrix} = \begin{pmatrix} \Sigma_{XX} & \Sigma_{XY}\\ \Sigma_{YX} & \Sigma_{YY} \end{pmatrix}, \qquad \Sigma_{YX}=\Sigma_{XY}'. $$

Assume \(\Sigma_{XX}\) and \(\Sigma_{YY}\) are positive definite. This ensures that every nonzero weight vector gives a score with positive variance and that the inverse covariance matrices used below exist. For weights \(a\in\mathbb{R}^p\) and \(b\in\mathbb{R}^q\), the scores are \(a'X\) and \(b'Y\).

Definition: The first canonical correlation is the maximum correlation between \(a'X\) and \(b'Y\), over nonzero \(a,b\). Because positive rescaling of either weight leaves correlation unchanged, we may impose \(a'\Sigma_{XX}a=1\) and \(b'\Sigma_{YY}b=1\). Under these constraints, the correlation equals the covariance \(a'\Sigma_{XY}b\); choosing the sign of one weight makes this covariance nonnegative.

Thus the constrained problem is to maximize \(a'\Sigma_{XY}b\) subject to the two unit-variance constraints. The following derivation turns its stationary conditions into a pair of generalized eigenvalue equations.

The Lagrange Multiplier Equations

Set \(C=\Sigma_{XY}\). Use one multiplier for each variance constraint:

$$ \mathcal{L}(a,b,\lambda,\mu) = a'Cb-\frac{\lambda}{2}(a'\Sigma_{XX}a-1) -\frac{\mu}{2}(b'\Sigma_{YY}b-1). $$

The covariance blocks \(\Sigma_{XX}\) and \(\Sigma_{YY}\) are symmetric. Differentiating with respect to \(a\) and \(b\), respectively, gives the stationary conditions

$$ Cb=\lambda\Sigma_{XX}a, \qquad C'a=\mu\Sigma_{YY}b. $$

At a feasible stationary point, multiply the first equation on the left by \(a'\) and the second by \(b'\). Since \(a'\Sigma_{XX}a=b'\Sigma_{YY}b=1\), both multipliers equal the attained covariance:

$$ a'Cb=\lambda,\qquad b'C'a=\mu, \qquad\text{so}\qquad \lambda=\mu=a'Cb. $$

Write this common value as \(\rho\). At the maximizing solution it is the nonnegative canonical correlation. The stationary equations therefore become

$$ Cb=\rho\Sigma_{XX}a, \qquad C'a=\rho\Sigma_{YY}b. $$

For \(\rho>0\), the second equation gives \(b=\rho\Sigma_{YY}^{-1}C'a\). Substituting this expression into the first yields one equation involving \(a\) alone. Eliminating \(a\) instead gives the corresponding equation for \(b\):

$$ C\Sigma_{YY}^{-1}C'a=\rho^2\Sigma_{XX}a, \qquad C'\Sigma_{XX}^{-1}Cb=\rho^2\Sigma_{YY}b. $$
Key result: The weights of a nonzero stationary canonical pair satisfy generalized eigenvalue equations. Their generalized eigenvalue is \(\rho^2\), the squared canonical correlation. The equations are “generalized” because the covariance matrix on the right is not generally the identity.

Why the Leading Eigenvalue Gives the Maximum

The equations alone identify stationary pairs. To establish which eigenvalue corresponds to the first canonical correlation, it helps to compare the constrained objective with a generalized Rayleigh quotient. Define

$$ A=C\Sigma_{YY}^{-1}C'. $$

For a fixed nonzero \(a\), maximizing \(a'Cb\) over \(b\) with \(b'\Sigma_{YY}b=1\) gives

$$ \max_{b'\Sigma_{YY}b=1} a'Cb = \sqrt{a'Aa}. $$

To verify this, put \(u=\Sigma_{YY}^{1/2}b\), so \(u'u=1\). Then \(a'Cb=(\Sigma_{YY}^{-1/2}C'a)'u\). The largest inner product with a unit vector is the Euclidean norm of the other vector, which is \(\sqrt{a'C\Sigma_{YY}^{-1}C'a}\). If this vector is zero, the maximum is zero and the equality still holds.

Consequently, the largest attainable covariance is the square root of the maximum of \(a'Aa\) subject to \(a'\Sigma_{XX}a=1\). This maximum is the largest generalized eigenvalue of \(Av=\eta\Sigma_{XX}v\). Here is a direct justification: factor the positive definite matrix \(\Sigma_{XX}=R'R\), and set \(z=Ra\). Then the constraint is \(z'z=1\), and

$$ a'Aa=z'\bigl(R^{-T}AR^{-1}\bigr)z. $$

The matrix \(R^{-T}AR^{-1}\) is symmetric and positive semidefinite: for every \(v\), \(v'Av=(C'v)'\Sigma_{YY}^{-1}(C'v)\geq 0\). By the spectral theorem, the maximum of its quadratic form over unit vectors is its largest eigenvalue, attained at a corresponding eigenvector. Its eigenvalue equation transforms back to \(Av=\eta\Sigma_{XX}v\). This proves that the constrained maximum of \(a'Aa\) is the largest generalized eigenvalue. Since the maximizing covariance is its square root, the first canonical correlation is the nonnegative square root of that eigenvalue. \(\square\)

The same reasoning shows that these generalized eigenvalues are real and nonnegative. They are also at most one: for any \(a,b\), the covariance inequality gives \((a'Cb)^2\leq(a'\Sigma_{XX}a)(b'\Sigma_{YY}b)\). Taking \(b=\Sigma_{YY}^{-1}C'a\), and writing \(t=a'Aa=b'\Sigma_{YY}b=a'Cb\), yields \(t^2\leq(a'\Sigma_{XX}a)t\). If \(t>0\), division by \(t\) gives \(t\leq a'\Sigma_{XX}a\); the same bound holds when \(t=0\). Thus every generalized Rayleigh quotient is at most one.

The argument also clarifies a zero-root case. If \(C=0\), all cross-covariances vanish, \(A=0\), and the maximum canonical correlation and all the generalized eigenvalues are zero. The elimination using division by \(\rho\) is only needed for positive roots; the stationary equations themselves remain valid when \(\rho=0\).

Worked Examples

Worked Example: A Scalar Pair

Suppose \(X\) and \(Y\) are centered scalars with variances \(4\) and \(9\), and covariance \(3\). Derive the generalized eigenvalue and check the canonical correlation.

Here \(\Sigma_{XX}=4\), \(\Sigma_{YY}=9\), and \(C=3\). The equation for \(a\) is

$$ C\Sigma_{YY}^{-1}C'a =\frac{3\cdot 3}{9}a =a =\rho^2(4a). $$

For a nonzero \(a\), this gives \(\rho^2=1/4\), so the nonnegative canonical correlation is \(\rho=1/2\). The unit-variance weights can be \(a=1/2\) and \(b=1/3\): their score variances are \(4(1/2)^2=1\) and \(9(1/3)^2=1\), and their covariance is \(3(1/2)(1/3)=1/2\). This agrees with the eigenvalue calculation.

Worked Example: Two Coordinates in Each Set

Let

$$ \Sigma_{XX}= \begin{pmatrix}2&0\\0&1\end{pmatrix}, \qquad \Sigma_{YY}= \begin{pmatrix}3&0\\0&1\end{pmatrix}, \qquad C= \begin{pmatrix}0&0\\0&1/2\end{pmatrix}. $$

The joint covariance is positive definite: after reordering coordinates it consists of independent pairs with variances \((2,3)\) and \((1,1)\), and covariances \(0\) and \(1/2\); each pair has positive determinant. Compute

$$ A=C\Sigma_{YY}^{-1}C' = \begin{pmatrix}0&0\\0&1/4\end{pmatrix}. $$

The generalized eigenvalue equation \(Aa=\eta\Sigma_{XX}a\) is diagonal. Its two coordinate equations are \(0=2\eta a_1\) and \((1/4)a_2=\eta a_2\), so its generalized eigenvalues are \(0\) and \(1/4\). The largest is \(1/4\), giving \(\rho=1/2\). Indeed, \(a=(0,1)'\), \(b=(0,1)'\) have both score variances equal to one and covariance \(1/2\). The first coordinate contributes no cross-covariance.

Worked Example: A Negative Cross-Covariance and the Sign Choice

Suppose \(X,Y\) have unit variances and covariance \(-0.6\). With \(a=b=1\), the score correlation is \(-0.6\), not the maximum. Choosing \(a=1\), \(b=-1\) keeps both score variances equal to one and changes the covariance to \(0.6\). The maximizing nonnegative canonical correlation is therefore \(0.6\).

The generalized eigenvalue equation confirms this: \(C=-0.6\), \(\Sigma_{XX}=\Sigma_{YY}=1\), and \(C\Sigma_{YY}^{-1}C'=0.36\). Thus \(\rho^2=0.36\) and \(\rho=0.6\). In the multiplier equations, the maximizing weights satisfy \((-0.6)(-1)=0.6(1)(1)\) and \((-0.6)(1)=0.6(1)(-1)\). Both equations hold with the same positive multiplier.

Common Mistakes and Why the Equations Matter

The generalized eigenvalue form is useful because it replaces optimization over two weight vectors with a matrix eigenvalue problem. It also makes explicit that the squared association is determined by both cross-covariance and within-set covariance: large cross-covariances alone do not determine canonical correlation if the score variances are also large.

  • Claiming arbitrary rescaling leaves correlation unchanged. Positive rescaling leaves its sign and value unchanged; negative rescaling reverses the sign, and zero makes the score variance zero. The unit-variance constraints fix scale, while a sign choice makes the covariance nonnegative.
  • Using one multiplier without checking it. The two constraints introduce two multipliers. Multiplying each stationary equation by its corresponding weight vector shows that both equal the attained covariance at a feasible stationary point.
  • Forgetting the square. The eigenvalue is \(\rho^2\), not \(\rho\). A generalized eigenvalue of \(0.36\) corresponds to canonical correlation \(0.6\).
  • Dividing by a zero canonical correlation. The elimination step that substitutes \(b=\rho\Sigma_{YY}^{-1}C'a\) requires \(\rho>0\). Treat the zero case using the original stationary equations.
  • Dropping the covariance metric. In general the equation is \(C\Sigma_{YY}^{-1}C'a=\rho^2\Sigma_{XX}a\), not an ordinary eigenvalue equation with \(\Sigma_{XX}\) omitted.
Key takeaway: Under positive definite within-set covariance matrices, Lagrange multipliers yield two coupled score equations. Eliminating either weight vector gives a generalized eigenvalue problem, and its largest eigenvalue is the square of the maximum canonical correlation.

Check Your Understanding

Use the definitions and derivations above to answer these questions.

  1. Why can the constrained objective be written as a covariance rather than a correlation?
  2. Starting from the two multiplier equations, show how eliminating \(b\) gives the equation for \(a\).
  3. If the largest generalized eigenvalue is \(0.49\), what is the first canonical correlation?
  4. For scalar variables with variances \(1\) and \(16\), and covariance \(2\), calculate the generalized eigenvalue and canonical correlation.
  5. Why does a negative covariance between two unit-variance scores not imply that the maximum canonical correlation is negative?
Clinical Biostats