Maths WorkshopMaths problems with full solutions
Exercise 1475Calculus › Multivariable calculus › Optimisation in several variablesOlympiadAdded 2 Nov 2026

Cauchy-Schwarz inequality via optimisation

#Cauchy-Schwarz#optimisation#proof

Statement

Prove the Cauchy-Schwarz inequality:
∣x⋅y∣≤∥x∥ ∥y∥|x \cdot y| \le \|x\| \, \|y\|
for all x,y∈Rnx,y \in \mathbb{R}^n, using an optimisation method.

Hint

For fixed nonzero yy, maximize f(x)=x⋅yf(x) = x \cdot y under the constraint ∥x∥=1\|x\| = 1. The maximum is ∥y∥\|y\|.

Show solutionHide solution

Solution

Lagrange. Maximize f(x)=∑xiyif(x) = \sum x_i y_i under g(x)=∑xi2=1g(x) = \sum x_i^2 = 1. The gradients are ∇f=y\nabla f = y and ∇g=2x\nabla g = 2x. The condition ∇f=λ∇g\nabla f = \lambda \nabla g gives
y=2λx  ⟹  x=y2λ.y = 2\lambda x \implies x = \frac{y}{2\lambda}.
Imposing ∥x∥=1\|x\| = 1:
∥y2λ∥=1  ⟹  ∣2λ∣=∥y∥  ⟹  x=±y∥y∥.\left\| \frac{y}{2\lambda} \right\| = 1 \implies |2\lambda| = \|y\| \implies x = \pm \frac{y}{\|y\|}.

Value. At x=y/∥y∥x = y/\|y\|, f(x)=y⋅y∥y∥=∥y∥f(x) = \frac{y \cdot y}{\|y\|} = \|y\|. At x=−y/∥y∥x = -y/\|y\|, f(x)=−∥y∥f(x) = -\|y\|. So the maximum is ∥y∥\|y\|, and the minimum is −∥y∥-\|y\|.

Conclusion. For all xx with ∥x∥=1\|x\|=1, we have ∣x⋅y∣≤∥y∥|x \cdot y| \le \|y\|. For arbitrary nonzero xx, setting u=x/∥x∥u = x/\|x\| gives
∣x⋅y∣=∥x∥ ∣u⋅y∣≤∥x∥ ∥y∥.|x \cdot y| = \|x\| \, |u \cdot y| \le \|x\| \, \|y\|.