Sub topic 2
Rate of change: how much y changes per unit of x
This chapter assumes you can plot points on the coordinate plane, work with signed numbers and fractions, and rearrange simple expressions. It builds the idea of rate of change, which the next chapter turns into slope.
What a rate of change measures
A rate of change compares how much one quantity changes to how much another quantity changes. In this tutorial the two quantities are y and x. The rate of change answers one question: when x increases by 1 unit, how much does y change?
Suppose a taxi charges a fee that depends on distance. After 2 miles you owe $7. After 5 miles you owe $13. The distance changed by 3 miles. The cost changed by $6. The rate of change is
change in y / change in x = 6 dollars / 3 miles = 2 dollars per mileThe word "per" signals a rate. It joins a unit for y (dollars) to a unit for x (miles). Always carry both units. A rate of "2" is incomplete. A rate of "2 dollars per mile" can be checked against the situation.
Change is a difference
"Change in a quantity" means the new value minus the old value. For x, the change is written Δx (read "delta x"). For y, it is Δy. The rate of change is Δy / Δx.
- Δx = x₂ − x₁
- Δy = y₂ − y₁
The order matters in one respect. You must subtract in the same order for both quantities. If you take the later point minus the earlier point for y, do the same for x.
def rate_of_change(x1, y1, x2, y2):
delta_x = x2 - x1
delta_y = y2 - y1
if delta_x == 0:
raise ValueError("x did not change, so the rate is undefined")
return delta_y / delta_x
print(rate_of_change(2, 7, 5, 13)) # 2.0
print(rate_of_change(5, 13, 2, 7)) # 2.0, same result with the points swappedSwapping the points flips the sign of both Δx and Δy. The two negatives cancel in the quotient, so the rate is the same. Mixing the order, for example y₂ − y₁ over x₁ − x₂, gives the wrong sign.
Reading a table
Tables are the most common place to compute a rate of change. Each row is an ordered pair (x, y).
| Hours worked (x) | Pay in dollars (y) |
|---|---|
| 1 | 18 |
| 2 | 36 |
| 3 | 54 |
| 4 | 72 |
Between any two rows, compute Δy / Δx.
- Rows 1 and 2: (36 − 18) / (2 − 1) = 18
- Rows 2 and 4: (72 − 36) / (4 − 2) = 18
- Rows 1 and 4: (72 − 18) / (4 − 1) = 18
Every pair of rows gives 18. The rate is constant, which means it does not depend on which two rows you pick. Pay grows by $18 for each added hour.
Now compare a table where the rate is not constant.
| Seconds (x) | Distance fallen in meters (y) |
|---|---|
| 0 | 0 |
| 1 | 5 |
| 2 | 20 |
| 3 | 45 |
- From 0 to 1 second: (5 − 0) / (1 − 0) = 5 meters per second
- From 1 to 2 seconds: (20 − 5) / (2 − 1) = 15 meters per second
- From 2 to 3 seconds: (45 − 20) / (3 − 2) = 25 meters per second
The rate changes from row to row. This relationship is not linear, so no single number describes it. A line is exactly the case where the rate of change is the same everywhere.
def is_constant_rate(points):
"""points is a list of (x, y) pairs sorted by x with distinct x-values."""
rates = []
for (x1, y1), (x2, y2) in zip(points, points[1:]):
rates.append((y2 - y1) / (x2 - x1))
return all(abs(r - rates[0]) < 1e-9 for r in rates), rates
print(is_constant_rate([(1, 18), (2, 36), (3, 54), (4, 72)]))
# (True, [18.0, 18.0, 18.0])
print(is_constant_rate([(0, 0), (1, 5), (2, 20), (3, 45)]))
# (False, [5.0, 15.0, 25.0])The function compares neighboring rows only. For a table to be linear, every pair of rows must agree, and checking neighbors is enough because equal consecutive rates force equal rates across any span. This holds only when the x-values are sorted and distinct.
Rates from a graph
On a graph, Δx is a horizontal distance and Δy is a vertical distance. Pick two points you can read exactly, where the line crosses grid intersections. Count how far you move right and how far you move up or down.
- Moving right is a positive Δx. Moving left is negative.
- Moving up is a positive Δy. Moving down is negative.
Reading a rate from a graph is the geometric version of the table calculation. The next chapter names this ratio "rise over run" and calls it the slope.
Units and interpretation
The units of a rate come from the units of y divided by the units of x.
| Situation | y | x | Rate of change |
|---|---|---|---|
| Driving at constant speed | miles | hours | miles per hour |
| Filling a tank | gallons | minutes | gallons per minute |
| Hourly wage | dollars | hours | dollars per hour |
| Cooling coffee | degrees | minutes | degrees per minute |
The sign of the rate tells direction. A positive rate means y increases as x increases. A negative rate means y decreases as x increases. A rate of zero means y does not change.
Take a tank holding 40 gallons that drains. After 2 minutes it holds 34 gallons. After 6 minutes it holds 22 gallons.
- Δy = 22 − 34 = −12 gallons
- Δx = 6 − 2 = 4 minutes
- Rate = −12 / 4 = −3 gallons per minute
The negative sign is information. It says the tank is losing 3 gallons every minute. Dropping the sign would describe a tank that is filling.
Average versus constant rate
When a relationship is not linear, the quotient Δy / Δx is an average rate of change over the interval you chose. In the falling-object table, the average rate from 0 to 3 seconds is (45 − 0) / (3 − 0) = 15 meters per second. That number is a true summary of the whole interval. It does not describe the speed at any particular moment, since the object was slower at the start and faster at the end.
For a linear relationship, the average rate over any interval equals the constant rate. This is why a single number, the slope, can describe an entire line.
Common errors
- Inverting the ratio. Computing Δx / Δy gives "x per y". Check that y is on top.
- Mismatched order. Subtracting y₁ − y₂ but x₂ − x₁ flips the sign.
- Dividing by row count. Use Δx, not the number of steps.
- Dropping units. A rate without units cannot be checked against the context.
- Calling an average a constant rate. Verify that several intervals agree before saying a relationship is linear.
- Treating Δx = 0 as zero rate. If x does not change but y does, the ratio is undefined. The rate is not zero. A rate of zero needs Δy = 0 with Δx ≠ 0.
Why this leads to slope
If a relationship has a constant rate of change, its graph is a straight line. The rate tells you how steeply the line climbs or falls. The chapter on slope as rise over run uses this same ratio and gives it the letter m. Everything in the slope-intercept form y = mx + b builds on the quantity you computed here.
Exercise
A phone plan's total bill is $25 after 2 gigabytes of data and $40 after 5 gigabytes. (a) Find the rate of change with units. (b) A second table shows (1, 10), (2, 14), (4, 22), (5, 27). Is the rate constant?
Show answer
(a) Δy = 40 − 25 = 15 dollars and Δx = 5 − 2 = 3 gigabytes, so the rate is 15 / 3 = 5 dollars per gigabyte. (b) Rate from x = 1 to 2: (14 − 10) / (2 − 1) = 4. From 2 to 4: (22 − 14) / (4 − 2) = 4. From 4 to 5: (27 − 22) / (5 − 4) = 5. The rates are 4, 4, and 5, so the rate is not constant. Note that the step from 2 to 4 must be divided by 2, not 1.
Exercise
A hiker is at an elevation of 1,800 feet after 1 hour and at 1,350 feet after 4 hours. Find the rate of change and explain what its sign means.
Show answer
Δy = 1,350 − 1,800 = −450 feet and Δx = 4 − 1 = 3 hours. The rate is −450 / 3 = −150 feet per hour. The negative sign means the hiker is descending, losing 150 feet of elevation each hour.