olympiadanalysis-intro

Created 14 Jul 2023. Last updated 20 Dec 2024

Revenge of Analysis: Using Lagrange Multipliers to Destroy Olympiad Inequalities

Goal: learn how to use Lagrange multipliers in olympiads.

Lagrange multipliers are a nice tool to solve inequalities, but they are rarely seen in olympiad solutions. Once you are comfortable with it, it can be an overpowered way smash open inequalities without much insight. (So economists love them!) For this reason, we need to approach it rigorously, to ensure we can justify earning marks.

I really recommend watching this video to get some intuition first.

Background Theory

All of this is covered in my course notes for IB Analysis and Topology, in the relevant sections. The results and definitions in this article are correct only for Rn\mathbb{R}^n (e.g. compactness is something different, but the Heine-Borel theorem says that in Rn\mathbb{R}^n it's equivalent to being closed and bounded). For the more general definitions and a deeper understanding, check out the course notes.

Defn.

Consider a set MM together with a function d:M×MRd : M \times M \to \mathbb{R}.

(M,d)(M, d) is a metric space if:

  • d(x,y)0d(x,y) \geq 0, equality if and only if ("iff") x=yx=y ("positive semi-definite")
  • d(x,y)=d(y,x)d(x,y) = d(y,x) ("symmetric")
  • d(x,y)+d(y,z)d(x,z)d(x,y) + d(y,z) \geq d(x,z) ("triangle inequality")
Example.

(Rn,d)(\mathbb{R}^n, d) is a metric space, where:

Rn={(x1,,xn)xiR}\mathbb{R}^n = \{(x_1, \cdots, x_n) \mid x_i \in \mathbb{R}\}d(x,y)=i=1n(xiyi)2d(x,y) = \sqrt{\sum_{i=1}^n (x_i-y_i)^2}


Defn. (balls)

The open ball in Rn\mathbb{R}^n with centre pRnp \in \mathbb{R^n} and radius rr is

B(p,r):={xRnd(p,x)<r}B(p,r) := \{x \in \mathbb{\mathbb{R}^n} \mid d(p,x) \lt r \}

Similarly, the closed ball B[p,r]B[p,r] is1 the set:

{xRnd(p,x)r}\{x \in \mathbb{R}^n \mid d(p,x) \leq r\}
Examples.
  • Any finite open interval in R\mathbb{R} is an open ball (n=1n=1), because for any open interval (a,b)R(a,b) \subset \mathbb{R}, it is equal to B(a+b2,ba2)B(\frac{a+b}{2}, \frac{b-a}{2}).
  • B[0,1]B[0,1] in R2\mathbb{R}^2 is

    diagram
Defn.

URnU \subseteq \mathbb{R}^n is open iff for every pUp \in U, r>0\exists r\gt 0 s.t. B(p,r)UB(p,r) \subset U.

diagramdiagram

Informally: an 'open set' is a set such that for any point xx in the set, we can fit a ball ball around xx, while staying inside the set.


Defn. (limits)

Let (xk)k=1(x_k)_{k=1}^\infty be a sequence in Rn\mathbb{R}^n.

The sequence converges to the point xx_\infty iff ϵ>0,n0N\forall \epsilon \gt 0, \exists n_0 \in \mathbb{N} such that:

nn0    d(xn,x)<ϵn \geq n_0 \implies d(x_n, x_\infty) \lt \epsilon

Then xx_\infty is denoted limn(xn)\lim_{n \to \infty}(x_n).

Examples.
  • Let xn=(1n,1n)x_n = \left(\frac{1}{n}, \frac{1}{n}\right), then limnxn=(0,0)\lim_{n \to \infty} x_n = (0,0).
  • limn(11n  ,  1n2)=(1,0)\lim_{n \to \infty} \left(1-\frac{1}{n}\;,\; \frac{1}{n^2}\right) = (1,0)


Defn.

Let SRnS \subseteq \mathbb{R}^n. SS is closed iff for every sequence of points (xk)k=1(x_k)_{k=1}^\infty that satisfies xkS    kx_k \in S \;\forall\; k, we have (limkxk)S\left( \lim_{k \to \infty} x_k \right) \in S.

Examples.
  • B(0,1)B(0,1) is not closed because we can take xk=(11k,0,,0).x_k = (1 - \frac{1}{k}, 0, \cdots, 0).
  • Any open ball together with one point on the boundary, is neither closed nor open.


Defn.

Let ARnA \in \mathbb{R}^n. The closure of AA, denoted Aˉ\bar A, is the smallest closed set containing AA.

diagram



Fact.

ARnA \subseteq \mathbb{R}^n is closed if and only if RnA\mathbb{R}^n \setminus A is open.

diagram
Fact.

Let U,VU,V be open sets. Then UVU \cap V and UVU \cup V are also open sets. This extends to finite intersections2 and infinite unions.

diagram
Fact.

Let S,TS,T be closed sets. Then STS \cap T and STS \cup T are also closed sets. This extends to infinite intersections and finite unions.

diagram



Defn.

ARnA \subseteq \mathbb{R}^n is bounded iff RR,R>0\exists\, R \in \mathbb{R}, R\gt 0 such that AB(0,R)A \subseteq B(0, R).

diagram
Defn.

A subset KRnK \subseteq \mathbb{R}^n is compact if it is closed and bounded.

diagram diagram
Defn.

Let DRnD \subseteq \mathbb{R}^n and let f:DRf : D \to \mathbb{R}.

ff is continuous at the point pDp \in D iff ϵ>0\forall \epsilon \gt 0, δ>0\exists \delta \gt 0 such that xD\forall x \in D we have:

d(p,x)<δ    f(x)f(p)<ϵd(p,x) \lt \delta \implies \lvert f(x) - f(p) \rvert \lt \epsilon

ff is continuous iff it is continuous at every point.

Informally, no matter how small ϵ\epsilon you pick, I can always find a region around pp where the change in ff is smaller than ϵ\epsilon. So, a small change in input causes a small change in ouput.

Example.

f:RnRf : \mathbb{R}^n \to \mathbb{R}, f(x1,,xn)=x1++xnf(x_1, \cdots, x_n) = x_1 + \cdots + x_n



Theorem. (extreme value thm)

Let f:KRf : K \to \mathbb{R} be a continuous function, where KRnK \subseteq \mathbb{R}^n is a nonempty compact set.

Then ff has both a global maximum value and a global minimum value3:

xK s.t. f(x)f(y)  yK\exists\, x \in K \text{ s.t. } f(x) \geq f(y) \;\forall\, y \in KxK s.t. f(x)f(y)  yK\exists\, x' \in K \text{ s.t. } f(x') \leq f(y) \;\forall\, y \in K
Example.

