I need some help getting a formula. I remember in class u get this really wierd looking equation like

Vicosg-((vsin(pheta))/2g)
I think this is what the equatin is when I'm asked to

"Derive a formula for the Range of a projectile based on Vi and the Launch angle, pheta. State when and why is this equation at a maximum."

I'm not exactly sure what it means by maximum or how to derrive the forumula. I think what I wrote above is what i am suppose to eventually get I'm just nore sure how to get that and what it means by maximum

horizontal problem:

u = Vi cos Theta
range = u * time in air
find the time in air with vertical solution:
Vi sin theta = initial speed up
-g = acceleration
so
v = Vi sin Theta - g t
h = height = Vi sin Theta * t - .5 g t^2
the height is zero when t = 0 and again when it hits ground at the end of flight
0 = t (Vi sin Theta - .5 g t)
so t = time in air = 2Vi sin Theta /g
so
range = Vi cos Theta * (2/g) Vi sin theta
NOW
if you want to know the angle Theta for maximum range
d range/ d Theta = 0 at maximum
0 = Vi cos Theta*(2/g)Vi cos Theta -(2/g) Vi sin theta * Vi sin Theta
or
cos^2 Theta = sin^2 Theta
sin Theta/cos Theta = tan Theta = 1
Theta = 45 degrees