Using Lagrange Multiplier to prove identity Show that the maximum and minimum values of the function $u=x^2+y^2+xy$, where $ax^2+by^2=ab\ (a>b>0)$ are given by $$4(u-a)(u-b)=ab$$
My attempt- using Lagrange Multiplier method, $$F(x,y)= (x^2+y^2+xy)-\lambda(ax^2+by^2-ab)$$
$$dF= (2x+y-2a\lambda x)dx+(2y+x-2b\lambda y)dy$$ 
Equating to  zero to get,
$$y/x= 2(a\lambda -1); y/x= 1/(2(b\lambda-1))$$
$$\implies 4(a\lambda-1)(b\lambda-1)=1$$
$$\implies 4(a^2\lambda-a)(b^2\lambda-b)=ab$$
I am stuck here. Finding $(x_0,y_0)$ which finds extrema for $u$ and then substituting to prove $$4(u-a)(u-b)=ab$$ is very tedious. Can someone help on how I should go about it?
 A: Constraint:
$$a x^2 + b y^2 = ab$$
...can be replaced with the following one:
$$x=\sqrt{b}\cos\varphi,\quad y=\sqrt{a}\sin\varphi$$
So the function that we need to minimize/maximize becomes:
$$u(x,y)=u(\varphi)=b\cos^2\varphi+a\sin^2\varphi+\sqrt{ab}\sin\varphi\cos\varphi$$
...or (by applying some pretty elementary trigonometry): 
$$u(\varphi)=\frac{a+b}{2}-\frac{a-b}{2}\cos2\varphi+\frac{\sqrt{ab}}{2}\sin2\varphi$$
It can be easily proved (feel free to ask) that any harmonic of the form:
$$f(\alpha)=P\cos\alpha+Q\sin\alpha$$
...has amplitude:
$$R=\sqrt{P^2+Q^2}$$
...with the following extremes:
$$f_{max}=+R,\quad f_{min}=-R$$
In our case:
$$P=-\frac{a-b}2,\quad Q=\frac{\sqrt{ab}}{2}\implies R=\frac12\sqrt{a^2-ab+b^2}$$
This gives the following extremal values:
$$u_{min}=\frac{a+b}{2}-\frac12\sqrt{a^2-ab+b^2}$$
$$u_{max}=\frac{a+b}{2}+\frac12\sqrt{a^2-ab+b^2}$$
A quadratic equation:
$$u^2+Bu+C=0$$ 
...with $u_{min}$, $u_{max}$ as solutions must have the following coefficients:
$$B=-(u_{min}+u_{max})=-(a+b)$$
$$C=u_{min}u_{max}=\frac34ab$$
So we have the following quadratic equation:
$$u^2-(a+b)u+\frac34ab=0$$
$$4u^2-4(a+b)u+4ab=ab$$
...or finally:
$$4(u-a)(u-b)=ab$$
The most obvious solution (Lagrange mulitplier) is often not the simplest one. 
A: 
Because the function $ \ u(x,y) \ = \ x^2 + xy + y^2 \ $ and the constraint ellipse $ \ ax^2 + by^2 = ab \ \ , $ with $ \ a > b > 0 \ $ have symmetry about the origin, we should expect that the points at which the level curves of the function (which are themselves rotated ellipses [marked in red in the graph above]) are tangent to the constraint curve [in blue] will occur in pairs $ \ (\pm x \ , \ \pm y) \ $ and $ \ (\pm x \ , \ \mp y) \ \ . $  The former pair lie on the line through the origin $ \ y = mx \ \ , \ m > 0 \ \ $ and the latter on the line $ \ y = nx \ \ , \ n < 0 \ \ \ , $ which permits us to describe these tangent points as $ \ (\pm x_{+} \ , \ \pm mx_{+}) \ $ and $ \ (\pm x_{-} \ , \ \mp nx_{-}) \ \ . $  We will identify the two level curves which represent the maximum and minimum values of our function on the constraint ellipse as
$$ u \ = \ c_{+} \ = \ x_{+}^2 \ + \ x_{+}y_{+} \ + \ y_{+}^2 \ = \ (1 + m + m^2)·x_{+}^2 \ \ \ \text{and} \ \ \ u \ = \ c_{-} \ =  \ (1 + n + n^2)·x_{-}^2 \ \ . $$
We wish to show that these extremal values $ \ c_{+} \ $ and $ \ c_{-} \ $ satisfy the equation $ \ 4·(u-a)·(u - b) \ = \ ab \ \ , $ which implies the quadratic equation $ \ u^2 \ - \ (a + b) u \ + \ \frac34 ab \ = \ 0 \ \ . $  Applying Viete's relations, we will endeavor to demonstrate here that
$$      c_{+} \ + \  c_{-} \  =  \ a + b \ \ \ \text{and} \ \ \ c_{+} \ ·  \ c_{-} \  =  \ \frac34 ab \ \ . $$
The Lagrange equations for this extremization are
$$ 2x \ + \ y \ \ = \ \ \lambda \ · \ 2ax \ \ , \ \ x \ + \ 2y \ \ = \ \ \lambda \ · \ 2by  \ \ , $$
as you have determined.  We may write this as a system of two equations
$$ 2x  ·  (1 - \lambda·a) \ + \ y \ \ = \ \ 0 \ \ , \ \ x \ + \ 2y  ·  (1 - \lambda·b) \ \ = \ \ 0  \ \ . $$
The tangent level curves do not contact the constrain ellipse on either coordinate axis, so we "reject" the "trivial" solutions $ \ x = 0 \ , \ y = 0 \ $ and instead seek those solutions for which the "coefficient determinant" is
$$ \ 2   ·  (1 - \lambda·a) · 2   ·  (1 - \lambda·b) \ - \ 1 \ \ = \ \ 4ab  ·  \lambda^2 \ - \ 4·(a+b)  ·  \lambda \ + \ 3 \ \ = \ \ 0 \ \ .  $$
We obtain
$$ \lambda \ \ = \ \ \frac{4·(a+b) \ \pm \ \sqrt{16·(a+b)^2 \ - \ 4·4ab·3}}{2 \ · \ 4ab} \ \ = \ \ \frac{ (a+b) \ \pm \ \sqrt{  a^2 \ - \ ab \ + \ b^2}}{2 ab} \ \ . $$
[We will label this discriminant $ \ \mathbf{D} \ = \ a^2  -  ab  +  b^2 \ $ in what follows.]
Inserting these into the two linear equations above leads us to
$$   y \ \ = \ \ 2  ·  \left(a \ · \ \frac{ (a+b) \ \pm \ \sqrt{\mathbf{D}}}{2 ab} \ - \ 1  \right)  x  \ \ = \ \ \left( \frac{ (a-b) \ \pm \ \sqrt{\mathbf{D}}}{ b}    \right)  x  \ \ , $$
$$   y \ \ = \ \  \left(  \frac{1}{2 · ( b · \frac{ (a+b) \ \pm \ \sqrt{\mathbf{D}}}{2 ab} \ - \ 1 )} \right) \ x  \ \ . $$
(We will spare the reader the algebraic manipulation in a few places along the way; here, it will show that the second equation is redundant.)  From this, we find the equations of the two lines through the origin passing through the tangent points have the slopes $ \ m \ , \ n \ \ = \ \   \frac{ (a-b) \ \pm \ \sqrt{\mathbf{D}}}{ b} \ \ ; $ we observe that we indeed have $ \ m > 0 \ $ and $ \ n < 0 \ \ . $
Using this result in the constraint ellipse equation, we obtain
$$ ax_{+}^2 \ + \ b(mx_{+})^2 \ \ = \ \ ab \ \ \Rightarrow \ \ x_{+}^2 \ \ = \ \ \frac{ab}{a \ + \ m^2·b} \ \ = \ \ \frac{b}{2} \ · \ \frac{\mathbf{D} \ - \ (a-b) · \sqrt{\mathbf{D}} }{\mathbf{D}} \ \ , $$
and, similarly, $ \ x_{-}^2 \ \ = \ \ \frac{ab}{a \ + \ n^2·b} \ \ = \ \ \frac{b}{2} \ · \ \frac{\mathbf{D} \ + \ (a-b) · \sqrt{\mathbf{D}} }{\mathbf{D}} \ \ . $
With further algebra, we find
$$ m^2 \ , \ n^2 \ \ = \ \ \frac{(2a^2 - 3ab + 2b^2) \ \pm \ 2·(a-b)·\sqrt{\mathbf{D}}}{b^2} $$
$$ \Rightarrow \ \ 1 + m + m^2 \ , \ 1 + n + n^2 \ \ = \ \ \frac{2\mathbf{D} \ \pm \ (2a-b)·\sqrt{\mathbf{D}}}{b^2}  \ \ , $$
and, finally, that
$$ c_{+} \ , \ c_{-} \ \ = \ \ (1 + m + m^2)·x_{+}^2 \ \ , \ \ (1 + n + n^2)·x_{-}^2  $$
$$ = \ \ \frac{[2\mathbf{D} \ \pm \ (2a-b)·\sqrt{\mathbf{D}}] \ · \ [\mathbf{D} \ \mp \ (a-b) · \sqrt{\mathbf{D}}] }{2·b·\mathbf{D}}   $$
$$ = \ \ \frac{ 2·(a^2-ab+b^2)^2 \ - \ (a-b)·(2a-b)·(a^2-ab+b^2) \ \pm \ (2a-b-2a+2b)·\mathbf{D}\sqrt{\mathbf{D}}  }{2·b·\mathbf{D}}   $$
$$ = \ \ \frac{ (2a^2-2ab+2b^2-2a^2+3ab-b^2)·(a^2-ab+b^2) \ \pm \ b ·\mathbf{D}\sqrt{\mathbf{D}}  }{2·b·\mathbf{D}}   $$
$$ = \ \ \frac{ (b^2+ab )·\mathbf{D} \ \pm \ b ·\mathbf{D}\sqrt{\mathbf{D}}  }{2·b·\mathbf{D}} \ \ = \ \  \frac{ (a+b )  \ \pm \  \sqrt{\mathbf{D}}  }{2 } \ \ , $$
agreeing with the result of Oldboy's approach.
We now see directly that $ \ c_{+} \ + \  c_{-} \  =  \ a + b \ $ and that
$$ c_{+} \ · \  c_{-} \ \  = \ \ \frac{(a + b)^2 \ - \ \mathbf{D}}{2 · 2} \ \ = \ \ \frac{(a^2 + 2ab + b^2)  \ - \ (a^2 - ab + b^2)}{4} \ \ = \ \ \frac{3ab}{4} \ \ . $$
Hence, $ \ u = c_{+} \ $ and $ \ u = c_{-} \ $ satisfy the relation $ \ 4·(u-a)·(u - b) \ = \ ab \ \ . $
So the Lagrange method does provide a means of establishing the given equation, but the interpretation of the solution to the Lagrange equations is a bit different here from that for typical extremization problems.
For the graph above, the values $ \ a = 7 \ , \ b = 4 \ $ are used.  Applying the formulas we produced in our discussion, we have $ \ \mathbf{D} \ = \ 7^2 - 7·4 + 4^2 \ = \ 37 \ \ , $ the slopes of the lines through the origin are $ \ m \ , \ n \ \ = \ \   \frac{ 3 \ \pm \ \sqrt{37}}{4} \ \approx \ 2.271 \ , \ -0.7707 \ \  , $ and the extremal values of our function are
$$ c_{+} \ , \ c_{-} \ \ = \ \ \frac{ 11  \ \pm \  \sqrt{ 37 }  }{2 } \ \ \approx \ \ 8.5414 \ \ , \ \ 2.4587 \ \ . $$
(We can also find the coordinates of the tangent points of these level curves, but they are not called for in this problem.)
