We are given a sphere of radius $a$, and a cylinder of base radius $r$ and height $h$ is inscribed in this sphere.
How to express the volume and the surface area of the cylinder as functions of $r$? as functions of $h$?
My [Corrected] Attempt [Based on the correction by MathLover]:
Any of the "diagonals" of the cylinder passes through the center of the sphere and thus has length $2a$. So we have the relation $$ 4r^2 + h^2 = 4a^2. \tag{1} $$
So if we put $h = \sqrt{ 4a^2 - 4r^2 }= 2 \sqrt{ a^2 - r^2}$, then we obtain $$ V = \pi r^2 h = 2\pi r^2 \sqrt{ a^2 - r^2 }, \qquad \mbox{ and } \qquad S = 2 \pi rh = 4 \pi r \sqrt{ a^2 - r^2 }. $$ Thus both $V$ and $S$ are expressed as functions of $r$.
From (1), we also obtain $r = \frac12 \sqrt{ 4a^2 - h^2}$, and thus we obtain $$ V = \pi r^2 h = \frac14 \pi h \left( 4a^2 - h^2 \right), \qquad \mbox{ and } \qquad S = 2 \pi r h = \pi h \sqrt{ 4a^2 - h^2}, $$ thus expressing $V$ and $S$ as functions of $h$.
Are my formulas correct? If so, is method applied by me in reaching these formulas also correct in each case? Or, are there instances where I have gone wrong?