maximum range of projectile launched from elevation I am trying to find the maximum range of projectile from an elevation. I found the answer in this question, but I have two questions:

*

*Why does $y$ need to be $0?$

*Why do they differentiate with respect to $\theta,$ and what is the meaning of this?


Let projectile to be shot at angle $\theta$. Then $x=ut\cos\theta$, $y=H+ut\sin\theta - \frac{gt^2}{2}$. From first equation $t=\frac{x}{u\cos \theta}$, then $y=H+x \tan\theta-\frac{gx^2}{2u^2\cos^2\theta}=H+x \tan\theta-\frac{gx^2}{2u^2}(1+\tan^2\theta)$.
Range of projectile at some $\theta$ is $x$ at which $y=0$. Then range $R$ is defined by $H+R\tan\theta-\frac{gR^2}{2u^2}(1+\tan^2\theta)=0$. Let mark $\tan\theta=p$, then $H+Rp-\frac{gR^2}{2u^2}(1+p^2)=0$.
Let consider this equation with respect to $p$ and rewrite it as $$\frac{gR^2}{2u^2}p^2-Rp+\left(\frac{gR^2}{2u^2}-H\right)=0.$$ Solution for $p$ will exist if $$D=R^2-4\frac{gR^2}{2u^2}\left(\frac{gR^2}{2u^2}-H\right)\geq 0$$
$$R^2>0\Rightarrow 1-4\frac{g}{2u^2}\left(\frac{gR^2}{2u^2}-H\right) \geq 0\Rightarrow \frac{gR^2}{2u^2}-H \leq \frac{u^2}{2g} \Rightarrow R^2\leq \frac{u^4}{g^2}+\frac{2u^2}{g}H$$ $$R\leq \sqrt{\frac{u^4}{g^2}+\frac{2u^2}{g}H}=\frac{u}{g}\sqrt{u^2+2gH}$$
