← Back to Regression Models

Example: Trajectory of a Ball

Problem Statement

We throw a ball into the air and measure its height at different times. We want to predict where the ball will be at 1.5 seconds.

Because gravity pulls the ball down, the path is an arc (parabola), not a straight line. Therefore, Simple Linear Regression will fail here. We need Polynomial Regression (Degree 2).

1. The Data

Time in Seconds ($x$) Height in Meters ($y$)
02
112
212
32

2. Choosing the Model

A straight line equation looks like $y = mx + b$. A polynomial (degree 2) equation looks like:

y = w₀ + w₁x + w₂x²

Here, $w_0$, $w_1$, and $w_2$ are the weights we need to find.

3. Fitting the Curve

The computer (or a complex manual calculation using matrices) solves for the weights that minimize the error. For this perfect physics example, the result is:

Final Equation

Height = -5(Time)² + 15(Time) + 2

4. Making a Prediction

Let's predict the height at 1.5 seconds (exactly halfway between measurements):

$$ y = -5(1.5)^2 + 15(1.5) + 2 $$ $$ y = -5(2.25) + 22.5 + 2 $$ $$ y = -11.25 + 24.5 $$ $$ y = 13.25 ext{ meters} $$

The model correctly predicts that the ball peaks between 1 and 2 seconds, reaching higher than the measured points of 12m. A straight line model would have predicted it was just staying flat or going in one direction!