Sub topic 10
Eliminating time: the parabolic trajectory
This chapter assumes you can solve a quadratic equation, use sine, cosine and tangent, and write the constant-acceleration equations for each axis. Those equations are x = v0 cosθ · t and y = h0 + v0 sinθ · t − ½ g t². The code uses basic Python.
The earlier chapters describe the projectile with time as the common parameter. Here you remove time to get one equation, y(x), that describes the shape of the path. That equation shows the path is a parabola. It also answers questions about where the projectile is at a given horizontal distance, and which angle hits a given target.
From two equations to one
The ideal model gives two position equations, with the launch at the origin on level ground:
x = v0 cosθ · ty = v0 sinθ · t − ½ g t²
Time appears in both. Solve the horizontal equation for t, since it is linear in t:
t = x / (v0 cosθ)
Substitute this into the vertical equation:
y = v0 sinθ · x/(v0 cosθ) − ½ g · x²/(v0² cos²θ)
In the first term, v0 cancels and sinθ/cosθ becomes tanθ. The result is the trajectory equation:
This is a quadratic in x: y = A x − B x², with A = tanθ and B = g / (2 v0² cos²θ). Both are constants for a given launch. A quadratic with a negative leading coefficient is a parabola that opens downward, so the path is a parabola.
What each term means
The two terms have separate physical meanings.
x tanθis where the projectile would be with no gravity. It travels in a straight line at angle θ, and the height is the slope times the distance.− g x² / (2 v0² cos²θ)is the drop caused by gravity. It grows with the square of the horizontal distance, which is the same½ g t²fall as in free fall, withtreplaced byx / (v0 cosθ).
So at any horizontal distance, the projectile is below the straight-line path by exactly the free-fall distance for the time elapsed.
Worked example
Take v0 = 20 m/s, θ = 30°, g = 9.81 m/s². Find the height at x = 10 m.
tan30° = 0.5774, sox tanθ = 5.774 m.v0² cos²θ = 400 × 0.75 = 300.- The drop is
9.81 × 100 / (2 × 300) = 1.635 m. y = 5.774 − 1.635 = 4.14 m.
Range and maximum height from y(x)
Set y = 0 and factor out x:
x (tanθ − g x / (2 v0² cos²θ)) = 0
One root is x = 0, the launch point. The other root is the range:
R = 2 v0² sinθ cosθ / g = v0² sin2θ / g
This agrees with the time-of-flight derivation. You get the same answer from a different route.
The substitution B = tanθ / R gives a compact factored form:
y = x tanθ (1 − x/R)
The parabola crosses y = 0 at x = 0 and x = R. A parabola is symmetric about the midpoint of its roots, so the peak is at x = R/2. Substituting gives
H = (R/2) tanθ · (1/2) = R tanθ / 4.
You can write the whole path in vertex form:
y = H − (g / (2 v0² cos²θ)) (x − R/2)²
For the example: R = 400 × sin60° / 9.81 = 35.31 m. At x = R/2 = 17.66 m, the factored form gives H = 35.31 × 0.5774 / 4 = 5.10 m. This matches vy² / (2g) = 100 / 19.62 = 5.10 m.
Launching from a height
If the launch point is h0 above the landing level, add h0 to the equation:
y = h0 + x tanθ − g x² / (2 v0² cos²θ)
The shape is still a parabola, shifted up by h0. The factored form no longer applies, because x = 0 is no longer a root. To find the landing distance, set y = 0 and solve the quadratic in x, keeping the positive root. The previous chapter's time-based method gives the same distance.
Computing y(x) in code
This script evaluates y(x) and checks it against the time-based equations at several instants.
import math
def y_of_x(x, v0, angle_deg, h0=0.0, g=9.81):
"""Height of the ideal trajectory at horizontal distance x."""
theta = math.radians(angle_deg)
return h0 + x * math.tan(theta) - g * x**2 / (2 * (v0 * math.cos(theta))**2)
v0, angle, g = 20.0, 30.0, 9.81
theta = math.radians(angle)
vx, vy = v0 * math.cos(theta), v0 * math.sin(theta)
for t in (0.5, 1.0, 1.5, 2.0):
x = vx * t
y_time = vy * t - 0.5 * g * t**2
y_traj = y_of_x(x, v0, angle)
print(f"t={t:.1f} s x={x:6.2f} m y(t)={y_time:6.3f} y(x)={y_traj:6.3f}")Each row shows y(t) and y(x) equal. If they differ, the cause is usually a degrees/radians mix-up.
Hitting a target: solving for the angle
A common question is which angle sends the projectile through a point (d, h). Use the identity 1/cos²θ = 1 + tan²θ. Let u = tanθ. Then the trajectory equation is
h = d u − g d² (1 + u²) / (2 v0²)
Rearranged, this is a quadratic in u:
a u² − d u + (h + a) = 0, where a = g d² / (2 v0²)
The discriminant decides the outcome:
- Positive: two angles, a low flat shot and a high lob.
- Zero: one angle, the target sits on the edge of the reachable region.
- Negative: no angle works, and the target is out of reach at this speed.
import math
def angles_to_hit(d, h, v0, g=9.81):
"""Launch angles in degrees that pass through (d, h), launched from the origin."""
a = g * d**2 / (2 * v0**2)
disc = d**2 - 4 * a * (h + a)
if disc < 0:
return []
roots = {(d + s * math.sqrt(disc)) / (2 * a) for s in (-1, 1)}
return sorted(math.degrees(math.atan(u)) for u in roots)
print(angles_to_hit(d=30.0, h=2.0, v0=20.0))
print(angles_to_hit(d=60.0, h=0.0, v0=20.0))The first call returns two angles, about 28.5° and 65.3°. The second returns an empty list, because the maximum range at 20 m/s is 400 / 9.81 = 40.8 m, which is less than 60 m.
Common errors
- Dropping the square. The drop term has
x²andcos²θ. Writingcosθinstead ofcos²θgives wrong heights. - Degrees in
math.tan. Python's trigonometric functions expect radians. Convert withmath.radians. - Vertical launch. At
θ = 90°,tanθis undefined andxstays zero, soy(x)cannot describe the motion. Use the time-based equations. - Using
y(x)when velocity matters. The equation contains no time, so it cannot tell you how fast the projectile moves along the path. Use the velocity equations for that. - Forgetting the second root. The target-angle quadratic has two solutions. Check both against the problem's constraints, such as a ceiling or a minimum impact angle.
- Treating the formula as complete. It holds only under the ideal model: constant
g, no air resistance, flat ground. Real projectiles with drag follow a path that falls more steeply than a parabola on the way down.
Exercises
Exercise
A ball is launched from level ground at 25 m/s and 40°. Use the trajectory equation to find its height at x = 20 m. Use g = 9.81 m/s².
Show answer
tan40° = 0.8391, so x tanθ = 16.78 m. cos40° = 0.7660, so cos²θ = 0.5868 and v0² cos²θ = 625 × 0.5868 = 366.8. The drop is 9.81 × 400 / (2 × 366.8) = 5.35 m. So y = 16.78 − 5.35 ≈ 11.4 m.
Exercise
Show that the maximum height of the trajectory is H = R tanθ / 4, starting from y = x tanθ (1 − x/R).
Show answer
By symmetry the maximum is at x = R/2. Substituting gives y = (R/2) tanθ (1 − 1/2) = (R/2) tanθ (1/2) = R tanθ / 4.
Exercise
Why does the equation for the launch angle that hits a target at distance d have two solutions, and when does it have none?
Show answer
Writing 1/cos²θ as 1 + tan²θ makes the trajectory equation a quadratic in tanθ. A quadratic can have two roots, which correspond to a low trajectory and a high one. It has none when the discriminant d² − 4a(h + a) is negative, where a = g d² / (2 v0²). In that case the target is beyond the reach of the given launch speed.