Let KK be a closed ball in R2\mathbb{R}^2, then KK is compact. Let f:KR,f(x)=d(x,(0,0))f : K \to \mathbb{R}, f(x) = d(x,(0,0)) which is continuous.

Then the theorem says that there is a point(s) on KK which is closest to (0,0)(0,0), and a point(s) which is furthest.

diagram

Note: We need to assume KK is closed for this theorem, else we can construct a counterexample where ff increases to infinity the closer you get to the edge.

Fact.

Let g:RnRg : \mathbb{R}^n \to \mathbb{R} be continuous. Then for a fixed cRc \in \mathbb{R}, the set

{xRng(x)=c}\{ x \in \mathbb{R}^n \mid g(x) = c \}

is closed in Rn\mathbb{R}^n.

Partial Derivatives

I'm assuming you've already met these, so I'll recap.

Examples.
  • f:R3R,f(x,y,z)=x2+y2+z2f : \mathbb{R}^3 \to \mathbb{R}, f(x,y,z) = x^2 + y^2 + z^2
δfδx=2x,δfδy=2y,δfδz=2z,f=(2x,2y,2z)\frac{\delta f}{\delta x} = 2x, \frac{\delta f}{\delta y} = 2y, \frac{\delta f}{\delta z} = 2z, \nabla f = (2x,2y,2z)
  • f:(0,+)×(0,+)R,f(x,y)=xyf : (0, +\infty) \times (0, +\infty) \to \mathbb{R}, f(x,y) = \sqrt{xy}.
f=(y2x,x2y)\nabla f = (\frac{\sqrt y}{2 \sqrt x}, \frac{\sqrt x}{2 \sqrt y})

The Big Theorem

Finally!

Theorem. (Lagrange Multipliers, "LM")

Let URnU \subset \mathbb{R}^n be an open set4 and let f,g:URf,g : U \to \mathbb{R} be continuous functions with continuous partial derivatives of the first order.

Let cRc \in \mathbb{R} and S={xUg(x)=c}S = \{x \in U \mid g(x) = c\}. (Note: SS doesn't have to be open or closed, that's UU!)

Then, if x0Sx_0 \in S is a local max or min, then either:

(δgδx,δgδy,δgδz,)=(0,0,0,)\left( \frac{\delta g}{\delta x}, \frac{\delta g}{\delta y}, \frac{\delta g}{\delta z},\cdots\right) = (0,0,0,\cdots)

