# Minimising a function with a constraint

I have some problem about physics, which requires me to find the lowest value of $f(x,y)=x^2 + 3y^2$ while $x+3y=12$.

I have used the lagrange multiplier but I'm not sure whether it gave me the minima or the maxima, so how can I find the lowest value of $f(x,y)$ with this restraint ?

$$f(x,y)=x^2 + 3y^2$$ and $$g(x,y)=x+3y$$

Since $$\frac{\partial f}{\partial x} = 2x = \lambda \frac{\partial g}{\partial x} = \lambda$$ $$\frac{\partial f}{\partial y} = 6y = \lambda \frac{\partial g}{\partial x} = \lambda 3$$

we get $x=y$, but I don't know whether it is a minima or the maxima, so how can I check that ?

• Could you show your work using Lagrange multipliers ? It works. – Claude Leibovici Dec 4 '16 at 10:06
• @ClaudeLeibovici sure. – onurcanbektas Dec 4 '16 at 10:06
• Since you solve a convex optimization problem, you found a minimum. Use $x+3y=12$ with $x=y$ to find the value of $x$ and $y$. – LinAlg Dec 4 '16 at 12:06
• @LinAlg How do you know that it is a minimum ? Lagrange multiplier gives you a extremum. – onurcanbektas Dec 4 '16 at 12:39
• Not for convex problems. See the (free) book by Boyd and Vandenberghe. – LinAlg Dec 4 '16 at 14:05

with $$y=4-\frac{1}{3}x$$ you will get $$f(x,4-1/3x)=x^2+3(4-1/3x)^2$$ a problem in one variable.

Use Cauchy-Schwarz inequality: $144=12^2 = (x+3y)^2 = (1\cdot x + \sqrt{3}\cdot \sqrt{3}y)^2 \le (1^2+\sqrt{3}^2)(x^2+3y^2)=4(x^2+3y^2)\implies x^2+3y^2 \ge \dfrac{144}{4}=36$, and this is the minimum value.

• CS inequality ? – onurcanbektas Dec 4 '16 at 10:10

If $f(x,y)=x^2+3y^2$ is to be minimzed subject to $x+3y=12$ then this is equivalent to minimizing $$g(y)=(12-3y)^2+3y^2\tag{1}$$ subject to $y$.

The first order condition for a solution $y^*$ to $(1)$ is that $$g'(y^*)=0;\tag{2}$$ and the second order condition is that $$g''(y^*)\leq 0\tag{3}.$$

In general, both $(2)$ and $(3)$ must be satisfied for a local minimum. In this case, however, $g(y)$ is a quadratic function and you may write $g(y)$ as $a(y-b)^2+c$ for constants $a$, $b$ and $c$, and then notice that the minimum is attained at $y=b$.

Just put in $x=12-3y$ into the first equation. it is easy to find the lowest value of a quadratic function of $y$.