# What is wrong with following optimization I am doing?

Being new to optimization please do not downvote this question. I am solving following optimization problem. And my findings are not where neat the optimality. Following is what I have done.

$$f = 2x^2+y^2+3z^2 +10 +8y+6z-100$$ $$s.t. \ \ x+y+z =200$$

My Langrage Equation is: $\mathcal{L} = f -\lambda g$, (where $g = x+y+z-200$)

Following $\frac{d\mathcal{L}}{dx} = 0$, $\frac{d\mathcal{L}}{dy} = 0$, $\frac{d\mathcal{L}}{dz} = 0$, $\frac{d\mathcal{L}}{d\lambda} = 0$, I get

$\lambda = 4x+10$, $\lambda = 2y+8$, $\lambda = 6z+16$

With manipulations, I get $x = \frac{\lambda-10}{4}$, $y = \frac{\lambda-8}{2}$, $z= \frac{\lambda-6}{6}$. Inserting these $x$, $y$, $z$ in $g$, I get $\lambda = 2490$.

But something is not right, this does not satisfy the constraint at all. The values of $x$, $y$, $z$ are found as $620$, $1241$, $414$ respectively.

Where I am going wrong?

• What is your object function exactly? $2x^2+y^2+3z^2 +10$ or $8y+6z-100$?
– mzp
Commented Apr 19, 2018 at 13:17
• Should the = in f be a -? If it is, your x and y are wrong. Looks like you did the differentiation wrongly.
– Paul
Commented Apr 19, 2018 at 13:21
• It isn't at all clear what you mean by $f(x,y,z)$. what is $f(0,0,0)$,say?
– lulu
Commented Apr 19, 2018 at 13:21
• As you can see from the comments, nobody understands what you are asking. Please edit for clarity.
– lulu
Commented Apr 19, 2018 at 13:51
• Edit has been made, extremely sorry for the typo: Actual function is $f = 2x^2+y^2+3z^2 +10 +8y+6z-100$
– SJa
Commented Apr 19, 2018 at 14:00

Write the Lagrangian

$$\mathcal{L} = 2x^2 + y^2 + 3z^2 + 10x + 8y + 6z − 100 - \lambda(x + y + z - 200)$$

and calculate

\begin{eqnarray} \frac{\partial \mathcal{L}}{\partial x} &=& 4x + 10 - \lambda \\ \frac{\partial \mathcal{L}}{\partial y} &=& 2y + 8 - \lambda \\ \frac{\partial \mathcal{L}}{\partial z} &=& 6z + 6 - \lambda \\ \frac{\partial \mathcal{L}}{\partial \lambda} &=& x + y + z - 200 \end{eqnarray}

From this you get

\begin{eqnarray} x &=& \frac{1}{4}(\lambda - 10)\\ y &=& \frac{1}{2}(\lambda - 8) \\ z &=& \frac{1}{6}(\lambda - 6) \\ \end{eqnarray}

In the last equation

$$\frac{1}{4}(\lambda - 10) + \frac{1}{2}(\lambda - 8) + \frac{1}{6}(\lambda - 6) = 200 \\ 3(\lambda - 10) + 6 (\lambda - 8) + 2 (\lambda - 6) = 2400 \\ 11\lambda - 90 = 2400 \\ \lambda = 226$$

• Where do you get "$2x^2 + y^2 + 3z^2 + 10x + 8y + 6z − 100$"? Are you just guessing that the OP's $"="$ was meant to be an $x$?
– lulu
Commented Apr 19, 2018 at 13:27
• @lulu The term $\partial \mathcal{L} / \partial x$ in the original question suggests the OP has a typo in the post, but I will gladly delete the answer if I'm wrong Commented Apr 19, 2018 at 13:29
• My silly mistake in the typo and in the solution, I did not divide by 11. Thanks
– SJa
Commented Apr 19, 2018 at 14:08