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)$
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$.