πŸ“‰
MathπŸŽ“ Ages 14-18Intermediate 12 min read

Straight-Line Graphs and Gradients

Master straight-line graphs: the equation y = mx + c, finding gradient and y-intercept, plotting lines, parallel and perpendicular lines, with fully worked examples.

Key takeaways

  • Every straight line has the equation y = mx + c, where m is the gradient and c is the y-intercept
  • Gradient m = rise Γ· run = (change in y) Γ· (change in x) = (yβ‚‚ βˆ’ y₁)/(xβ‚‚ βˆ’ x₁)
  • A positive gradient slopes up, a negative gradient slopes down, and zero gradient is horizontal
  • Parallel lines share the same gradient; perpendicular gradients multiply to βˆ’1

The equation of a straight line

Every straight (linear) graph can be written in the form:

y = mx + c

This compact equation contains everything about the line:

  • m is the gradient β€” how steep the line is.
  • c is the y-intercept β€” the y-value where the line crosses the y-axis.

If plotting points on axes is new to you, review the coordinate plane first. For the bigger picture of curves and other functions, see functions and graphs.

What gradient means

The gradient measures steepness: how far the line rises for each step it moves to the right. It is calculated as:

gradient (m) = rise / run = (change in y) / (change in x)

For two points (x₁, y₁) and (xβ‚‚, yβ‚‚), the formula is:

m = (yβ‚‚ βˆ’ y₁) / (xβ‚‚ βˆ’ x₁)

The sign of the gradient tells you the direction:

  • Positive gradient β†’ line slopes up from left to right.
  • Negative gradient β†’ line slopes down from left to right.
  • Zero gradient β†’ horizontal line.
  • Undefined gradient β†’ vertical line (the run is 0).

Worked example 1: Find the gradient of the line through (1, 2) and (4, 11).

  1. Label: (x₁, y₁) = (1, 2) and (xβ‚‚, yβ‚‚) = (4, 11).
  2. m = (yβ‚‚ βˆ’ y₁) / (xβ‚‚ βˆ’ x₁) = (11 βˆ’ 2) / (4 βˆ’ 1) = 9 / 3 = 3.
  3. The gradient is 3 β€” y rises 3 for every 1 step right.

Worked example 2: Find the gradient through (βˆ’2, 7) and (3, βˆ’3).

  1. m = (βˆ’3 βˆ’ 7) / (3 βˆ’ (βˆ’2)) = βˆ’10 / 5 = βˆ’2.
  2. The gradient is βˆ’2 β€” a downward slope.

Reading the equation

Given y = mx + c, you can describe the line instantly.

Worked example 3: Describe y = 2x βˆ’ 5.

  1. The gradient is m = 2: the line rises 2 for every 1 across (fairly steep, going up).
  2. The y-intercept is c = βˆ’5: the line crosses the y-axis at the point (0, βˆ’5).

Worked example 4: Rearrange 2x + y = 6 into y = mx + c form, then state the gradient and intercept.

  1. Subtract 2x from both sides: y = βˆ’2x + 6.
  2. Gradient m = βˆ’2 (downward), y-intercept c = 6, so it crosses at (0, 6).

Rearranging into y = mx + c is a key skill β€” it relies on the balancing methods from solving linear equations.

Plotting a line from its equation

Worked example 5: Plot y = 2x + 1.

  1. Start with the y-intercept: c = 1, so plot the point (0, 1).
  2. Use the gradient m = 2 = 2/1: from (0, 1), move 1 right and 2 up to reach (1, 3). Plot it.
  3. Repeat: from (1, 3), go 1 right and 2 up to (2, 5). Plot it.
  4. Draw a straight line through the points.

You can also build a small table of values:

xβˆ’1012
y = 2x + 1βˆ’1135

Each pair (x, y) is a point on the line. Two points are enough to draw it; a third is a useful check.

Finding the equation from a graph

Worked example 6: A line passes through (0, 4) and (2, 10). Find its equation.

  1. The point (0, 4) is on the y-axis, so the y-intercept is c = 4.
  2. Gradient m = (10 βˆ’ 4) / (2 βˆ’ 0) = 6 / 2 = 3.
  3. Equation: y = 3x + 4.

If neither point is on the y-axis, find m first, then substitute one point into y = mx + c to solve for c.

Worked example 7: A line has gradient 5 and passes through (2, 13). Find its equation.

  1. Start with y = 5x + c.
  2. Substitute the point: 13 = 5(2) + c = 10 + c, so c = 3.
  3. Equation: y = 5x + 3.

Parallel and perpendicular lines

