i do this question correctly but i am confused about something in (c)

$\displaystyle \frac {dV}{dr}= \frac 5 {12} (S- \frac {20\pi ^2 r^4}S) $

$\displaystyle r = ^4\sqrt {\frac {S^2}{20\pi^2}}$

i don't understand why it shouldn't be

$\displaystyle \frac {dV}{dr}= \frac 5 {12} (S+ r\frac{dS}{dr} -\frac{20\pi^2 r^4}S + \frac {4\pi^2 r^5}{S^2} )$ ?z

why the surface area S is treated as a constant? S is a function of r and h, S changes as r or h changes. Although V is a function of r and S after expressing h in terms of r and S, then S is not a variable?

for example, the perimeter P of a rectangle is given by $\displaystyle P = 2(x+y)$ and its area $\displaystyle A = xy$ , then $\displaystyle y = \frac P 2 -x$ and $\displaystyle A = \frac P 2 x - x^2$ if i differentiate both sides then should it be $\displaystyle \frac {dA}{dx }=\frac P 2 - 2x$ or $\displaystyle \frac {dA}{dx }=\frac P 2 +\frac x 2 \frac {dP}{dx}- 2x$ ?

any explanation will be appreciated! thanks.