This is a problem on www.mitcourseware.com , multivariable calculus 18.02, Session 39 on Lagrange Multipliers. Not a homework problem This is a self tutorial course , brushing up on multivariable calculus. I can pretty much jot the problem below with a quick summary.
The function is $w = y$ and it is constrained by $x^2 + y^2 + z^2 =1$. I got some of it...the gradient of $f = \langle 0,1,0\rangle$ and the gradient of $g = \langle 2x, 2y, 2z\rangle$ taking the partial derivatives then we see the gradient of $f$ is equal to $\lambda$ times the gradient of $g$, therefore very simply $\langle 0,1,0\rangle= \lambda\times\langle 2x, 2y, 2z\rangle$ , obviously $x = z =0$ but I get $2y = 1$ or $y = \frac12$ BUT the listed answer is $\pm 1$ for the maximum and minimum respectively. I can't see how this can be.
Need some help from an expert. Thank you.
Your mistake comes from the fact you forgot about the Lagrange multiplier when you solved for $y$. Starting with the Lagrangian: $$L(x,y,z,\lambda)=f(x,y,z)-\lambda g(x,y,z)$$ $$L(x,y,z)=y-\lambda (x^2+y^2+z^2-1)$$ The optimality conditions here require $\nabla_{x,y,z,\lambda} L(x,y,z,\lambda)=0$, as you correctly recognized: $$\nabla L(x,y,z,\lambda)=(-2\lambda x,\ 1-2\lambda y,\ -2\lambda z,\ \ x^2+y^2+z^2-1)$$ Setting this equal to zero tells us that either $\lambda=0$ or $x=0$, $y=\frac{1}{2\lambda}$, and $\lambda=0$ or $z=0$. Clearly if $\lambda=0$, $y$ is undefined, so $x=0$ and $z=0$. The part you ultimately forgot is plugging in the Lagrange multiplier into the constraint equation: $$x^2+y^2+z^2-1=0$$ Substituting our known values for $x$ and $z$ and the expression for $y$, we get $$\frac{1}{4\lambda^2}=1$$ Therefore $\lambda=\pm\frac{1}{2}$ and substituting this into the $y$ equation shows $y=\frac{1}{2(\pm\frac{1}{2})}=\pm 1$, as desired.