# Thread: Constrained Optimization with a three variable function

1. ## Constrained Optimization with a three variable function

Hi, I need help maximizing a function of three variables subject to a constraint. I understand how to do this for a function of two variables, but now I need to do it for a function of three variables.

If someone could point me in the right direction, recommend a webpage, etc., that would be great. Cursory googling has not helped.

Thanks

2. it would help if you post the question...

3. Originally Posted by rainer
Hi, I need help maximizing a function of three variables subject to a constraint. I understand how to do this for a function of two variables, but now I need to do it for a function of three variables.

If someone could point me in the right direction, recommend a webpage, etc., that would be great. Cursory googling has not helped.

Thanks
Econ, huh?

http://people.ucsc.edu/~rgil/Optimization.pdf

See page 42.

4. Originally Posted by eddie2042
it would help if you post the question...
Formalizing my question:

I need to maximize $\displaystyle f(x, y, z)$ subject to the constraint $\displaystyle g(x,y,z)=c$

I believe you write this as...

$\displaystyle \underset{\left \{ \left. x,y,z \right \} \right.}{max}\left [ f(x,y,z) \right ]$

$\displaystyle s.t.\: \: \: \: g(x,y,z)=c$

If it's easier to help me if I offer an example problem, here is an example problem:

Maximize $\displaystyle f(x,y,z)=\frac{x}{y+z}$ subject to the constraint $\displaystyle x+y+z=c$

I.e. $\displaystyle \underset{\left \{ \left. x,y,z \right \} \right.}{max}\left [ \frac{x}{y+z} \right ]$

$\displaystyle s.t.\: \: \: \: x+y+z=c$

1) How would I use the substitution method to find the solution? Is it even possible when there are three variables?

2) If I use the Lagrangian method, what do I do after getting my first order conditions?

The Lagrangian is $\displaystyle \Lambda(x,y,z,\lambda )=\frac{x}{y+z}+\lambda(x+y+z-c)$

Here are my first order conditions:

$\displaystyle \frac{\partial \Lambda}{\partial x}=\frac{1}{y+z}+\lambda=0$

$\displaystyle \frac{\partial \Lambda}{\partial y}=\frac{-x}{(y+z)^2}+\lambda=0$

$\displaystyle \frac{\partial \Lambda}{\partial z}=\frac{-x}{(y+z)^2}+\lambda=0$

$\displaystyle \frac{\partial \Lambda}{\partial \lambda }=x+y+z-c=0$

This is as far as I get. I don't know what to do from here.

5. Set your first order conditions = 0. Solve for $\displaystyle \lambda$ to get it out of there. Then you solve the system of equations.

Why don't you try and show me where you are stuck.

Note that your solutions x*, y*, and z* are going to be functions of the other two variables.

6. You may have to use the fact x+y+z= c => x = c-y-z.

And sub these into your equation before taking the first order conditions.

7. Originally Posted by Anonymous1
Set your first order conditions = 0. Solve for $\displaystyle \lambda$ to get it out of there. Then you solve the system of equations.
I forgot to add the zeros. Now I've edited them into my last post up there.

Now, I'm not sure what you mean by "solve the system of equations."

I'm guessing you mean I get them all into the same equation by substituting them in for 0?

In the example above, this leads me to:

$\displaystyle \frac{1}{y+z}+\frac{2x}{(y+z)^2}-x-y+c=0$

Is that what you're talking about? And then I just solve for each variable to get its respective maximization formula?

So the maximization formula for c, for example, would be:

$\displaystyle c_{\max}=x+y-\frac{1}{y+z}-\frac{2x}{(y+z)^2}$

Is that right?

By the way thanks for that link. I had already come across it and it is one of the reasons why I have gotten as far as I have. But it does not deal with the three variable case so that is why I am asking here.

8. A few things.

$\displaystyle c$ is a constant. Think of $\displaystyle x+y+z=c$ as the budget constraint. $\displaystyle c$ (sometimes denoted by m) is the purchasing power.

We want to maximize $\displaystyle f$ constrained by $\displaystyle x+y+x=c.$ $\displaystyle f$ is your utility function, so the Lagrangian is a function that takes into account both the budget constraint and the utility function.

If we want to maximize a specific variable of the function $\displaystyle \Lambda,$ we take the derivative w.r.t that variable and set it equal to $\displaystyle 0.$ Why do we do this? Because the derivative describes the slope of our function at a point. And when the slope $\displaystyle = 0,$ we are at the zenith, $\displaystyle i.e.,$ maximum of the function.

Now, we have

$\displaystyle \frac{\partial \Lambda}{\partial x}=\frac{1}{y+z} +\lambda=0$

$\displaystyle \Rightarrow -\frac{1}{y+z} = \lambda$

Now sub $\displaystyle \lambda$ into your other two equations and simplify them.

Now we have three equations and three unknowns.

Solve equation $\displaystyle 1$ for $\displaystyle x,$ say, then sub the obtained value of $\displaystyle x(y,z)$ (a function of the other two variables) into equation $\displaystyle 2.$ Proceed in this manner to find the solutions, $\displaystyle [x^*, y^*, z^*]$ to your system of equations.

9. Thanks. I think I got it now. Just to follow through:

So having solved for $\displaystyle \lambda$ as you demonstrate...

$\displaystyle \lambda=-\frac{1}{y+z}$

I then substitute this in for $\displaystyle \lambda$ in one of the other equations...

$\displaystyle \frac{-x}{(y+z)^2}-\frac{1}{y+z}=0$

Simplifying...

$\displaystyle x+y+z=0$

And then solving for any of these variables gives me the maximization formula for that variable? I.e. $\displaystyle y_{\max}=-x-z$? Is that it?

Oh, one last question. What if the constraint only involves two of the three variables. I.e. instead of $\displaystyle x+y+z=c$ it were only $\displaystyle y+z=c$. In that case one of the first order condition equations would be without a lambda. Would that pose a problem for solving the system of equations? Thanks.

10. Originally Posted by rainer
Oh, one last question. What if the constraint only involves two of the three variables. I.e. instead of $\displaystyle x+y+z=c$ it were only $\displaystyle y+z=c$. In that case one of the first order condition equations would be without a lambda. Would that pose a problem for solving the system of equations? Thanks.
You will always have f.o.c. w.r.t. $\displaystyle \lambda.$ This is default.

In the two variable case you would have a f.o.c. w.r.t. x, and w.r.t. y because you are only trying to find the zenith for those two variables.

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# optimising 3 variables

Click on a term to search for related topics.