<s>[INST] How do I find the maximum perimeter of a rectangle inscribed in an ellipse? The problem I've been stuck on is this:
A rectangle is inscribed in the ellipse  $$\frac{x^2}{20} + \frac{y^2}{12} = 1$$ What is the maximum perimeter of the rectangle?
I don't even know if I'm taking the right approach. So far, I've been trying to solve for $y$, giving me $y = \sqrt{12-(3/5)x}$, and plugging that into the equation $P = 4x + 4y$, which should be the equation for the perimeter of an inscribed rectangle. I then took the derivative of $P$ after plugging in the equation for $y$, giving me $$P' = 4 - \frac{12x}{5\sqrt{12-(3/5)x}}.$$ To find a maximum, I'd set the equation to zero right? Well, I don't know where to go from this step, since simplifying from here only seems to make it harder.
Any help would be much appreciated, even a nudge in the right direction. I have no idea where to go from here, or even if I got to the right place. Thanks for your time
 [/INST] One simple way of solving this problem is by Lagrange multipliers method. Note that if $(x,y)$ is in the first quadrant on the ellipse $x^2/a^2+y^2/b^2 = 1$, then the perimeter of the inscribed rectangle represented by $(x,y)$ is simply $4(x+y)$. Therefore you want to maximize $x+y$ given the constraint that $x^2/a^2+y^2/b^2 = 1$. Define
$$
f(x,y,\lambda) = x+y -\lambda\left(\frac{x^2}{a^2}+\frac{y^2}{b^2}-1\right)
$$
Hence by maximizing $f$
$$
1 = \frac{2x\lambda}{a^2}=\frac{2y\lambda}{b^2}\Longrightarrow \frac{x}{a} = \frac{y}{b}\left(\frac{a}{b}\right)
$$
but then
$$1=\frac{x^2}{a^2}+\frac{y^2}{b^2}=\frac{y^2}{b^2}\left(1+\frac{a^2}{b^2}\right)\Longrightarrow y=\frac{b^2}{\sqrt{a^2+b^2}}, \quad x=\frac{a^2}{\sqrt{a^2+b^2}}$$
The maximum perimeter is therefore $4(x+y) = 4\sqrt{a^2+b^2}$.
</s>