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
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\).
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:
The covariance blocks \(\Sigma_{XX}\) and \(\Sigma_{YY}\) are symmetric. Differentiating with respect to \(a\) and \(b\), respectively, gives the stationary conditions
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:
Write this common value as \(\rho\). At the maximizing solution it is the nonnegative canonical correlation. The stationary equations therefore become
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\):
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
For a fixed nonzero \(a\), maximizing \(a'Cb\) over \(b\) with \(b'\Sigma_{YY}b=1\) gives
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
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
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
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
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.
Check Your Understanding
Use the definitions and derivations above to answer these questions.
- Why can the constrained objective be written as a covariance rather than a correlation?
- Starting from the two multiplier equations, show how eliminating \(b\) gives the equation for \(a\).
- If the largest generalized eigenvalue is \(0.49\), what is the first canonical correlation?
- For scalar variables with variances \(1\) and \(16\), and covariance \(2\), calculate the generalized eigenvalue and canonical correlation.
- Why does a negative covariance between two unit-variance scores not imply that the maximum canonical correlation is negative?