5.2 Kissing Contours and Lagrange Multipliers: Deriving Cu = λu Geometrically

How does a constrained optimization problem turn into an eigenvalue problem? The bridge is Lagrange's method of multipliers, which rests on a vivid geometric principle: at an extremum on a constraint surface, the level contour of the objective function must kiss the constraint surface tangentially, forcing their gradients to line up.

In this microlearning, we derive the matrix gradients ∇u(uTCu)=2Cu\nabla_{\mathbf{u}}(\mathbf{u}^T C \mathbf{u}) = 2C\mathbf{u} and ∇u(uTu)=2u\nabla_{\mathbf{u}}(\mathbf{u}^T \mathbf{u}) = 2\mathbf{u} from first principles and watch their alignment produce Cu=λuC\mathbf{u} = \lambda\mathbf{u}.

In this Article

1. Why Kissing Contours Have Parallel Gradients

Recall from multivariable calculus that the gradient ∇f(u)\nabla f(\mathbf{u}) is always perpendicular to the level curve f(u)=constf(\mathbf{u}) = \text{const}, and points in the direction of steepest ascent. Suppose you are restricted to walk on the unit circle g(u)=uTu=1g(\mathbf{u}) = \mathbf{u}^T \mathbf{u} = 1:

  • If ∇f(u)\nabla f(\mathbf{u}) is not parallel to the circle normal ∇g(u)\nabla g(\mathbf{u}), then ∇f(u)\nabla f(\mathbf{u}) has a non-zero component tangent to the circle. Moving slightly along that tangent increases f(u)f(\mathbf{u}), so you are not at a maximum!
  • Therefore, at any constrained maximum or minimum on the unit circle, ∇f(u)\nabla f(\mathbf{u}) can have zero tangential component—it must be purely normal to the circle, meaning ∇f(u)=λ∇g(u)\nabla f(\mathbf{u}) = \lambda \nabla g(\mathbf{u}) for some scalar multiplier λ\lambda.
   NOT OPTIMAL (Crossing Contours):               OPTIMAL (Kissing Contours at Eigenvector):
         Grad f  ^                                     Grad f = 2 C u  ^
                /                                                      |  Grad g = 2 u
               /---> Tangent component != 0                            |  ^
   -----------*----------- (Circle Tangent)       ---------------------*--|----------------
              |                                                        (Zero tangent component!)
              v Grad g                                                 2 C u = lambda (2 u)

2. Deriving ∇(uᵀCu) = 2Cu and ∇(uᵀu) = 2u Coordinate by Coordinate

You do not need to memorize mysterious matrix calculus tables—let us verify both derivatives directly from partial derivatives:

1. Gradient of g(u)=uTu=∑k=1duk2g(\mathbf{u}) = \mathbf{u}^T \mathbf{u} = \sum_{k=1}^d u_k^2:

Differentiating with respect to coordinate uju_j gives ∂g∂uj=2uj\frac{\partial g}{\partial u_j} = 2 u_j. Stacking all dd partial derivatives into a column vector yields ∇u(uTu)=2u\nabla_{\mathbf{u}}(\mathbf{u}^T \mathbf{u}) = 2\mathbf{u}.

2. Gradient of f(u)=uTCu=∑j=1d∑k=1dcjkujukf(\mathbf{u}) = \mathbf{u}^T C \mathbf{u} = \sum_{j=1}^d \sum_{k=1}^d c_{jk} u_j u_k (with cjk=ckjc_{jk} = c_{kj}):

Differentiating with respect to umu_m picks up cmkukc_{mk} u_k from the first index and cjmujc_{jm} u_j from the second index: ∂f∂um=∑k=1dcmkuk+∑j=1dcjmuj=2∑k=1dcmkuk=2(Cu)m\frac{\partial f}{\partial u_m} = \sum_{k=1}^d c_{mk} u_k + \sum_{j=1}^d c_{jm} u_j = 2 \sum_{k=1}^d c_{mk} u_k = 2(C\mathbf{u})_m. Stacking into a column vector gives ∇u(uTCu)=2Cu\nabla_{\mathbf{u}}(\mathbf{u}^T C \mathbf{u}) = 2C\mathbf{u}.

