At what angle from the ground should it be fired so that it travels the maximum distance in the air? A projectile is going to be fired from a cannon on level ground.
At what angle from the ground should it be fired so that it travels the maximum distance in the air?
Details and Assumptions:


*

*There is downward gravitational acceleration $g.$

*Neglect air resistance.


If the ball is released with initial speed $V$ at an angle of $\theta$ to the horizontal, the trajectory of the ball is
 $y \; = \; x\tan\theta - \tfrac{g}{2V^2}x^2\sec^2\theta \; = \; x\tan\theta - \tfrac{1}{2a}x^2\sec^2\theta $
where $a = \tfrac{V^2}{g}$. Then the ball hits the ground again when $y=0$, which happens when $x = 2a\sin\theta\cos\theta$. Thus how should I continue to solve this?
 A: 
If the ball is released with initial speed $V$ at an angle of $\theta$
  to the horizontal, the trajectory of the ball is $ y \; = \;
> x\tan\theta - \tfrac{g}{2V^2}x^2\sec^2\theta \; = \; x\tan\theta -
> \tfrac{1}{2a}x^2\sec^2\theta $ where $a = \tfrac{V^2}{g}$. Then the
  ball hits the ground again when $y=0$, which happens when $x =
> 2a\sin\theta\cos\theta$.

Continuing what you said
The length of the flightpath of the ball is
$ \begin{align} D(\theta) & = \; \int_0^{2a\sin\theta\cos\theta} \sqrt{1 + (y')^2}\,dx \; = \; \int_0^{2a\sin\theta\cos\theta}\sqrt{1 + \big(\tan\theta - \tfrac{1}{a}x\sec^2\theta\big)^2}\,dx \\ & = \; \frac{1}{a\cos^2\theta} \int_0^{2a\sin\theta\cos\theta}\sqrt{a^2\cos^4\theta + (x - a\sin\theta\cos\theta)^2}\,dx \; = \; \frac{1}{a\cos^2\theta}\int_{-a\sin\theta\cos\theta}^{a\sin\theta\cos\theta}\sqrt{a^2 \cos^4\theta + x^2}\,dx \\ & = \; a\cos^2\theta \int_{-\tan\theta}^{\tan\theta} \sqrt{1+y^2}\,dy \; = \; 2a\cos^2\theta\int_0^\theta \sec^3u\,du \\ & = \; 2a\cos^2\theta \times \tfrac12\left[\tan\theta\sec\theta + \ln(\sec\theta + \tan\theta)\right] \; = \; a\left[\sin\theta + \cos^2\theta\ln(\sec\theta + \tan\theta)\right] \end{align} $
and
$ D'(\theta) \; = \; a\left[\cos\theta + \cos\theta - 2\sin\theta\cos\theta\ln(\sec\theta+\tan\theta)\right] \; = \; 2a\cos\theta\big[1 - \sin\theta\ln(\sec\theta + \tan\theta)\big] $
Thus $D(\theta)$ will be maximized when $\sin\theta\ln(\sec\theta+\tan\theta) = 1$ (there is also a local minimum at $\theta = \tfrac12\pi$, and a global minimum at $\theta = 0$). Solving this last equation numerically, we obtain $\theta = 0.98551473786$, or $\boxed{56.4658^\circ}$.
