If the horizontal range of a projectile launched, without air resistance is given by: $$R = \frac{v_0\cos\theta}{g}\left(v_0\sin\theta +\sqrt{v_{0}^{2}\sin^{2}\theta + 2S_0g}\right)$$ where $S_0$ is the initial height of the projectile, $v_0$ is the initial velocity, and $g$ is the acceleration due to gravity. Consider the range as a function of $\theta$. Show that the projectile launched is a maximum for the angle of inclination $$\theta = \cos^{-1}\sqrt{\frac{2S_0g + v_{0}^{2}}{2S_0g + 2v_{0}^{2}}}.$$
This problem is from the book "Advanced Engineering Mathematics" (6th ed.) by Dennis Zill. After taking the derivative of the Range with respect to $\theta$, and equating it to zero, I'm stuck with $$\sqrt{\sin^2\theta + \frac{2S_0g}{v_{0}^2}}\cos2\theta + \cos2\theta\sin\theta -\frac{2S_0g\sin\theta}{v_{0}^{2}} = 0.$$
All it needs is patience with algebra after applying the Quotient and Chain Rules.
Let $$ s= \sin\theta, c= \cos\theta , k =\dfrac{2 S_0 g }{v_0^2}, Q= s^2 + k; \,\; $$
Maximize $c ( s+ \sqrt{s^2+k} ) $ or its square for convenience
$$ c^2 ( s+\sqrt Q)^2 $$
Quotient Rule
$$ \dfrac{c^2}{( s+\sqrt Q)^2 }= -\dfrac{2c\cdot -s}{2( s+\sqrt Q)*(c +\dfrac{sc}{\sqrt Q})} $$
Simplifying steps are:
$$ \dfrac{c}{( s+\sqrt Q)}= \dfrac{s}{c(1+s/\sqrt{Q})} $$
$$ c^2= s \sqrt{Q}$$ Squaring both sides
$$ c^4= s^2(s^2+k)\rightarrow c^4-s^4 = c^2-s^2 =s^2 k $$
Plug in $ s^2= 1-c^2 $ and collect $c^2$ terms..
$$ c^2 (2+k)= (1+k) $$
$$ c= \sqrt{ \dfrac{1+k}{2+k} }$$
$$\cos \theta = \sqrt{\frac{2S_0g + v_{0}^{2}}{2S_0g + 2v_{0}^{2}}}.$$