What is the optimum angle of projection when throwing a stone off a cliff?

You are standing on a cliff at a height $h$ above the sea. You are capable of throwing a stone with velocity $v$ at any angle $a$ between horizontal and vertical. What is the value of $a$ when the horizontal distance travelled $d$ is at a maximum?

On level ground, when $h$ is zero, it's easy to show that $a$ needs to be midway between horizontal and vertical, and thus $\large\frac{\pi}{4}$ or $45°$. As $h$ increases, however, we can see by heuristic reasoning that $a$ decreases to zero, because you can put more of the velocity into the horizontal component as the height of the cliff begins to make up for the loss in the vertical component. For small negative values of $h$ (throwing up onto a platform), $a$ will actually be greater than $45°$.

Is there a fully-solved, closed-form expression for the value of $a$ when $h$ is not zero?

-
I highly recommend throwing stones off a cliff when you're at the seaside. It's a lot of fun. This problem grew out of an argument I had with my family when we were at the seaside, that 45° isn't the best angle when you're on a cliff. – Neil Mayhew Jul 23 '10 at 14:16

Assume no friction and uniform gravity g.

If you throw a stone at point (0, h), with velocity (v cos θ, v sin θ), then we get

\begin{align} d &= vt\cos\theta && (1) \\ 0 &= h + vt\sin\theta - \frac12 gt^2 && (2) \end{align}

The only unknown to be solved is t (total travel time). We could eliminate it by using $t = \frac d{v\cos\theta}$ to get

$$0 = h + d\tan\theta - \frac{gd^2\sec^2\theta}{2v^2}\qquad(3)$$

Then we compute the total derivative with respect to θ:

\begin{align} 0 &= \frac d{d\theta}\left(d\tan\theta\right) - \frac g{2v^2}\frac d{d\theta}\left(d^2\sec^2\theta\right) \\ &= \ldots \end{align}

and then set $\frac{dd}{d\theta}=0$ (because it is maximum) to solve d:

$$d = \frac{v^2}{g\tan\theta}$$

Substitute this back to (3) gives:

\begin{align} h &= \frac{v^2}g \left( \frac1{2\sin^2\theta} - 1\right) \\ \Rightarrow \sin\theta &= \left( 2 \left(\frac{gh}{v^2} + 1\right) \right)^{-1/2} \end{align}

This is the closed form of θ in terms of h.

-
Wow, so you subbed the other way round. Very nice – Casebash Jul 23 '10 at 23:15
Very elegant. Thank you. – Neil Mayhew Sep 10 '10 at 20:30
ps. physics.stackexchange.com/a/23187/8446 gives an equivalent closed form for $θ$ in terms of $\tan$ instead of $\sin$. – Ryan Apr 3 '12 at 11:55

I don't have a complete solution, but I attempted to solve this problem using calculus.

$x'=v \cos a$
$y''= -g$ and (at $t=0) \quad y'= v \sin a$
So, $y'= v \sin a -gt$
$x_0=0$, so $x=vt \cos a$
$y_0=h$, so $y=vt \sin a - \frac12 gt^2+c$ (integrating with respect to $t$)
Subbing in $h, y=vt \sin a - \frac12 gt^2+h$

The ball will hit the ground when $y=0$.

This is as far as I got, but it appears that you can find a closed solution after all. I originally tried solving the quadratic for $t$ and subbing that into $x$, but it seems to work much better to do the substitution the other way round. I will leave this solution here in case anyone wants to see how to derive the basic equations for $x$ and $y$.

-
I specifically excluded the case when h=0, because I know how to solve that. We know t isn't going to be zero, so we can set y=0, and get t = 2 v sin a / g, x = 2 v^2 sin a cos a / g = v^2 sin 2a / g. This is at a maximum when 2a = π and so a = π/2. – Neil Mayhew Jul 23 '10 at 14:05
Also, you made a mistake and used cos a for y, although I know you meant sin a because you used this for y'. – Neil Mayhew Jul 23 '10 at 14:08
@Neil: I meant to say subbing in y=0 to find when the ball hits the ground. You are right about the second comment too, I accidentally integrated with respect to t and then with respect to a as well. – Casebash Jul 23 '10 at 14:19
I meant 2a = π/2 and so a = π/4 above. – Neil Mayhew Jul 23 '10 at 14:32