Jugami › Algebra › Graphing Linear Equations
Graphing Linear Equations
Coordinates, slope, intercepts and equations of lines for grades 9–10.
A taxi charges $3 to start and $2 for every mile. The cost is y = 2x + 3, where x is the number of miles. Plot the cost for 0, 1, 2, 3, 4 and 5 miles, and the points line up in a straight line. That is why equations like this are called linear.
This unit shows you how to read and draw those lines. You will learn how steep a line is (its slope), where it crosses the axes (its intercepts), and how to write the equation of a line from a graph, from a point and a slope, or from two points.
The coordinate plane
The coordinate plane is made by two number lines that cross at right angles. The horizontal one is the x-axis and the vertical one is the y-axis. They cross at the origin, (0, 0).
Every point has an ordered pair (x, y). The first number tells you how far to move left or right from the origin. The second tells you how far to move up or down. Order matters: (3, 2) and (2, 3) are different points.
The axes split the plane into four quadrants, numbered I to IV counterclockwise, starting at the top right. Points on an axis are not in any quadrant.
| Quadrant | x | y | Example |
|---|---|---|---|
| I | positive | positive | (4, 3) |
| II | negative | positive | (−3, 2) |
| III | negative | negative | (−5, −4) |
| IV | positive | negative | (2, −3) |
Your turn
Which quadrant is each point in?
(−7, 1)
(6, −0.5)
(0, −3)
Solutions of an equation in two variables
An equation like y = 2x + 1 has two variables. A solution is an ordered pair that makes the equation true when you put in its x and y. There are infinitely many solutions, and the graph of the equation is the picture of all of them.
| Point | Put it in | True? |
|---|---|---|
| (1, 3) | 3 = 2(1) + 1 | Yes: 3 = 3 |
| (−2, −3) | −3 = 2(−2) + 1 | Yes: −3 = −3 |
| (2, 4) | 4 = 2(2) + 1 | No: 4 ≠ 5 |
| (0, 1) | 1 = 2(0) + 1 | Yes: 1 = 1 |
So a point is on the line exactly when it is a solution. That gives you a quick check: if you plotted a point and it is not on your line, one of them is wrong.
Your turn
Is (3, 5) a solution of x + 2y = 13?
Is (−1, 4) a solution of y = −3x + 2?
Graphing from a table
The most direct way to graph an equation is to make a table. Choose a few values of x, work out y for each one, plot the points, and draw a line through them. Two points are enough to fix a line, but a third point is a good check.
| x | 2x − 1 | y | Point |
|---|---|---|---|
| −1 | 2(−1) − 1 | −3 | (−1, −3) |
| 0 | 2(0) − 1 | −1 | (0, −1) |
| 1 | 2(1) − 1 | 1 | (1, 1) |
| 2 | 2(2) − 1 | 3 | (2, 3) |
| 3 | 2(3) − 1 | 5 | (3, 5) |
Tip: pick x-values that make the arithmetic easy
For y = −1/2x + 3, choose x-values that are multiples of 2. Then the fraction cancels and every y is a whole number.
| x | −1/2x + 3 | y | Point |
|---|---|---|---|
| −4 | −1/2(−4) + 3 | 5 | (−4, 5) |
| −2 | −1/2(−2) + 3 | 4 | (−2, 4) |
| 0 | −1/2(0) + 3 | 3 | (0, 3) |
| 2 | −1/2(2) + 3 | 2 | (2, 2) |
| 4 | −1/2(4) + 3 | 1 | (4, 1) |
Your turn
Make a table for y = −x + 2 with x = −1, 0, 1, 2, then graph it.
Slope: rise over run
The slope of a line tells you how steep it is and which way it goes. Pick two points on the line. The rise is how far you go up (or down) from one to the other, and the run is how far you go right. Slope is rise divided by run, and it is usually called m.
For a line you can read off a grid, count squares: right is a positive run, up is a positive rise, and down is a negative rise. Here, m = rise/run = 2/3.
The slope formula
When you only have the coordinates, subtract them. For two points, (x₁, y₁) and (x₂, y₂):
m = y₂ − y₁/x₂ − x₁
The little 1 and 2 just mean “first point” and “second point”. The top is the change in y (the rise), and the bottom is the change in x (the run).
Example 1: (1, 2) and (4, 8)
Example 2: (−2, 5) and (3, −5)
Example 3: (−3, 4) and (5, 4)
Example 4: (2, −1) and (2, 6)
Example 5: (−4, −1) and (2, 3)
Either point can go first, but keep the order the same
Using (4, 8) as the first point in Example 1 gives 2 − 8/1 − 4 = −6/−3 = 2: the same slope. What you can’t do is subtract in one order on top and the other order on the bottom.
Four kinds of slope
Positive slope: the line rises from left to right.
Negative slope: the line falls from left to right.
Zero slope: the line is horizontal.
Undefined slope: the line is vertical.
Read lines from left to right, the same way you read text. A horizontal line has a rise of 0, so its slope is 0/run = 0. A vertical line has a run of 0, and division by 0 is not defined, so its slope is undefined.
Your turn
Slope through (−1, 7) and (3, −1)
Slope through (0, −3) and (6, 1)
Slope through (5, 2) and (−1, 2)
Slope-intercept form: y = mx + b
When an equation is solved for y, it looks like
y = mx + b
The number in front of x is the slope m. The number on its own, b, is the y-intercept: where the line crosses the y-axis, at (0, b). You can see why: put in x = 0, and y = m(0) + b = b.
| Equation | Slope m | y-intercept b | Crosses the y-axis at |
|---|---|---|---|
| y = 3x − 2 | 3 | −2 | (0, −2) |
| y = −x + 4 | −1 | 4 | (0, 4) |
| y = 1/2x | 1/2 | 0 | (0, 0) |
| y = 5 | 0 | 5 | (0, 5) |
| y = 4 − 2x | −2 | 4 | (0, 4) |
Watch the last two rows. In y = 5, there is no x term, so m = 0. In y = 4 − 2x, the terms are in a different order, but the slope is still the number with x: −2.
Graphing y = mx + b
- Plot the y-intercept (0, b).
- From there, use the slope as rise over run to find a second point. For a whole-number slope, write it over 1.
- Repeat once more as a check, then draw the line through the points.
Example: y = 3/4x − 2
Example: y = −3x + 2
Rewriting an equation in slope-intercept form
If the equation is not solved for y, solve it first, using the same steps as in Solving Linear Equations.
Your turn
Graph y = −1/2x + 4.
Write 3x + 4y = 8 in slope-intercept form. What are the slope and y-intercept?
Try the interactive version at jugami.com/algebra/graphing-linear-equations/
Line explorer
Change the slope and the y-intercept and watch the line move. Try a slope of 0, then negative slopes. Notice that changing b slides the line up or down without changing its steepness.
Intercepts and standard form
The x-intercept is where a line crosses the x-axis. Every point on the x-axis has y = 0, so to find it, put in y = 0 and solve. The y-intercept is where the line crosses the y-axis, so put in x = 0.
An equation like 3x + 2y = 12, with both variable terms on one side and a number on the other, is in standard form, Ax + By = C. Intercepts are the quickest way to graph it.
x-intercept: let y = 0
y-intercept: let x = 0
Example: 2x − 5y = 10
When both intercepts are the origin
For x − 3y = 0, both intercepts are (0, 0), so they give only one point. Choose another x: x = 3 gives 3 − 3y = 0, so y = 1 and the second point is (3, 1).
Your turn
Find the intercepts of 4x + 3y = 12.
Find the intercepts of 5x − 2y = −10.
Point-slope form
Suppose a line has slope m and passes through a known point (x₁, y₁). For any other point (x, y) on the line, the slope formula says y − y₁/x − x₁ = m. Multiply both sides by x − x₁ and you get point-slope form:
y − y₁ = m(x − x₁)
It is the fastest way to write an equation when you know a point and the slope.
Slope 3 through (2, 5)
Slope −2 through (−1, 4)
Slope 2/3 through (−3, −5)
Graphing from point-slope form
You don’t have to rearrange first. In y − 1 = −1/2(x − 4), the line goes through (4, 1) and the slope is −1/2. Plot the point, then go down 1 and right 2.
Watch the signs
The form has minus signs built in, so the point’s coordinates show up with the opposite sign. In y + 2 = 3(x − 1), the line goes through (1, −2), not (1, 2): y + 2 is y − (−2).
Your turn
Write the equation of the line with slope −1/3 through (6, −1) in slope-intercept form.
Writing the equation of a line
To write the equation of a line, you need its slope and one point. Every problem comes down to finding those two things.
From a graph
From a point and a slope: the plug-in method
Point-slope form works, but you can also put the point into y = mx + b and solve for b.
From two points
Find the slope with the formula first, then use either point.
(1, 5) and (3, 9)
(−2, 7) and (4, −2)
Your turn
Write the equation of this line.
Show answer
Write the equation of the line through (−3, 1) and (3, 5).
Horizontal and vertical lines
On a horizontal line every point has the same y-coordinate, so its equation is y = c for some number c. Its slope is 0. On a vertical line every point has the same x-coordinate, so its equation is x = c. Its slope is undefined, and it is the only kind of line that can’t be written as y = mx + b.
| Horizontal | Vertical | |
|---|---|---|
| Equation | y = c | x = c |
| Slope | 0 | undefined |
| Example points | (−1, 3), (4, 3) | (−2, 0), (−2, 5) |
| Crosses | the y-axis at (0, c) | the x-axis at (c, 0) |
Through (4, −1) and (4, 5)
Through (−3, 2) and (5, 2)
Your turn
Write the equations of the horizontal and the vertical line through (−6, −2).
Parallel and perpendicular lines
Parallel lines never meet, so they have the same slope (and different y-intercepts). Perpendicular lines meet at a right angle. Their slopes are opposite reciprocals: flip the fraction and change the sign. Multiply two perpendicular slopes and you always get −1.
| Slope | Parallel slope | Perpendicular slope |
|---|---|---|
| 2 | 2 | −1/2 |
| −3/4 | −3/4 | 4/3 |
| 1/5 | 1/5 | −5 |
| −1 | −1 | 1 |
| 0 | 0 | undefined (vertical) |
Parallel to y = 2x + 1 through (3, 1)
Perpendicular to y = 2/3x + 4 through (2, −1)
Parallel, perpendicular or neither?
y = 4x − 1 and y = −1/4x + 6
2x + y = 3 and y = −2x + 7
y = 3x + 2 and y = −3x + 2
Your turn
Write the equation of the line perpendicular to y = −4x + 1 through (8, 3).
Rate of change problems
In a word problem, the slope is a rate of change: how much one quantity changes for each unit of the other. Its units are “something per something”, like dollars per mile. The y-intercept is the starting value, when x = 0.
The taxi
In y = 2x + 3, the slope 2 means $2 per mile and the y-intercept 3 means $3 before you go anywhere. A 10-mile ride costs 2(10) + 3 = 23 dollars.
A growing plant
A plant is 9 cm tall after 2 weeks and 15 cm tall after 6 weeks. It grows at a steady rate. Write an equation for its height y after x weeks.
A draining tank
A tank holds 400 liters and drains at 25 liters per minute. The amount left is y = −25x + 400. The slope is negative because the amount goes down. When is it empty?
Your turn
A gym charges a $25 sign-up fee plus $15 a month. Write the cost y after x months. What do 6 months cost?
A phone battery is at 80% after 1 hour and 50% after 3 hours. Write a linear equation for the charge y after x hours.
Common mistakes
Practice problems
Try each one on paper, then open the answer to check your work.
- Which quadrant is (−4, −7) in?
Show answer
Quadrant IIIBoth coordinates are negative - Is (2, −1) a solution of 3x + 4y = 2?
Show answer
3(2) + 4(−1) = 6 − 4 = 2Put in the pointYes2 = 2 is true - Find the slope through (−3, 2) and (1, 10).
Show answer
m = 10 − 2/1 − (−3) = 8/4Slope formulam = 2 - Find the slope through (4, −2) and (−2, 1).
Show answer
m = −2 − 1/4 − (−2) = −3/6Using (−2, 1) as the first pointm = −1/2 - Find the slope through (5, −3) and (5, 4), and write the equation of the line.
Show answer
m = 7/0: undefinedThe x-coordinates are equalx = 5A vertical line - Give the slope and y-intercept of y = −4x + 7.
Show answer
m = −4The number with xy-intercept (0, 7)b = 7 - Write 6x − 3y = 9 in slope-intercept form and graph it.
Show answer
−3y = −6x + 9Subtract 6xy = 2x − 3Divide by −3 - Find the intercepts of 2x + 5y = 10 and graph the line.
Show answer
2x = 10, so x = 5x-intercept (5, 0)5y = 10, so y = 2y-intercept (0, 2) - Write and graph the line with slope −1/2 and y-intercept 3.
Show answer
y = −1/2x + 3Put m and b into y = mx + b - Write the equation of the line with slope 4 through (−2, −5).
Show answer
−5 = 4(−2) + bPlug in the pointb = 3Add 8y = 4x + 3 - Write the equation of the line through (−1, −4) and (3, 4).
Show answer
m = 4 − (−4)/3 − (−1) = 8/4 = 2Slope4 = 2(3) + bUse (3, 4)b = −2y = 2x − 2 - Write the equation of the line through (−3, 6) and (−3, −1).
Show answer
m = −7/0: undefinedSame x-coordinatex = −3A vertical line - Write the equation of the line perpendicular to y = 3x − 2 through (6, 1).
Show answer
m = −1/3Opposite reciprocal of 31 = −1/3(6) + bPut in (6, 1)b = 31 = −2 + by = −1/3x + 3 - Renting a bike for 2 hours costs $12, and for 5 hours it costs $27. Write a linear equation for the cost y of x hours, and say what the slope and y-intercept mean.
Show answer
m = 27 − 12/5 − 2 = 15/3 = 5$5 per hour12 = 5(2) + b, so b = 2A $2 fee up fronty = 5x + 2
History: who first put equations on a graph?
The idea of turning an equation into a curve, and a curve into an equation, is called analytic geometry. Two French mathematicians found it at about the same time, each without knowing about the other.
René Descartes (1596–1650) published it in 1637, in La Géométrie, one of three appendices to his famous Discourse on Method, printed in Leiden. The same book started the habit of using letters from the end of the alphabet, like x, y and z, for unknowns and letters from the start, like a, b and c, for known numbers.
Pierre de Fermat (1601–1665), a lawyer and judge in Toulouse who did mathematics in his spare time, wrote a short Introduction to Plane and Solid Loci before the spring of 1636. In it he stated the key idea: whenever an equation has two unknown quantities, “there results a locus fixed in place, and the end point of one of these unknown quantities describes a straight line or a curve.” The first case he worked out was the straight line, which in today’s notation is an equation like Dx = By. Fermat’s essay was passed around in handwritten copies and wasn’t printed until 1679, after his death.
Neither of them drew the grid on this page. They measured from one fixed line, and the perpendicular pair of axes with four quadrants came later. Still, the coordinate plane is often called the Cartesian plane, after Descartes’ Latin name, Cartesius.
Why is slope called m?
Nobody knows. The earliest known use of m for slope is by the Italian mathematician Vincenzo Riccati in 1757. In the 1840s the Irish mathematician George Salmon wrote y = mx + b, and a few years earlier Matthew O’Brien wrote y = mx + c, which is still used in Britain. The choice may have been arbitrary. Some books mention that the French verb monter means “to climb”, but there is no evidence that this is where the letter came from. Other countries use other letters: in Sweden it’s y = kx + m.
How do we know?
Descartes’ 1637 book and the 1679 printing of Fermat’s papers both survive. Fermat’s letters to mathematicians in Paris begin in the spring of 1636, and they show he had already written his essay by then, a year before Descartes’ book was printed. That is how historians know the two found the idea independently.
Try the interactive version at jugami.com/algebra/graphing-linear-equations/
Practice: Line It Up
A new problem every time, with hints, full steps and a graph of the answer. Choose a level, or mix them all. Type slopes like 2, −3/4 or undefined
, points like (4, 0), and equations like y = 2x − 3, y = −1/2x + 4, x = 5 or y = 3. Any correct form of the equation is accepted, such as y − 1 = 2(x − 2) or 2x − y = 3.
Sources
- J. J. O’Connor and E. F. Robertson, MacTutor History of Mathematics, University of St Andrews: René Descartes biography (La Géométrie as an appendix to the Discourse on Method, Leiden, 1637).
- Michael S. Mahoney, “Fermat, Pierre de”, Dictionary of Scientific Biography, hosted by MacTutor (the Introduction to Plane and Solid Loci, written before spring 1636 and printed in 1679; the quotation in the history section; his use of a single axis).
- Jeff Miller, Earliest Uses of Mathematical Symbols, hosted by MacTutor: Symbols in Geometry (m for slope: Riccati, O’Brien, Salmon, other countries’ letters, the “monter” remark) and Symbols for Variables (Descartes’ x, y, z and a, b, c).
- Common Core State Standards for Mathematics: Grade 8 Expressions and Equations (8.EE.B.6, slope and y = mx + b), Reasoning with Equations and Inequalities (A-REI.D.10, a graph is the set of all solutions), Creating Equations (A-CED.A.2), Interpreting Functions (F-IF.B.6, rate of change) and Expressing Geometric Properties with Equations (G-GPE.B.5, parallel and perpendicular slopes), which this lesson supports.
Credits: all graphs on this page are original SVG drawings made for Jugami. Every slope, intercept, equation and plotted point was checked by a script against the equation it belongs to and the graph it is drawn on.