Or λR\exists \lambda \in \mathbb{R} such that:

δfδx(x0)=λδgδx(x0),\frac{\delta f}{\delta x}(x_0) = \lambda \frac{\delta g}{\delta x}(x_0),δfδy(x0)=λδgδy(x0),\frac{\delta f}{\delta y}(x_0) = \lambda \frac{\delta g}{\delta y}(x_0),δfδz(x0)=λδgδy(x0),\frac{\delta f}{\delta z}(x_0) = \lambda \frac{\delta g}{\delta y}(x_0),etc.\text{etc.}

Example Problem 1

Let x,y,z0x,y,z \geq 0 such that x+y+z=1x+y+z = 1. Find the min and max of xyzxyz.

Solution.

Let f(x,y,z)=xyzf(x,y,z) = xyz and g(x,y,z)=x+y+zg(x,y,z)=x+y+z; these are polynomial functions and so are continuous. We are maximizing and minimizing ff, subject to a condition on gg.

0x,y,z10 \leq x,y,z \leq 1 so we're only interested in the cube [0,1]×[0,1]×[0,1][0,1] \times [0,1] \times [0,1].

diagram

x+y+z=1x+y+z=1 is a plane (coloured green)

Let U=(0,1)3U = (0,1)^3, then Uˉ=[0,1]3\bar U = [0,1]^3.

Let S={xUg(x)=1}S = \{x \in U \mid g(x)=1\}, then Sˉ\bar S is bounded hence compact.

Hence ff has a global max and min in Sˉ\bar S.

The global extrema might be on the boundary of Sˉ\bar S. If so then we cannot apply LM, because the extrema will not be in SS.

  • If we are on the boundary, then one of x,y,zx,y,z is 00, so f(x,y,z)=xyz=0f(x,y,z) = xyz = 0. Thus ff is zero everywhere on the boundary, so 00 would be an extremum.

  • If we are not on the boundary, then we are in SS, so we can apply LM.

δgδx=1,δgδy=1,δgδz=1\frac{\delta g}{\delta x} = 1, \frac{\delta g}{\delta y} = 1, \frac{\delta g}{\delta z} = 1

So we are in the second case of the theorem, because (1,1,1)(0,0,0)(1,1,1) \neq (0,0,0).

δfδx=yz,δfδy=xz,δfδz=xy\frac{\delta f}{\delta x} = yz, \frac{\delta f}{\delta y} = xz, \frac{\delta f}{\delta z} = xy

So yz=λ1yz = \lambda \cdot 1, xz=λ1xz = \lambda \cdot 1, xy=λ1xy = \lambda \cdot 1.
This implies xy=yz=zxxy = yz = zx so x=y=zx=y=z, and finally x+y+z=1x+y+z = 1     \implies x=y=z=13x=y=z=\frac{1}{3}, so an extremal value of ff is 127\frac{1}{27}.

Overall, all extreme values of ff on Sˉ\bar S are 00 or 127\frac{1}{27}.

0xyz127\therefore 0 \leq xyz \leq \frac{1}{27}

Example Problem 2

Let x,y,z0x,y,z \geq 0 such that x+y+z=1x+y+z = 1. Show that0yz+zx+xy2xyz7270 \leq yz+zx+xy-2xyz \leq \frac{7}{27}

Solution.

Note 0x,y,z10 \leq x,y,z \leq 1.

Let U=(0,1)3U = (0,1)^3 and S={xUg(x)=1}S = \{ x \in U \mid g(x) = 1\}.

Let f(x,y,z)=yz+zx+xy2xyzf(x,y,z) = yz+zx+xy-2xyz and g(x,y,z)=x+y+zg(x,y,z) = x+y+z, where f,g:URf,g : U \to \mathbb{R}. Then f,gf,g are continuous and have continous partial derivatives (because polynomial on open set).

Now, Uˉ=[0,1]3\bar U = [0,1]^3 and Sˉ=Uˉ{xR3g(x)=1}\bar S = \bar U \cap \{x \in \mathbb{R}^3 \mid g(x)=1\} which is closed and bounded hence compact.

Hence ff has a global max and min on Sˉ\bar S.

Let x0=(x,y,z)x_0 = (x,y,z) be a global extremum.

  • If x0x_0 is on the boundary:
    Then one of x,y,zx,y,z is 00, WLOG z=0z=0. Then x+y=1x+y=1 and we wish to show that 0xy7270 \leq xy \leq \frac{7}{27}.
