Suppose that a rocket is launched from ground level with a given initial velocity of 1000ft/s at an angle of inclination θ. What angle θ will result in the greatest horizontal distance traveled by the rocket and what angle will result in the greatest vertical distance.

i know intiutively the answers are 0 and 90 degrees respectively. those are also the answers given in my book. however, i don't know how to do this mathematically.

my x equation is x = 1000(cos θ)t and my y equation is y = 1000(sin θ)t -16t^2.

i did dx/dt = 1000(cos θ) = 0 to find the max or min x distance and i got θ = 90 degrees which is the minimum x distance. but when i differentiate for y, i get dy/dt = 1000(sin θ) - 32t = 0. i'm not sure how to find the max or min angle in this case since there are 2 variables. how do i do this?