Calculate flight time, maximum height and horizontal range for projectile motion, based on initial speed, launch angle and any starting height.
Projectile motion is split into a horizontal and a vertical motion that happen independently of each other. The initial speed v₀ is decomposed into two components:
Horizontally, the object moves at a constant speed vₓ, while vertically it's slowed by gravity (g = 9.81 m/s²) on the way up and accelerates downward on the way down. Range is horizontal speed multiplied by total flight time, and maximum height is reached when the vertical speed is zero.
Without air resistance and with equal start and end height, 45° always gives the longest range for a given initial speed. If the start and end heights differ (as when the launch starts above ground level), the optimal angle is slightly below 45°.
Because gravity only acts vertically. The horizontal and vertical motion don't affect each other, so they can be calculated separately and combined at the end — a fundamental principle in classical mechanics.
Then the entire initial speed is vertical, and the object is launched straight up and falls straight back down in the same spot — the range becomes 0, while flight time and max height are still calculated as normal.