To find the greatest and least distances of a point on the ellipse $x^2+4y^2=4$ from the straight line $x+y=4$ How to use the method of Lagrange multipliers to find the greatest and least distances of a point on the ellipse $x^2+4y^2=4$ from the straight line $x+y=4$ ?
 A: $$x+y=k$$
$$x^2+4y^2=(k-y)^2+4y^2=5y^2-2ky+k^2=4$$
$$5y^2-2ky+k^2-4=0$$
$$D=k^2-5(k^2-4)=20-4k^2\geq0$$
$$k^2\leq5$$
$$-\sqrt5\leq k\leq\sqrt5$$
$$x+y=4 \quad vs.\quad x+y=\sqrt5$$
$$\text{Distance between above two lines }=\frac{4-\sqrt5}{\sqrt2}=2\sqrt2-\frac{\sqrt10}{2}$$
A: HINT:
Any point on the straight line can be represented as $(a,4-a)$
As the distance  will vary with its square, check with
$$f(x,y)=(x-a)^2+\{y-(4-a)\}^2-\lambda(x^2+4y^2-4)$$
A: Any point on the ellipse can be represented as  $(2\cos t,\sin t)$
The perpendicular distance $$=\dfrac{|2\cos t+\sin t-4|}{\sqrt2}$$
Now $2\cos t+\sin t=\sqrt5\cos\left(t-\arccos\dfrac2{\sqrt5}\right)$
$\implies-\sqrt5\le2\cos t+\sin t\le\sqrt5$
$\implies-\sqrt5-4\le2\cos t+\sin t-4\le\sqrt5-4$
$\implies$ maximum distance $=\dfrac{\sqrt5+4}{\sqrt2}$
and the minimum will be $=\dfrac{4-\sqrt5}{\sqrt2}$
A: i think this can be done without using lagrange multipliers. here is a way to do this using basic geometry.
suppose the point $P(a,b)$ on the ellipse $x^2 +4y^2 = 4$ is either the least or greatest distance from the line $x+y=4.$  then the slope of the tangent to the ellipse is $-1.$  that is $$\frac{dy}{dx}\Big|_{(a,b)} = -\frac a b \text{ and } a^2 + 4b^2 = 4 \to P = \pm\left(\frac 4 {\sqrt 5}, \frac 1{\sqrt 5} \right)$$  the distances from the points to the line are 
$$(4-\sqrt 5)/\sqrt 2, (4+\sqrt 5)/\sqrt 2.$$
