You throw a ball over a flat field as hard as you can. Easy: what upward angle maximizes the distance away that the ball lands? Harder: what upward angle maximizes the distance that the ball travels?

This is a basic dynamics problem where details like wind resistance and the curvature of the earth are meant to be ignored. Suppose you throw the ball with an initial speed `V_0` at an initial angle `theta` above the horizontal. This gives it an initial upward component of velocity `V = V_0 sin(theta)` and an unchanging forward component of velocity of `H = V_0 cos(theta)`. The vertical velocity is reduced by the acceleration due to gravity; that is `(dV)/(dt) = -g` and therefore `V(t) = V_0 sin(theta) - gt`.

Due to conservation of energy, the ball reaches the ground at the same speed, but downward, that it had when you threw it. So if the final time is *t=F*, `V(F) = - V_0 sin(theta) = V_0 sin(theta) - gF` so `F = 2 (V_0/g) sin(theta)`.

Since it travels the same horizontal speed at all times, to compute the distance *A* away from you where the ball lands, you simply need to multiply the time it is in the air times the horizontal velocity. Thus maximize `A = F H = 2 (V_0^2/g) sin(theta) cos(theta) = (V_0^2/g) sin(2 theta)`. `(dFH)/(dtheta) = 2 (V_0^2/g) cos(2 theta)` which is zero when cos(2 theta) is zero at `theta = pi/4`.

The distance traveled *D* is a bit harder to compute. This is the integral of the full speed *S* (considering both components of the velocity) from 0 to F. `S(t) = sqrt(V(t)^2 + H^2) = sqrt(V_0^2 sin^2(theta) + g^2 t^2 - 2 V_0 g t sin(theta) + V_0^2 cos^2(theta))`.

Since `sin^2(theta) + cos^2(theta) = 1`, this reduces to `S(t) = sqrt(V_0^2 + g^2 t^2 - 2 V_0 g t sin(theta))`. Then the distance traveled is `int_0^F S(t) dt`. How do you integrate this?

The *Standard Math Tables* provide a solution. Let `S(t)=sqrt(X)`, `X = a + bt + ct^2`, `a = V_0^2`, `b = -2 V_0 g sin(theta)`, and `c = g^2`. Then `q = 4ac - b^2 = 4 V_0^2 g^2 (1 - sin^2(theta)) = 4 V_0^2 g^2 cos^2(theta)`, and `k = 4c/q = 1/(V_0^2 cos^2(theta))`, then `int sqrt(X) dt = (2ct +b)sqrt(X)/(4c) + (1/(2k)) int (dt)/sqrt(X)`.

The math tables also provide a solution for the new integral. Actually, it provides three of them, but the one that fits best here, for `c > 0` as it is in this case, is `int (dt)/sqrt(X) = (1/sqrt(c))log(sqrt(X) + tsqrt(c) + b/(2 sqrt(c)))`.

Substituting in the variables from the problem, `int S(t) dt = (g t - V_0 sin(theta))S(t)/(2g) + (V_0^2 cos^2(theta))/(2g) log(S(t) + gt - V_0 sin(theta))`. Then we need to evaluate this at `F = 2 (V_0/g) sin(theta)` and 0. Remember from above that `S(0) = S(F) = V_0`.

`D = ((2 V_0 sin(theta) - V_0 sin(theta))V_0)/(2g) + (V_0^2 cos^2(theta))/(2g) log(V_0 + 2 V_0 sin(theta) - V_0 sin(theta)) + (V_0 sin(theta))V_0/(2g) - (V_0^2 cos^2(theta))/(2g) log(V_0 - V_0 sin(theta))`

`D = (V_0^2 sin(theta))/g + (V_0^2 cos^2(theta))/(2g) (log(V_0 + V_0 sin(theta)) - log(V_0 - V_0 sin(theta)))`

`D = (V_0^2 sin(theta))/g + (V_0^2 cos^2(theta))/(2g) log((1 + sin(theta))/(1 - sin(theta)))`

The arrangement inside the logarithm suggests the application of trig identities. Multiply numerator and denominator by `1 + sin(theta)`, leading to `log((1+sin(theta))^2/cos^2(theta)) = 2 log((1+sin(theta))/(cos(theta)))`.

`D = (V_0^2 sin(theta))/g + (V_0^2 cos^2(theta))/(g) log((1+sin(theta))/(cos(theta)))`

The angle at which the maximum in the distance occurs is then the solution of `(dD)/(dtheta) = 0`

`(dD)/(dtheta) = (V_0^2 cos(theta))/g - (2 V_0^2 cos(theta) sin(theta))/g log((1+sin(theta))/(cos(theta))) + (V_0^2 cos^2(theta))/(g) cos(theta)/(1+sin(theta)) (sec^2(theta) + sec(theta)tan(theta)) = 0`

`cos(theta) - 2 cos(theta) sin(theta) log((1+sin(theta))/(cos(theta))) + cos^2(theta) cos(theta)/(1+sin(theta)) (sec^2(theta) + sec(theta)tan(theta)) = 0`

`cos(theta) - 2 cos(theta) sin(theta) log((1+sin(theta))/(cos(theta))) + cos(theta)/(1+sin(theta)) (1 + sin(theta)) = 0`

`cos(theta) - 2 cos(theta) sin(theta) log((1+sin(theta))/(cos(theta))) + cos(theta) = 0`

`2 cos(theta) = 2 cos(theta) sin(theta) log((1+sin(theta))/(cos(theta)))`

`1 = sin(theta) log((1+sin(theta))/(cos(theta)))`

This can be solved numerically, to find `theta` is about 0.985515 radians or 56.4658 degrees. And `D(theta) = 1.19968 V_0^2 / g`. Compare this with the distance at the 45 degree angle throw, where `D = 1.14779 V_0^2 / g`.