x = (VcosA)/g*(VsinA + ((VsinA)^2 + 2gYo)^1/2)

where x is the distance

v is the speed

A is the angle

g is the force of gravity

and Yo is the height

but i am a bit lost in taking its derivative. once i do so, i need to maximize and minimize the angle. i was wondering if i could get some help