# Thread: Finding max value of a 3-variable function

1. ## Finding max value of a 3-variable function

Find the maximum value of f(x,y,z) = x^2 + xy + y^2 + yz + z^2 on the unit sphere.

I don't know whether I should parametrize the unit sphere and use a composition of functions, or go straight into Lagrange multipliers. Either way, I don't know how to solve the resulting equations.

2. Originally Posted by tjkubo
Find the maximum value of f(x,y,z) = x^2 + xy + y^2 + yz + z^2 on the unit sphere.

I don't know whether I should parametrize the unit sphere and use a composition of functions, or go straight into Lagrange multipliers. Either way, I don't know how to solve the resulting equations.
Set g(x, y, z) = x^2 + y^2 + z^2. You want to solve grad(f) = lambda*grad(g), g = 1. (It may be simpler to use lambda*grad(f) = grad(g) in this case.) If you can't solve the equations, please state where you're having difficulty.

3. So you have to solve the following four equations
(1) 2x + y = 2λx
(2) x + 2y + z = 2λy
(3) y + 2z = 2λz
(4) x^2 + y^2 + z^2 = 1

Is there a usual way to solve a system like this?

What I did was solve (1) for y and plugged that y into (3). That gave me λ=1, which then gave me y=0, x = ± sqr(1/2), and z = ∓ sqr(1/2). However, this does not give the maximum value of f. Does this just mean that there are other points (x,y,z,λ) that satisfy these equations? How do you find all of them?

4. Originally Posted by tjkubo
So you have to solve the following four equations
(1) 2x + y = 2λx
(2) x + 2y + z = 2λy
(3) y + 2z = 2λz
(4) x^2 + y^2 + z^2 = 1

Is there a usual way to solve a system like this?

What I did was solve (1) for y and plugged that y into (3). That gave me λ=1, which then gave me y=0, x = ± sqr(1/2), and z = ∓ sqr(1/2). However, this does not give the maximum value of f. Does this just mean that there are other points (x,y,z,λ) that satisfy these equations? How do you find all of them?
The maximum of f under the constraint can be obtained by plugging the points you found into the equation for f and finding which is bigger.

5. Yes, but the trouble is finding those points.

6. Originally Posted by tjkubo
Yes, but the trouble is finding those points.
You're forgetting the case where x = z. That's why you're dividing by (x - z) to get lambda = 1.