3. Setting Up the Lagrangian and Canceling the Factor of 2

Combining the objective and constraint into the Lagrangian L(u,λ)=uTCu−λ(uTu−1)\mathcal{L}(\mathbf{u}, \lambda) = \mathbf{u}^T C \mathbf{u} - \lambda(\mathbf{u}^T \mathbf{u} - 1) and setting ∇uL=0\nabla_{\mathbf{u}} \mathcal{L} = \mathbf{0} immediately yields:

2Cu−2λu=0  ⟹  Cu=λu2C\mathbf{u} - 2\lambda\mathbf{u} = \mathbf{0} \implies C\mathbf{u} = \lambda\mathbf{u}

The factor of 22 from both quadratic derivatives cancels cleanly, leaving the exact eigenvalue equation!

4. Worked Gradient Alignment Check in 2D

Let C=[3113]C = \begin{bmatrix} 3 & 1 \\ 1 & 3 \end{bmatrix}. Let us compare the gradients ∇f=2Cu\nabla f = 2C\mathbf{u} and ∇g=2u\nabla g = 2\mathbf{u} at two points on the unit circle:

  1. At non-eigenvector u=(1,0)T\mathbf{u} = (1, 0)^T: ∇g=(2,0)T\nabla g = (2, 0)^T, while ∇f=2Cu=(6,2)T\nabla f = 2C\mathbf{u} = (6, 2)^T. Because (6,2)T(6, 2)^T is not a scalar multiple of (2,0)T(2, 0)^T, the gradients are misaligned and increasing u2u_2 increases variance.
  2. At eigenvector u1=(1/2,1/2)T\mathbf{u}_1 = (1/\sqrt{2}, 1/\sqrt{2})^T: ∇g=2(1,1)T\nabla g = \sqrt{2}(1, 1)^T, and ∇f=2Cu1=42(1,1)T=4∇g\nabla f = 2C\mathbf{u}_1 = 4\sqrt{2}(1, 1)^T = 4 \nabla g. The gradients are strictly parallel with multiplier λ1=4\lambda_1 = 4!

5. Active Recall Check and Key Takeaways

Quick Check: Test Your Understanding

Question: If we wrote the Rayleigh quotient R(w)=wTCwwTwR(\mathbf{w}) = \frac{\mathbf{w}^T C \mathbf{w}}{\mathbf{w}^T \mathbf{w}} and differentiated with respect to w\mathbf{w} using the quotient rule, what equation would ∇wR(w)=0\nabla_{\mathbf{w}} R(\mathbf{w}) = \mathbf{0} produce?

Answer: Setting ∇wR(w)=2Cw(wTw)−(wTCw)(2w)(wTw)2=0\nabla_{\mathbf{w}} R(\mathbf{w}) = \frac{2C\mathbf{w}(\mathbf{w}^T\mathbf{w}) - (\mathbf{w}^T C \mathbf{w})(2\mathbf{w})}{(\mathbf{w}^T\mathbf{w})^2} = \mathbf{0} gives Cw=R(w)wC\mathbf{w} = R(\mathbf{w})\mathbf{w}, which is the exact same eigenvalue equation Cw=λwC\mathbf{w} = \lambda\mathbf{w} with λ=R(w)\lambda = R(\mathbf{w})!

  • Geometric Meaning of Lagrange Multiplier: Kissing level sets require ∇f=λ∇g\nabla f = \lambda \nabla g.
  • Quadratic Derivative Rule: For symmetric CC, ∇u(uTCu)=2Cu\nabla_{\mathbf{u}}(\mathbf{u}^T C \mathbf{u}) = 2C\mathbf{u}.
  • Canonical References: See Wikipedia Reference on Matrix Calculus Identities.

Take a Quiz Based on This Article

Test your understanding with AI-generated questions tailored to this content

Adaptive Learning with SynLearn

Explore this article through guided practice that adapts to your answers

✓Step-by-step concepts & lessons
✓Active recall & adaptive feedback
✓Personalized spaced repetition
lagrange-multipliers
gradients
level-sets
eigenvalue-equation
pca
calculus