Deriving the maximum range and angle of a projectile
The kinetic energy of the projectile E = ½mv2, gives v = sqrt(2E/m) as the speed at launch. Let θ be the angle at which you launch (θ=0° is horizontal, θ=90° is straight up). Then you can decompose the speed into two components:
vh = v cos(θ) is the horizontal speed,
vv = v sin(θ) is the vertical speed.
Gravity only pulls vertically, so the projectile's vertical speed will be slowed down until it reaches its maximum altitude, then it will fall back until it hits the ground. The horizontal speed will remain constant until it hits the ground and stops. To figure out the range, you need to know the time t that the projectile flies before it hits the ground; then the range is just
R = vht
Energy conservation guarantees that it's downward speed at the end is equal to its original upward speed, just with a change of sign. That also means that the total flight time of the projectile will be half going up and half going down. Once you determine how long it takes to reach the top of its flight, you're done; just double that answer :-)
In the vertical direction, the maximum height
H = vvt - ½gt2
(you need calculus to derive this result). From energy conservation, the initial kinetic energy in the vertical direction, Ev = ½mvv2 must equal the potential energy at the top of the flight, Pv = mgH:
mgH = ½mvv2
H = ½vv2/g
Substitute this on the left hand side of the trajectory expression,
½vv2/g = vvt - ½gt2
vv2 = 2gvvt - g2t2
vv2 - 2gvvt + g2t2 = 0
(vv - gt)2 = 0
vv = gt
So, t = vv/g = v sin(θ)/g is the time to reach maximum height. Double that as discussed above, and you get the range R = 2 sin(θ) cos(θ) v/g.
Work out the angle that gets you maximum range by just plugging in different angle values and finding the one that is biggest.