x0,y0    xy0x \geq 0, y \geq 0 \implies xy \geq 0xy(x+y2)2=14<727    xy \leq \left(\frac{x+y}{2}\right)^2 = \frac{1}{4} \lt \frac{7}{27} \;\;\checkmark

Else, x0x_0 is not on the boundary.

Then SS has a global extremum in ff, namely x0x_0. So I can apply LM.

g(x,y,z)=x+y+zg(x,y,z)=x+y+zg=(δgδx,δgδy,δgδz)=(1,1,1)\nabla g = \left(\frac{\delta g}{\delta x}, \frac{\delta g}{\delta y}, \frac{\delta g}{\delta z}\right)=(1,1,1)

Since g(0,0,0)\nabla g \neq (0,0,0), the only possibility is f=λg\nabla f = \lambda \cdot \nabla g.

f(x,y,z)=yz+zx+xy2xyzf(x,y,z) = yz + zx + xy - 2xyzδfδx=z+y2yz\frac{\delta f}{\delta x} = z+y-2yzδfδy=x+z2xz\frac{\delta f}{\delta y} = x+z-2xzδfδz=y+x2yx\frac{\delta f}{\delta z} = y+x-2yx

So, z+y2yz=λ1z+y-2yz = \lambda \cdot 1,
x+z2xz=λ1x+z-2xz = \lambda \cdot 1,
y+x2yx=λ1y+x-2yx = \lambda \cdot 1

Solving for x,y,zx,y,z:

First case : x,y,z12x,y,z \neq \frac{1}{2}

  • z+y2yz=λz+y-2yz=\lambda     y(12z)=λz\implies y(1-2z) = \lambda - z     y=λz12z\implies y = \frac{\lambda - z}{1-2z}
  • Similarly, x=λz12zx = \frac{\lambda - z}{1-2z}
  • So x=yx=y, and similarly x=y=zx=y=z.
  • x+y+z=1x+y+z = 1     x=y=z=13\implies x=y=z=\frac{1}{3}

Second case : one of x,y,zx,y,z is 12\frac{1}{2}

  • WLOG z=12z = \frac{1}{2}, then 12+y2y12=λ\frac{1}{2} + y - 2y\cdot \frac{1}{2} = \lambda     λ=12\implies \lambda = \frac{1}{2}
  • x+y=1zx+y = 1-z     x+y=12\implies x+y=\frac{1}{2}
  • x+y2xy=λx+y-2xy = \lambda     122xy=12\implies \frac{1}{2} - 2xy = \frac{1}{2}     xy=0\implies xy = 0, but this cannot happen in the interior.

Thus overall, The extremum x0x_0 must equal (13,13,13)(\frac{1}{3}, \frac{1}{3}, \frac{1}{3}).

f(13,13,13)=19+19+19227=727    f\left(\frac{1}{3}, \frac{1}{3}, \frac{1}{3}\right) = \frac{1}{9} + \frac{1}{9} + \frac{1}{9} - \frac{2}{27} = \frac{7}{27} \;\; \checkmark

Example problem 3

Given that x,yRx,y \in \mathbb{R} with x2+y2=1x^2 + y^2 = 1, Find the max and min values of 8x22y8x^2 - 2y.

Note: the "normal" way to do this would be to write it as 8(1y2)2y8(1-y^2)-2y and bound this quadratic. But we can do it with LM too. I'll let you decide which way is easier.

Solution.

Let f,g:R2Rf,g : \mathbb{R}^2 \to \mathbb{R} with:

f(x,y)=8x22yf(x,y) = 8x^2-2yg(x,y)=x2+y2g(x,y) = x^2 + y^2

Then f,gf,g are continuous and have continuous partial derivatives.

U:=R2U := \mathbb{R}^2S:={xUg(x)=1}S := \{x \in U \mid g(x) = 1\}

SS is closed and bounded, hence SS is compact.

Hence ff attains a global max and min on SS.

We can apply LM, because there is no boundary case to check5.

g=(2x,2y)\nabla g = (2x,2y)

So g(0,0)\nabla g \neq (0,0) since x2+y2=1x^2 + y^2 = 1.

Hence we are in the second case:

f=λg\nabla f = \lambda \nabla g    [16x2]=λ[2x2y]\implies \begin{bmatrix} 16x \\ -2 \end{bmatrix} = \lambda \begin{bmatrix} 2x \\ 2y \end{bmatrix}

Thus we need to solve the following 3 simultaneous equations:

16x=2xλ16x = 2x\lambda2=2yλ-2 = 2y\lambdax2+y2=1x^2 + y^2 = 1

  • If x=0x=0, then y2=1y^2 = 1, so (x,y)=(0,1)(x,y) = (0,1) or (0,1)(0,-1).

  • If x0x\neq 0, then λ=8\lambda = 8, so 2=16y-2 = 16y. Hence y=18y=-\frac{1}{8} and so x2=1164x^2 = 1 - \frac{1}{64}, so x=±638x = \pm \frac{\sqrt{63}}{8}.

Hence we need to check (0,1)(0,1),(0,1)(0,-1), (638,18)(\frac{\sqrt{63}}{8}, -\frac{1}{8}), (638,18)(-\frac{\sqrt{63}}{8}, -\frac{1}{8}).

f(0,±1)=2f(0, \pm 1) = \mp 2f(±638,18)=658f(\pm \frac{\sqrt{63}}{8}, -\frac{1}{8}) = \frac{65}{8}28x22y658\therefore -2 \leq 8x^2 - 2y \leq \frac{65}{8}

Homogenous Trick

Suppose we want to prove some inequality, but there are no constraints.

If the inequality is homogenous, then we can impose a condition e.g. a+b+c=1a+b+c=1 or abc=1abc = 1 or a2+b2+c2=1a^2+b^2+c^2=1, because we can scale each variable to make the condition true.

Example.

Prove that a,b,cR\forall a,b,c \in \mathbb{R},

a2+b2+c2ab+bc+caa^2 + b^2 + c^2 \geq ab + bc + ca
Solution.

If a=b=c=0a=b=c=0, the result is obvious.

Otherwise, let k=a2+b2+c2>0k = \sqrt{a^2 + b^2 + c^2} \gt 0. The inequality is equivalent to:

(ak)2+(bk)2+(ck)2akbk+bkck+ckak\left(\frac{a}{k}\right)^2 + \left(\frac{b}{k}\right)^2 + \left(\frac{c}{k}\right)^2 \geq \frac{a}{k} \cdot \frac{b}{k} + \frac{b}{k}\cdot \frac{c}{k} + \frac{c}{k} \cdot \frac{a}{k}

And so, letting x=akx=\frac{a}{k}, y=bky = \frac{b}{k}, z=ckz = \frac{c}{k}, we have that x2+y2+z2=1x^2 + y^2 + z^2 = 1.

So it is enough to prove that xy+yz+zx1xy + yz + zx \leq 1 when x2+y2+z2=1x^2 + y^2 + z^2 = 1 (we chose this condition because of compactness).

We can now solve this as in the examples above, using Lagrange multipliers.

Practice problem (JBMO)

For x,yR,(x,y)(0,0)x,y \in \mathbb{R}, (x,y) \neq (0,0), prove that:x+yx2xy+y222x2+y2\frac{x+y}{x^2-xy+y^2} \leq \frac{2\sqrt 2}{\sqrt {x^2 + y^2}}

(Note: much easier to fix yy and use normal derivatives, but we want to solve with LM)

When It Fails

Let a,b,c>0a,b,c \gt 0 such that a+b+c=3a+b+c=3. Find the minimum value of:f(a,b,c)=2a3a+2b3b+2c3cf(a,b,c) = \frac{2-a^3}{a} + \frac{2-b^3}{b} + \frac{2-c^3}{c}

If we attempt to use LM:

diagram

The problem is that ff is not defined on the boundary, so we cannot say ff has a global max and min in the area we're looking at (indeed ff can be arbitrarily large if we let aa approach zero for example). Boo, we can't use LM.

Actually, in this specific case we can fix it with the following approach:

Conclusion

As you've seen, it takes careful consideration and background knowledge to use Lagrange multipliers in olympiads correctly. Best of luck!


  1. B[p,r]B[p,r] is a closed set. 

  2. If Un=(1n,1n)U_n = \left(-\frac{1}{n}, \frac{1}{n}\right), then n=1Un={0}\bigcup_{n=1}^\infty U_n = \{0\} which is not open. 

  3. This is not true in the reverse direction, for example consider B(0,1)B(0,1) and f(x)=d(x,0)f(x) = d(x,0), then there is a global min at 0. 

  4. This is so that partial derivatives are defined. 

  5. Note that we could have also let UU be something like {(x,y)R2x2+y2<1000}\{(x,y) \in \mathbb{R}^2 \mid x^2+y^2 \lt 1000\}, so that UU actually has a boundary, and when we check that case, we would conclude impossibility by "if on the boundary, then x2+y2x^2 + y^2 would have to be 11 and 10001000 at the same time". But it is nicer to let U=R2U = \mathbb{R}^2, because then Sˉ=S\bar S = S so we get that the global extrema are in SS straight away.