Two facts about gradients are worth memorising:

  • Parallel lines have the same gradient. y = 3x + 1 and y = 3x βˆ’ 4 never meet.
  • Perpendicular lines have gradients that multiply to βˆ’1. So the gradient of a perpendicular line is the negative reciprocal: flip the fraction and change the sign.

Worked example 8: A line has gradient 2. Find the gradient of any line perpendicular to it.

  1. The negative reciprocal of 2 (= 2/1) is βˆ’1/2.
  2. Check: 2 Γ— (βˆ’1/2) = βˆ’1. Correct. The perpendicular gradient is βˆ’1/2.
LineGradientParallel gradientPerpendicular gradient
y = 4x + 144βˆ’1/4
y = βˆ’3x + 2βˆ’3βˆ’31/3
y = (1/2)x βˆ’ 51/21/2βˆ’2

Finding where a line crosses the axes

Two points are especially useful: where a line crosses each axis.

  • The y-intercept is found by setting x = 0. It is just the value of c.
  • The x-intercept is found by setting y = 0 and solving for x.

Worked example 9: Find where y = 2x βˆ’ 6 crosses both axes.

  1. y-intercept: set x = 0 β†’ y = 2(0) βˆ’ 6 = βˆ’6, so the line crosses the y-axis at (0, βˆ’6).
  2. x-intercept: set y = 0 β†’ 0 = 2x βˆ’ 6, so 2x = 6, x = 3. It crosses the x-axis at (3, 0).
  3. Plotting just these two points and joining them draws the whole line.

A real-world worked example

Worked example 10: A taxi charges a fixed Β£3 booking fee plus Β£2 for every mile. Write the cost as an equation and find the cost of a 7-mile trip.

  1. The Β£3 fee is the starting value, so c = 3. The Β£2 per mile is the rate of change, so m = 2.
  2. With x as miles and y as cost: y = 2x + 3.
  3. For 7 miles: y = 2(7) + 3 = 14 + 3 = Β£17.

Here the gradient is literally the price per mile and the intercept is the fixed charge β€” a perfect illustration of what m and c mean in the real world.

Where straight-line graphs are used

Straight lines model anything that changes at a constant rate. A phone plan costing Β£10 plus Β£2 per GB is y = 2x + 10. A car travelling at steady speed gives a straight distance–time graph whose gradient is the speed. Scientists fit straight lines to data to find rates; economists use them for supply and cost. The y-intercept is the starting amount and the gradient is the rate β€” this is why y = mx + c shows up everywhere from physics to business.

Why the formula works: The gradient is "rise over run" because a straight line keeps the same steepness everywhere. No matter which two points you pick, the ratio of vertical change to horizontal change is always the same β€” that constancy is exactly what makes the line straight.

Practice activity

  1. Find the gradient through (2, 3) and (6, 15).
  2. State the gradient and y-intercept of y = βˆ’4x + 7.
  3. Rearrange 3x + y = 12 into y = mx + c form.
  4. A line has gradient 3 and passes through (1, 5). Find its equation.
  5. What is the gradient of a line perpendicular to y = (1/3)x + 2?

Answers:

  1. m = (15 βˆ’ 3)/(6 βˆ’ 2) = 12/4 = 3.
  2. Gradient βˆ’4, y-intercept 7 (crosses at (0, 7)).
  3. y = βˆ’3x + 12.
  4. 5 = 3(1) + c β†’ c = 2, so y = 3x + 2.
  5. Negative reciprocal of 1/3 is βˆ’3.

Summary

Every straight line is y = mx + c, where m is the gradient (rise over run, (yβ‚‚ βˆ’ y₁)/(xβ‚‚ βˆ’ x₁)) and c is the y-intercept. Positive gradients rise, negative gradients fall, zero is horizontal. Plot a line from its intercept and gradient, or find its equation by reading off c and calculating m. Parallel lines share a gradient; perpendicular gradients multiply to βˆ’1. Because the gradient is a rate and c is a starting value, these graphs describe constant-rate situations all around us.

Quick quiz

Test yourself and earn XP

In y = mx + c, what does m represent?

Find the gradient through (1, 2) and (4, 11).

Where does y = 2x βˆ’ 5 cross the y-axis?

Which line is parallel to y = 3x + 1?

A line has gradient 2. A line perpendicular to it has gradient…

FAQ

The gradient is the rate of change β€” how much y increases for every 1 unit that x increases. A gradient of 3 means y goes up 3 each time x goes up 1. In real life it is speed, cost per item, or steepness of a hill.

Read off where it crosses the y-axis to get c, then pick two clear points to calculate the gradient m using rise over run. Put both into y = mx + c.

A horizontal line has gradient 0 (no rise). A vertical line has an undefined gradient, because the run is 0 and you cannot divide by zero β€” its equation is x = a constant.