Below is a proof, written by Kian Mayne, on how the optimum angle to throw/ kick or shoot something to make it travel the furthest distance horizontally possible is 45 degrees!

Applying the equations of linear motion (SUVAT) for the horizontal (we want to maximise the distance travelled along the x-axis):

t = \text{?} – hmm…it’s going to be flying from when it’s kicked/thrown to when it hits the ground
a = 0 – neglecting air resistance
u = v_x = v \cdot cos(\theta) – resolving v for the x-axis
v = \text{?} – don’t know and can’t find out
s = \text{?} – what we want to find out
Looks like we need to find t! As mentioned above – we can find this from how long it stays in the air. The easiest way to do this is to double the time taken to reach the highest point. More SUVAT (but for the vertical y-axis!):

t = \text{?} – what we want to find out
a = g = -9.81 – we’re taking upwards as positive
u = v_y = v \cdot sin(\theta) – resolving v for the y-axis
v = 0 – velocity is zero at the apex of the throw/kick/whatever
s = \text{?} – unknown and irrelevant
We have all the variables except s therefore we need the not-s equation:

v = u + at

0 = v \cdot sin(\theta) -9.81t

v \cdot sin(\theta) = 9.81t

t = \frac{v \cdot sin(\theta)}{9.81}

Excellent! We now have a constant expression for t that we can use in the horizontal SUVAT equation (for which we use the not-v equation):

s = ut + \frac{1}{2}at^2

s = t[v \cdot cos(\theta)] + \frac{1}{2} \cdot 0 \cdot t^2

Substituting t from earlier:

s = \frac{v \cdot sin(\theta)}{9.81} \cdot v \cdot cos (\theta) + 0

s = \frac{v \cdot sin(\theta) \cdot v \cdot cos(\theta)}{9.81}

s = \frac{v^2}{9.81} \cdot sin(\theta) \cdot cos(\theta)

Awesome! We now have an equation for s in terms of constants and s. Finding the maximum can be done in two ways – one simple and one cooler and more mathematically rigorous.

The simple way is as follows:

The \frac{v^2}{9.81} part is a constant and thus can be ignored.
Therefore to maximise the function, we need to maximise sin(\theta) \cdot cos(\theta)
You can find the maximum by drawing the function y = sin(x) \cdot cos(x) (below)
As you can see, the maximum occurs at 45°.
Boorrring. Let’s find the maximum via differentiation! When differentiating, we find a maximum by using the fact that, at a maximum or minimum (or point of inflection), the gradient (found by differentiating) is 0. OK, let’s see:

s = \frac{v^2}{9.81} \cdot sin(\theta) \cdot cos(\theta)

\frac{d s}{d \theta} = \frac{d[ \frac{v^2}{9.81} \cdot sin(\theta) \cdot cos(\theta)]}{d\theta}

As \frac{v^2}{9.81} is constant, we can factor it out:

\frac{d s}{d \theta} = \frac{v^2}{9.81} \cdot \frac{d[sin(\theta) \cdot cos(\theta)]}{d\theta}

Using the product rule:

\frac{d s}{d \theta} = \frac{v^2}{9.81} \cdot ( cos(\theta) \cdot \frac{d sin(\theta)}{d \theta} + sin(\theta) \cdot \frac{d cos(\theta)}{d \theta} )

\frac{d s}{d \theta} = \frac{v^2}{9.81} \cdot ( cos(\theta) \cdot cos(\theta) + sin(\theta) \cdot \: - sin(\theta) )

Cool – now let’s set it equal to 0:

0 = \frac{v^2}{9.81} \cdot ( cos(\theta) \cdot cos(\theta) + sin(\theta) \cdot \: - sin(\theta) )

0 = \frac{v^2}{9.81} \cdot ( cos^2(\theta) - sin^2(\theta))

As \frac{v^2}{9.81} is a constant, we can safely divide through by it (there are no solutions for \theta in it):

0 = cos^2(\theta) - sin^2(\theta)

Now using the following trigonometric identity:

sin^2(\theta) + cos^2(\theta) = 1

cos^2(\theta) = 1 - sin^2(\theta)

Now substituting:

\therefore \quad 0 = 1 - sin^2(\theta) - sin^2(\theta)

2 sin^2(\theta) = 1

sin^2(\theta) =\frac{1}{2}

Square root both sides (we can ignore the negative root as that is in the opposite direction):

sin(\theta) = \sqrt{\frac{1}{2}} = \frac{\sqrt{2}}{2}

sin^{-1} of both sides:

\theta = 45

There! FYI We can safely solve for 0 \leq \theta \leq 180 as anything higher or lower would be the opposite direction.

Thanks Kian!