Lagrange multipliers : Exercises

Introduction

The method of Lagrange multipliers is used to find the optimum of a function $f(x,y)$ subject to the constraint that $g(x,y)=c$. The exercises in the first section that follows allow you to practise using this method to find constrained optimums. To solve the problems in the second section you will need to set up the problem so that you can apply Lagrange's method.

Example problems

Click on the problems to reveal the solution

Problem 1

The extended function here is: $$ F(x,y,\lambda) = 81x^2 + y^2 + \lambda( 4x^2 + y^2 - 9 ) $$ When this is differentiated with respect to $y$ you get: $$ \frac{\partial F}{\partial y} = 2y + 2y\lambda = 0 \qquad \rightarrow \qquad 2y(1 + \lambda) = 0 \qquad \therefore y=0 \quad \textrm{or} \quad \lambda=-1 $$ You have to insert both these solutions into the other equations you get by calculating $\frac{\partial F}{\partial x}$ and $\frac{\partial F}{\partial \lambda}$. Through this process you will get 4 local optima. You will find that the largest values are at: $$ x=0 \qquad y=\pm 3 \qquad f(x,y) = 9 $$

Problem 2

The information is given by: \[ I(p) = \sum_{j=0}^2 p_j \log(p_j) \] We want to minimise this subject to the constraints $p_0+p_1+p_2=1$ (normalisation) and $p_1+2p_2=\frac{10}{7}$ (average value). The extended function to minimise is thus: \[ I'(\{p_j\}) = \sum_{j=0}^2 p_j \log(p_j) + \lambda_1 \left( \sum_{j=0}^2 j p_j - \frac{10}{7} \right) + \lambda_2 \left( \sum_{j=0}^2 p_j -1 \right) \] At the minimum of this function we have: \[ \begin{aligned} \frac{\partial I'}{\partial p_j} & = \log(p_j) + 1 + j \lambda_1 + \lambda_2 = 0 \qquad \rightarrow \qquad p_j = e^{-(1+\lambda_2) - j\lambda_1} \qquad \rightarrow \qquad p_j = \frac{x^j }{Q} \\ \frac{\partial I'}{\partial \lambda_1} & = \sum_{j=0}^2 jp_j - \frac{10}{7} =0 \\ \frac{\partial I'}{\partial \lambda_2} & = \sum_{j=0}^2 p_j -1 = 0 \end{aligned} \] Notice we have defined $Q=e^{1+\lambda_2}$ in the above and $x=e^{-\lambda_1}$. These constraints tell us that: \[ \begin{aligned} 1&=p_0+p_1+p_2 = \frac{1+ x+x^2}{Q} \qquad \rightarrow \qquad 1+x+x^2 = Q \\ \frac{10}{7} & = p_1 + 2p_2 = \frac{x+2x^2}{Q} \qquad \rightarrow \qquad x+2x^2 = \frac{10}{7} Q \end{aligned} \] Equating these two expressions we get: \[ \frac{10}{7} (1 + x + x^2 ) = x + 2x^2 \qquad \rightarrow \qquad 4x^2 - 3x - 10 = 0 \qquad \rightarrow \qquad x=2 \] and hence $Q=1+x+x^2 = 1 + 2 + 4 = 7$. We thus have the following probability distribution: \[ p_0 = \frac{1}{7} \qquad p_1 = \frac{2}{7} \qquad p_2 = \frac{4}{7} \]
Three equations and three unknowns means that we can solve this problem using simultaneous equations. We don't need to do Lagrange multipliers again. These three simultaneous equations are: \[ \begin{aligned} p_0 & = 0 \\ p_0 + p_1 + p_2 &= 1 \qquad \rightarrow \qquad p_1 + p_2 = 1 \\ p_1 + 2p_2 & = \frac{10}{7} \end{aligned} \] From this we can deduce that: \[ p_1 = 1 - p_2 \qquad \rightarrow \qquad 1-p_2 + 2p_2 = \frac{10}{7} \qquad \rightarrow \qquad p_2 = \frac{3}{7} \qquad p_1 = \frac{4}{7} \]

Contact Details

School of Mathematics and Physics,
Queen's University Belfast,
Belfast,
BT7 1NN

Email: g.tribello@qub.ac.uk
Website: mywebsite