Graphing linear equations (straight-line graphs)
Graphing linear equations means drawing the straight line that every solution of the equation lies on. The quickest way is to write the equation as y = mx + b: plot the y-intercept b on the y-axis, then use the slope m, the rise over the run, to step to a second point, and join them with a ruler. In the UK the same equation is written y = mx + c, and the slope is called the gradient.
What makes an equation linear?
A linear equation has x and y only to the power 1: no x², no √x, no x in a denominator, and x and y are never multiplied together. Its graph is always a straight line, because y changes by the same amount every time x goes up by 1. That fixed rate of change is the slope.
| Form | Equation | What you can read off |
|---|---|---|
| Slope-intercept | y = mx + b | Slope m and y-intercept (0, b) |
| Point-slope | y − y₁ = m(x − x₁) | Slope m and one point (x₁, y₁) |
| Standard | Ax + By = C | Both intercepts, quickly |
All three describe the same lines, and you can rearrange any one into another. The point-slope form and standard form guides go into each in more depth.
Slope and intercepts
The slope measures steepness: how far the line rises for each step to the right. Between two points (x₁, y₁) and (x₂, y₂):
- A positive slope goes up from left to right; a negative slope goes down.
- A bigger number, positive or negative, means a steeper line.
- The y-intercept is where the line crosses the y-axis, so x = 0 there.
- The x-intercept is where it crosses the x-axis, so y = 0 there.
Try reading a slope from a graph, then press Mark to check it in the course:
Compute the slope through two plotted points, typed as a fraction or decimal.
Press Mark to have your answer marked in the Graphing Functions course.
Method 1: graph from the slope and y-intercept
Use this when the equation is already y = mx + b.
Example 1: graph y = 2x − 3
- The y-intercept is b = −3, so plot (0, −3).
- The slope is m = 2, which is 2/1: up 2 for every 1 across. From (0, −3) go right 1 and up 2 to (1, −1), then again to (2, 1).
- Draw a straight line through the points and extend it across the grid.
Here x and y are the usual coordinates. Setting y = 0 gives 2x − 3 = 0, so the line crosses the x-axis at x = 1.5, which matches the graph. A fractional slope works the same way: for m = −3/4, go right 4 and down 3.
Method 2: graph from a table of values
This works for any form and is a good check. Pick three x values, work out y for each, plot the points and join them. Three points matter: if they do not line up, you have made a mistake.
| x | −1 | 0 | 1 | 2 |
|---|---|---|---|---|
| y = 2x − 3 | −5 | −3 | −1 | 1 |
Method 3: graph from the intercepts
Use this for standard form, Ax + By = C, because each intercept takes one step.
Example 2: graph 3x + 4y = 12
- Put x = 0: 4y = 12, so y = 3. Plot (0, 3).
- Put y = 0: 3x = 12, so x = 4. Plot (4, 0).
- Join the two points. The slope is −3/4: down 3 for every 4 across.
Rearranged for y, the equation is y = −0.75x + 3, which is the line drawn here, with x and y the usual coordinates.
Finding the equation from two points
Example 3: the line through (−1, 5) and (3, −3)
First the slope:
Then put one point into point-slope form and tidy up: y − 5 = −2(x + 1), so y − 5 = −2x − 2, and y = −2x + 3. Check with the other point: −2 × 3 + 3 = −3. It works. The slope calculator guide shows how to check this kind of question with a tool.
Special lines
- Horizontal lines have the form y = k, such as y = 4. The slope is 0.
- Vertical lines have the form x = k, such as x = −2. The slope is undefined, because the run is 0. A vertical line is not a function.
- Parallel lines have equal slopes, such as y = 2x + 1 and y = 2x − 5.
- Perpendicular lines have slopes that multiply to −1, such as 2 and −1/2. See perpendicular lines for more.
Common mistakes
- Swapping rise and run. The slope is the change in y over the change in x, not the other way round.
- Losing the minus sign. In y = −2x + 3 the slope is −2, so the line falls from left to right.
- Reading b from standard form. In 3x + 4y = 12 the y-intercept is 3, not 12. Rearrange first or put x = 0.
- Mixing the order of the points. If you take y₂ from the second point, take x₂ from the same point.
Common questions
How do you graph a linear equation?
What is the difference between y = mx + b and y = mx + c?
How do you find the slope of a line?
How do you know if an equation is linear?
What does the slope of a line tell you?
How many points do you need to graph a line?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Solve it
Linear Graph
Plot and analyse linear functions
Open the tool - Learn it
Graphing Functions
Graphing made easier: the patterns in numbers and functions used across STEM
Start the course - Test it
Pre-Algebra & Algebra 1
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper