What is the area of the rectangle of largest area that can be inscribed in a circle of radius $r$?

This is an example from Khan Academy and I cannot understand the answer's explanation.

I will give their explanation and show where I am confused

Let a circle of radius $r$ be centered at the origin so its equation can be modeled by

$$x^2+y^2=r^2$$ $$y^2=r^2-x^2$$ $$y=\pm\sqrt{r^2-x^2}$$

A rectangle inscribed in the circle with sides parallel to the axes will have vertices $$A=(x,\sqrt{r^2-x^2}),\ B=(-x,\sqrt{r^2-x^2}),\ C=(x,-\sqrt{r^2-x^2}),\ D=(-x,-\sqrt{r^2-x^2})$$

The area of the rectangle is given by $$F(x)=2x\cdot2y$$ where $$y^2=\sqrt{r^x-x^2}$$ $$F(x)=4x\sqrt{r^2-x^2}$$ for $$x\in\left[0,r\right]$$ only!

The following part confuses me: Rather than wrestle with the chain and product rules, we can make the job easier by letting $$S\left(x\right)=\left(F\left(x\right)\right)^2=16x^2(r^2-x^2)$$ $$S(x)=16r^2x^2-16x^4$$ Then $$S^\prime\left(x\right)=32r^2x-64x^3$$ I understand how to do the rest but cannot understand why they square $F\left(x\right)$

• The value of $x$ that maximizes $F(x)$ is the same value that maximizes $F^2(x),$ and the calculations are easier if we get rid of the square root. – saulspatz Jul 3 '18 at 16:40

Because, since $F$ is non-negative, the point at which $F$ attains its maximum is the same point at which $F^2$ attains its maximum. But it is easier to work with $F^2$ (since it has no square roots) than with $F$.

• This is a very standard trick for maximizing nonnegative functions like area/distance that involve square roots. The square function preserves order (larger/smaller) if all the inputs are nonnegative – Alan Jul 3 '18 at 16:40
• Wouldn't that change the values of y? – Jinzu Jul 3 '18 at 16:47
• @Jinzu Yes, but that doesn't change the $x$ for which $y$ becomes maximal. – José Carlos Santos Jul 3 '18 at 16:50

As $F(x)$ is certainly non-negative, the goal "minimize $F(x)$" is equivalent to the goal "minimize $F(x)^2$", so this is certainly a valid move. OF course, it would be a just as valid move to switch to "maximize $\arctan F(x)$" instead, but of course $F(x)^2$ has a great advantage over $F(x)$ (not to mention over $\arctan F(x)$), namely a derivative that is easier to deal with.

It is just because $F$ and $S$ have the same maximum point and $S$ is easier to work with.

P.S.: they have the same maximum point because $$x < y \Rightarrow x^{2} < y^{2}$$ whenever $x,y \geq 0$. So the maximum of $F$ is also the maximum of $S$.

Because $$S=xy\leq\frac{x^2+y^2}{2}=\frac{(2r)^2}{2}.$$ The equality occurs for $$xy=\frac{x^2+y^2}{2}$$ or $$(x-y)^2=0$$ or $$x=y,$$ which says that our rectangle is a square.