How to find the absolute extrema of a function on an elliptical cylinder using Lagrange multipliers? Optimize the function $  f(x,y)  =  x^2y  $ on the elliptical cylinder $ \ x^2 \ + \ 2y^2 \ \le \ 6 \ $ using Lagrange Multipliers.


Well, from what I know that I have to find the gradient then to set it equal to zero but I'm not sure about that and about the following steps.
This  optimization problem involving a function of two variables is a nice illustration of how finding the absolute extrema of a one-variable function $ \ f(x) \ $ on a closed interval is extended to more variables.  Within an interval, we look for any values of $ \ x \ $ for which $ \ \frac{df}{dx} \ = \ 0 \ $ , the so-called critical points.  (I am passing over critical points of the type where the first derivative is undefined.)  We then also check the values of $ \ f(x) \ $ at the endpoints of the interval, and finally make a comparison among the values of the function at the critical points within and the endpoints of the interval.

Here, we are looking for the absolute extrema of a function of two variables within an elliptical region (as indicated by the use of an inequality), so we wish to locate any critical points of the function within the ellipse, and compare the values of the function there with values that the function takes on along the elliptical boundary of the region.  So, as with finding extrema on a closed interval, we have two steps to work out.

First, we wish to find the critical points of $ \ f(x,y) \ = \ x^2 y \ $ that may exist; we will then focus on those which lie within the ellipse $ \ x^2 \ + \ 2y^2 \ = \  6 \ $ , which is centered on the origin and has its axes along the $ \ x- \ $ and $ \ y-$ axes.  We calculate the first partial derivatives of the function and set them equal to zero to find

$$ f_x \ = \ 2xy \ = \ 0 \ \ , \ \ f_y \ = \ x^2 \ = 0 \ \ \Rightarrow \  \ x \ = \ 0 \ , \ y \ = \ 0 \ \ . $$

The function then has a single critical point at $ \ (0, \ 0) \ $ .  For all points $ \ (x, \ 0) \ $ and $ \ (0, \ y) \ $ (points on the coordinate axes), the function equals zero.  

The second partial derivatives of the function are $ \ f_{xx} \ = \ 2y \ \ , \ \ f_{yy} \ = \ 0 \ \ , \ \ $ and $ f_{xy} \ = \ 2x \ $ .  We can then form the "discriminator index" $ \ D \ = \ f_{xx} \ f_{yy} \ - \ (f_{xy})^2 \ = \ 2y \ \cdot \ 0 \ - \ 4x^2 \ $ , which is intended to aid in classifying critical points.  Unfortunately, $ \ D \ = \ 0 \ $ at the origin, so we learn nothing directly from this; also, we've already seen that the function is flat along the $ \ x- \ $ and $ \ y-$ axes.  If we look at the behavior of the function along the lines $ \ y \ = \ \pm x \ $ , it becomes $ \ f(x, \ \pm x) \ = \ \pm x^3 \ $ .  What we know about the cubic function $ \ y \ = \ x^3 \ $ is that it has odd symmetry about the $ \ y-$ axis and that there is a point of inflection at $ \ x \ = \ 0 \ $ .  Analogously, our function has a saddle point at $ \ (0, \ 0) \ $ , as can be seen in this graph of $ \ z \ = \ x^2 \ y \ $ in the neighborhood of $ \ ( 0, \ 0, \ 0) \ $ .  So the sole critical point of our function is not a relative extremum.



This leaves us to look at the behavior of our function on the surface of the elliptical cylinder.  This is where we may use either "substitution" or Lagrange multipliers.

With "Lagrange", we construct the equation $ \ \nabla f \ = \ \lambda \ \nabla g \ $ , with $ \ g(x,y) \ = \ x^2 \ + \ 2y^2 \ - \ 6 \ $ being the "constraint function" describing the surface of the cylinder.  We obtain from this

$$ f_x \ = \ \lambda \cdot g_x \ \ \Rightarrow \ \ 2xy \ = \ \lambda \cdot 2x \ \ , \ \ f_y \ = \ \lambda \cdot g_y \ \ \Rightarrow \ \ x^2 \ = \ \lambda \cdot 4y \ \ . $$

We may solve these "Lagrange equations" either as

$$ 2xy \ - \ 2 \lambda x \ = \ 0 \ \ \Rightarrow \ \ 2x \ (y \ - \ \lambda) \ = \ 0 \ \ , \ \ x^2 \ = \ 4 \lambda y \ \ ,  $$

or as

$$ \lambda \ = \ \frac{2xy}{2x} \ = \ \frac{x^2}{4y} \ \ , \ \ x, y \ \ne \ 0 \ \ , $$

and consider the cases of $ \ x \ = \ 0 \ $ or $ \ y \ = \ 0 \ $ separately.  If $ \ \lambda \ = \ 0 \ $ , we are forced to have $ \ x \ = \ 0 \ $ , but $ \ y \ $ may be non-zero; in fact, the "constraint ellipse" gives us $ \ 0^2 \ + \ 2y^2 \ = \ 6 \ \Rightarrow \ y \ = \ \pm \sqrt{3} \ $ .  But we already know the function equals zero for $ \ x \ = \ 0 \ $ or $ \ y \ = \ 0 \ $ .  For $ \ \lambda \ \ne \ 0 \ $ , we deduce that 

$$ \ \lambda \ = \ y \ \ \Rightarrow \ \ x^2 \ = \ 4y^2 \ \ \Rightarrow \ \ 4y^2 \ + \ 2y^2 \ = \ 6 \ \ \Rightarrow \ \ y \ = \ \pm 1 \ \ , \ \ x \ = \ \pm 2 \ \ . $$

There are four points of interest then on the cylindrical surface:

$ (2, \ 1) \ , \ (-2, \ 1) \ $ -- $ \quad f(\pm 2, \ 1) \ = \ 4 \ \ $ [relative maxima] ;

$ (2, \ -1) \ , \ (-2, \ -1) \ $ -- $ \quad f(\pm 2, \ -1) \ = \ -4 \ \ $ [relative minima] .

These are also the greatest and least values of the function on or within the ellipse, so they are the absolute maximum and minimum values.

[We find the same result by making the substitution $ \ x^2 \ = \ 6 \ - 2y^2 \ $ , implied by the constraint, into the function $ \ f(x,y) \ $ , producing $ \ (6 \ - \ 2y^2 ) \cdot y \ $ .  The critical points are found from 

$$ \ \frac{d}{dy} \ [ \ 6y \ - \ 2y^3 \ ] \ = \ 6 \ - \ 6y^2 \ = \ 0 \ \ \Rightarrow \ \  y \ = \ \pm 1 \ \ , \ \ x \ = \ \pm 2 \ \ . ] $$ 

A graph of the surface $ \ z \ = \ x^2 \ y \ $ is shown below, together with the elliptical cylinder constraint surface.  (The "twins" of the extrema shown are not visible in this view.)
Set $\operatorname{grad} ({\mathbf F}) = \lambda \cdot \operatorname{grad} ({\mathbf G})$ with constraint $X^2+2Y^2 \leq 6$, solve to find max/min. 

Edit: Sorry, you can't use Lagrange for the parts inside the boundary of the cylinder...my bad. You must set $\operatorname{grad}({\mathbf F})$ to $0$.