In the absence of air resistance, a launch angle of 45° maximises range. If the projectile is instead launched from a raised platform, the optimal launch angle still has a closed-form expression, although more algebra is required to compute it.
Suppose the projectile is launched at speed u and angle \phi from height h above the ground, which has gravitational field strength g, so that the motion is given by
The flight time is the positive solution to the quadratic y (t) = 0, which is
where C = 2 g h / u^2 is the dimensionless ratio between the initial potential and kinetic energies of the projectile. Substituting the flight time into x (t) gives the range
To maximise the range R with respect to the launch angle \phi, we compute the derivative \pd R / {\pd\phi}. After some algebra, we obtain
where for brevity \beta = \sin\phi. We then carefully consider the ways in which \pd R / {\pd\phi} can vanish:
If C = \infty, then
which vanishes assuming h is finite. But since C = 2 g h / u^2 is infinite, this only occurs if g = \infty (infinitely strong gravity) or u = 0 (zero launch speed), and in either case the range is zero, i.e. R is minimised.
If \colb C = 0 and \colb \beta < 0, then
which vanishes only if h = 0. But since \phi = \sin^{-1}\beta < 0, this corresponds to launching the projectile downwards starting from ground level, and again the range is zero.
If \colr{ \squarebr{\frac{1 - \beta^2}{\sqrt{\beta^2 + C}} - \beta} = 0 }, then \pd R / {\pd\phi} vanishes unconditionally, and we have
which indeed corresponds to the positive maximum range, which is
Hence the optimal launch angle for a projectile launched at speed u from height h in a gravitational field of strength g is
achieving a maximum range of
In particular:
Finally, note that the optimal angle depends only on the dimensionless ratio C = 2 g h / u^2. In fact this may be shown using dimensional analysis without actually having to solve the problem; the only parameters are u, g, and h, so the only dimensionless group (up to a power) is g h / u^2.
Conway (2022). Projectile motion: optimal launch angle from a platform. <https://yawnoc.github.io/math/projectile-platform> Accessed yyyy-mm-dd.