Graphing a line from its equation
You have the equation of a line, such as y = 3x - 5. How do you put its line on the grid without working out a whole table of values?
Where you are 11 in Linear relationships
When you reach for it
You already know one way to draw a line from its equation: pick inputs, work out outputs, plot the points and join them, as in graphing a line from a table. That always works, but it finds points one at a time and uses none of what the equation already tells you.
An equation in the form y = mx + b shows its slope m and its y-intercept b at a glance, as slope-intercept form explains. Those two numbers are a complete set of drawing instructions: put your pencil on the y-intercept, then walk along the line by stepping out the slope.
Reach for this move whenever you have the equation of a line and want its picture: to see where two lines meet, to see how fast a quantity grows or shrinks, or to check that an equation matches a situation. Day 1 covers equations already in the form y = mx + b. Day 2 covers the rest: equations to rewrite first, lines drawn from their two intercepts, the horizontal and vertical lines y = c and x = c, and lines whose numbers are too big for an ordinary grid.
The procedure
Day 1: start at the intercept, step by the slope
Plot the y-intercept. Putting x = 0 into y = mx + b makes the mx term vanish and leaves y = b, so (0, b) is on the line, and it sits on the y-axis.
Step by the slope. Write the slope as a fraction \displaystyle m = \frac{p}{q}; a whole-number slope such as 3 is \displaystyle \frac{3}{1}. From (0, b) count q squares right and p squares up, then do it again from the new point.
Why does stepping land on the line? Move from any input x to the input x + r, a run of r. The output changes from mx + b to m(x + r) + b, and the difference is
So along this line the rise is always m times the run, wherever you start. A run of q gives a rise of \displaystyle \frac{p}{q} \cdot q = p: the run is the denominator and the rise is the numerator.
Check with a third point. Two points always fix a line, even if one of them was counted wrongly, so two points alone cannot warn you of a slip. Put a stepped point into the equation. Counting and arithmetic are two separate routes to the same point, so when they agree, both are almost certainly right. Then rule the line through the points out to the edges of the grid, since the line does not stop at the points you plotted.
Negative slopes step down. If m is negative, the rise is negative, which means moving down: m = -2 means 1 right and 2 down. A negative fraction such as \displaystyle -\frac{2}{5} can be read as \displaystyle \frac{-2}{5} (right 5, down 2) or as \displaystyle \frac{2}{-5} (left 5, up 2). Both are the same number, so both steps stay on the line.
Fractional slopes use the denominator as the run. For \displaystyle m = \frac{3}{4}, step 4 right and 3 up. Stepping 1 right and \displaystyle \frac{3}{4} up is the same ratio, but it lands between grid lines, where a point can only be guessed at. Stepping the full denominator lands on a corner of the grid. A decimal slope is turned into a fraction first: \displaystyle 0.4 = \frac{2}{5} and \displaystyle 1.5 = \frac{3}{2}.
Step backwards to stay on the grid. A run of -q goes with a rise of m \cdot (-q) = -p, so “left q, down p” is as good as “right q, up p”. When the y-intercept is near the top of the grid and the line climbs, stepping forward leaves the grid at once; step backwards instead.
Day 2: other forms, special lines and big numbers
Rewrite first. An equation such as Ax + By = C is a line, but it does not show its slope or intercept. Solve it for y: move the x term to the other side, then divide every term by the coefficient of y. Each step is done to both sides, so the new equation has exactly the same solutions as the old one, and the same line. That is why a third point can be checked in either form (Example 4).
Or use the two intercepts. Every point on the x-axis has y = 0, and every point on the y-axis has x = 0. Setting one variable to 0 in Ax + By = C removes a whole term, so each intercept takes a single division (Example 5). This form has its own lesson, standard form; here it is only a quick way to two points. It helps only when the intercepts are numbers you can place: if C is not divisible by both A and B they are fractions, and if C = 0 both intercepts are the origin, so a second point must be found another way.
Horizontal lines, y = c. This equation has no x in it. It fixes the height at c and says nothing about x, so every point at height c is a solution, and together they make the horizontal line through (0, c). It fits y = mx + b with m = 0: a rise of 0 for every run. The line y = 0 is the x-axis itself.
Vertical lines, x = c. This equation has no y. Every point with x-coordinate c is a solution, whatever its height, so the graph is the vertical line through (c, 0). It does not fit y = mx + b: between any two of its points the run is 0, and dividing by 0 gives no number, so a vertical line has no slope, as the four kinds of slope showed. There is nothing to step by; draw it straight up through (c, 0). The line x = 0 is the y-axis. Looking ahead, a vertical line gives the single input c every output at once, so it is not the graph of a function of x, which is what the vertical line test detects.
Choosing a scale for big numbers. An ordinary grid runs from about -10 to 10, and the line y = 25x - 200 crosses the y-axis at -200. Nothing forces one square to stand for one unit. Choose what a square stands for on each axis separately so that the points you need fit: 2 units per square across and 50 per square up shows both intercepts, (0, -200) and (8, 0). The slope still means rise over run in units, not squares. With these scales the slope \displaystyle 25 = \frac{50}{2} becomes “one square right, one square up”, which is why it pays to choose the scales with the slope in mind. Label the scale on each axis, or nobody can read the numbers back.
Worked examples
Day 1: a whole-number slope
Graph y = 3x - 5, and check the graph with a third point.
SolutionHere m = 3 and b = -5, so plot (0, -5) on the y-axis first.
The slope 3 is the fraction \displaystyle \frac{3}{1}: a run of 1 goes with a rise of 3. From (0, -5), move 1 right and 3 up to reach (1, -2), then 1 right and 3 up again to reach (2, 1).
Check (2, 1) by substituting: 3(2) - 5 = 6 - 5 = 1. The counted point and the computed point agree. Draw the line through the three points and extend it across the grid. It rises steeply from left to right, as a slope of 3 should.
Day 1: a negative fractional slope, stepped both ways
Graph \displaystyle y = -\frac{2}{5}x + 3.
SolutionHere \displaystyle m = -\frac{2}{5} and b = 3, so start at (0, 3).
Read the slope as \displaystyle \frac{-2}{5}: a run of 5 right goes with a rise of -2, that is 2 down. From (0, 3) that lands on (5, 1). Read it instead as \displaystyle \frac{2}{-5}: a run of 5 to the left goes with a rise of 2 up, which lands on (-5, 5).
Check both by substitution. At x = 5: \displaystyle -\frac{2}{5}(5) + 3 = -2 + 3 = 1. At x = -5: \displaystyle -\frac{2}{5}(-5) + 3 = 2 + 3 = 5. Both agree.
The run of 5 was chosen because it is the denominator. A run of 1 gives a rise of \displaystyle -\frac{2}{5} and the point \displaystyle \left(1, \frac{13}{5}\right), which sits between grid lines. The line falls gently, 2 down for every 5 across, as a slope between 0 and -1 should.
Day 1: stepping backwards to stay on the grid
Graph \displaystyle y = \frac{3}{2}x + 5 on a grid that runs from -6 to 6 on both axes.
SolutionStart at (0, 5). The slope \displaystyle \frac{3}{2} says 2 right and 3 up, but from (0, 5) that reaches (2, 8), above the top of the grid.
So step the other way. A run of -2 goes with a rise of \displaystyle \frac{3}{2}(-2) = -3: 2 left and 3 down. From (0, 5) that gives (-2, 2), then (-4, -1), then (-6, -4).
Check the last of these: \displaystyle \frac{3}{2}(-6) + 5 = -9 + 5 = -4. It agrees.
The x-intercept was not used: setting y = 0 gives \displaystyle \frac{3}{2}x = -5, so \displaystyle x = -\frac{10}{3}, which lies between grid lines. The stepped points are better for drawing, because each one is a grid corner.
Day 2: rewriting into slope-intercept form
Graph 5x + 2y = 6.
SolutionThe equation does not show its slope or intercept, so solve it for y. Subtract 5x from both sides, then divide both sides by 2, dividing every term:
Now \displaystyle m = -\frac{5}{2} and b = 3. Plot (0, 3). Step 2 right and 5 down to (2, -2), and step 2 left and 5 up from (0, 3) to (-2, 8) for a point on the other side.
Check (2, -2) in the original equation, which tests the rewrite as well as the counting: 5(2) + 2(-2) = 10 - 4 = 6. It agrees.
The intercept route would work less well here: y = 0 gives 5x = 6, so the x-intercept is \displaystyle \left(\frac{6}{5}, 0\right), a point that cannot be placed exactly.
Day 2: the two intercepts, and when they are not enough
Graph (a) 3x + 5y = 15 \qquad (b) 4x - 6y = 0
Solution(a) On the x-axis y = 0, so 3x = 15 and x = 5: the point (5, 0). On the y-axis x = 0, so 5y = 15 and y = 3: the point (0, 3).
For a third point choose x = -5: then -15 + 5y = 15, so 5y = 30 and y = 6. The point (-5, 6) is on the line through the two intercepts, which confirms them.
The intercepts also give the slope: from (0, 3) to (5, 0) the run is 5 and the rise is -3, so \displaystyle m = -\frac{3}{5}.
(b) Put y = 0: 4x = 0, so x = 0. Put x = 0: -6y = 0, so y = 0. Both intercepts are the origin, and one point does not fix a line. Choose a convenient x instead. With x = 3: 12 - 6y = 0, so y = 2, giving (3, 2). With x = -3: -12 - 6y = 0, so y = -2, giving (-3, -2) as the check. Rewritten, the equation is \displaystyle y = \frac{2}{3}x, a line through the origin with slope \displaystyle \frac{2}{3}, which agrees: 3 right, 2 up.
Day 2: a horizontal line and a vertical line
Graph 3y + 6 = 0 and x = 4 on the same grid, and find the point that lies on both.
SolutionThe first equation has no x. Solve it for y: subtract 6 from both sides, then divide by 3, to get y = -2. Every point with y-coordinate -2 satisfies it, whatever x is, so its graph is the horizontal line through (0, -2), with slope 0.
The second equation has no y. Every point with x-coordinate 4 satisfies it, so its graph is the vertical line through (4, 0). It has no slope and cannot be written as y = mx + b.
A point on both lines must have y = -2, from the first, and x = 4, from the second. There is exactly one such point, (4, -2), where the two lines cross at a right angle.
Day 2: choosing a scale for a sack of birdseed
Rashida fills her garden bird feeders from a 24-kilogram sack of birdseed, and the birds get through about 0.8 kilograms a day, so after t days she has s = 24 - 0.8t kilograms left. Choose scales for the axes, graph the equation, and find when the sack runs out.
SolutionThe s-intercept is (0, 24): the full sack. For the t-intercept put s = 0: 0.8t = 24, so t = 30, the point (30, 0). The sack runs out after 30 days.
One unit per square would need 30 squares across and 24 up. Instead let each square stand for 5 days across and 4 kilograms up, so 6 squares cover each axis.
Now read the slope against those scales. As a fraction, \displaystyle -0.8 = -\frac{4}{5}: a run of 5 days goes with a rise of -4 kilograms, which on this grid is one square right and one square down. From (0, 24) the line crosses one square diagonally every 5 days and reaches (30, 0) after 6 squares.
Check the middle point, (15, 12): 24 - 0.8(15) = 24 - 12 = 12. Halfway through, half the seed is left.
The graph is drawn only for 0 \le t \le 30. The equation is happy with t = 40, giving s = -8, but negative seed means nothing. The situation decides how much of the line is real.
Boundaries
The equation must be linear. Both methods assume the graph is a straight line, which holds when the equation can be written as Ax + By = C, with x and y each to the first power and not multiplied together. Equations such as y = x^2 or xy = 6 have curved graphs.
Slope-intercept form needs a y to divide by. Rewriting Ax + By = C as y = mx + b means dividing by B, which is possible only when B \neq 0. When B = 0 the equation is x = c, a vertical line, with no slope and no slope-intercept form.
Stepping is exact only between grid corners. If b is a fraction, (0, b) is not a grid corner. Start instead from a point whose coordinates are integers, if the line has one: the line \displaystyle y = \frac{1}{2}x + \frac{3}{2} passes through (1, 2). Some lines, such as \displaystyle y = 2x + \frac{1}{2}, pass through no grid corner at all, and then every point is placed by estimating.
The intercept method needs two different intercepts. A line through the origin has both at (0, 0). A horizontal line y = c with c \neq 0 never meets the x-axis, and a vertical line x = c with c \neq 0 never meets the y-axis.
The slope is measured in units, not squares. When the axes use different scales, a slope of 1 is not drawn at 45^\circ, and the steepness on the page depends on the scales chosen. The numbers stay correct; only the picture’s angle changes.
In a situation, only part of the line may count. A time cannot be negative and an amount left cannot fall below zero, so the graph of a model is often a piece of a line, with ends set by the situation rather than by the equation.
Where this goes next
Once you can draw any line from its equation, two lines on one grid ask where they meet. The shared point satisfies both equations at once, which is solving a system of equations by graphing. Drawing a line and shading one side of it is graphing a linear inequality.
Lines with the same slope but different intercepts are the parallel lines that never meet. The horizontal lines y = c are the constant functions, and y = x is the The identity and constant functions. Plotting a starting point and following the rule for how the output changes carries over to graphs of functions in general, and choosing scales so a situation fits the page is the first step of modeling with lines.
Exercises
Day 1: plot the intercept, then step
For each equation, give the y-intercept and two more points found by stepping, and check one of them by substitution.
- y = 4x - 6
- y = -3x + 4
- \displaystyle y = \frac{1}{2}x - 4
- \displaystyle y = -\frac{3}{2}x + 1
- \displaystyle y = \frac{5}{3}x - 2
- \displaystyle y = \frac{4}{3}x + 4, on a grid running from -6 to 6 on both axes. Which way must you step, and which points do you reach?
Day 1: check with a third point
- Which of the points (3, 1), (-3, 5) and (6, -2) lie on the line \displaystyle y = -\frac{2}{3}x + 3?
- To graph \displaystyle y = -\frac{3}{4}x - 1, Osei plotted (0, -1) and then stepped 4 right and 3 up. Which point did he reach, does it pass the substitution check, and which point should he have reached?
- Graph y = 0.75x - 3. Write the slope as a fraction first, and say where the line crosses the x-axis.
Day 2: rewrite first
Rewrite each equation in the form y = mx + b, then give the y-intercept and two more points.
- 4x + y = 7
- x - 2y = 10
- y + 4 = -2(x - 1)
Day 2: use the two intercepts
Find both intercepts and a third point as a check.
- 5x + 4y = 20
- 5x - 2y = 10
- 3x - 7y = 0
Day 2: horizontal and vertical lines
- Graph y = 4 and x = -3 on the same grid. Where do they meet, and what is the slope of each?
- Rewrite each equation and describe its graph: (a) 3x + 15 = 0 \qquad (b) 2y - 9 = 0
Day 2: choosing a scale
- Lisandro is in a lift that starts 36 meters above the ground and comes down at a steady 1.5 meters per second, so its height after t seconds is h = 36 - 1.5t. Choose scales for the axes so that the slope steps one square at a time, find when the lift reaches the ground, and find its height after 8 seconds.
- Choose a window and a scale that show both intercepts of y = 30x - 240, and give two more points that the slope steps to.
Reasoning
- Two points are enough to draw a line. Explain why a third point is still worth plotting.
- Explain why, for a line with slope \displaystyle \frac{p}{q}, stepping q left and p down lands on the line, just as stepping q right and p up does.
- Explain why the graph of y = 3 is a horizontal line and the graph of x = 3 is a vertical one, and why only one of them can be written in the form y = mx + b.
Answers
- y-intercept (0, -6); points (1, -2) and (2, 2), stepping 1 right and 4 up. Check: 4(2) - 6 = 2.
- y-intercept (0, 4); points (1, 1) and (2, -2), stepping 1 right and 3 down. Check: -3(2) + 4 = -2.
- y-intercept (0, -4); points (2, -3) and (4, -2), stepping 2 right and 1 up. Check: \displaystyle \frac{1}{2}(4) - 4 = -2.
- y-intercept (0, 1); points (2, -2) and (4, -5), stepping 2 right and 3 down, or (-2, 4) stepping the other way. Check: \displaystyle -\frac{3}{2}(4) + 1 = -5.
- y-intercept (0, -2); points (3, 3) and, stepping backwards, (-3, -7). Check: \displaystyle \frac{5}{3}(3) - 2 = 3.
- Step backwards. Forwards, 3 right and 4 up from (0, 4) gives (3, 8), off the grid. Backwards, 3 left and 4 down gives (-3, 0) and then (-6, -4). Check: \displaystyle \frac{4}{3}(-6) + 4 = -8 + 4 = -4. The point (-3, 0) is also the x-intercept.
- (3, 1) and (-3, 5) lie on it; (6, -2) does not. \displaystyle -\frac{2}{3}(3) + 3 = 1 and \displaystyle -\frac{2}{3}(-3) + 3 = 5, but \displaystyle -\frac{2}{3}(6) + 3 = -1, not -2.
- He reached (4, 2), which fails: \displaystyle -\frac{3}{4}(4) - 1 = -4, not 2. The slope is negative, so 4 right goes with 3 down, reaching (4, -4). Stepping 4 left and 3 up, to (-4, 2), also works: \displaystyle -\frac{3}{4}(-4) - 1 = 2.
- \displaystyle 0.75 = \frac{3}{4}. From (0, -3) step 4 right and 3 up to (4, 0) and (8, 3), or backwards to (-4, -6). The line crosses the x-axis at (4, 0): 0.75(4) - 3 = 0.
- y = -4x + 7, by subtracting 4x. Points (0, 7), (1, 3), (2, -1). Check in the original: 4(2) + (-1) = 7.
- \displaystyle y = \frac{1}{2}x - 5. Subtract x: -2y = -x + 10; divide every term by -2. Points (0, -5), (2, -4), (4, -3). Check: 4 - 2(-3) = 10.
- y = -2x - 2. Distribute: y + 4 = -2x + 2; subtract 4. Points (0, -2), (1, -4), (-1, 0). The original form shows (1, -4) at once, since x = 1 makes the right side 0.
- (4, 0) and (0, 5): y = 0 gives 5x = 20; x = 0 gives 4y = 20. Third point: x = 8 gives 40 + 4y = 20, so y = -5, the point (8, -5). The slope is \displaystyle -\frac{5}{4}.
- (2, 0) and (0, -5): y = 0 gives 5x = 10; x = 0 gives -2y = 10. Third point: x = 4 gives 20 - 2y = 10, so y = 5, the point (4, 5). The slope is \displaystyle \frac{5}{2}.
- Both intercepts are (0, 0), so a second point is needed: x = 7 gives 21 - 7y = 0, so y = 3, the point (7, 3). Check with (-7, -3): -21 + 21 = 0. The line is \displaystyle y = \frac{3}{7}x.
- y = 4 is horizontal through (0, 4) and x = -3 is vertical through (-3, 0). They meet at (-3, 4). The horizontal line has slope 0; the vertical line has no slope, since its run is 0.
- (a) x = -5: subtract 15, divide by 3. A vertical line through (-5, 0). (b) \displaystyle y = \frac{9}{2}: add 9, divide by 2. A horizontal line through \displaystyle \left(0, \frac{9}{2}\right), halfway between 4 and 5 on the y-axis.
- It reaches the ground at t = 24 seconds: 1.5t = 36. After 8 seconds the height is h = 36 - 12 = 24 meters. Since \displaystyle -1.5 = -\frac{6}{4}, take 4 seconds per square across and 6 meters per square up; then the line goes one square right and one square down at a time from (0, 36) to (24, 0), six squares in all, and only 0 \le t \le 24 is drawn.
- The intercepts are (0, -240) and (8, 0). One good choice: x from -2 to 10 at 2 per square, y from -300 to 120 at 60 per square. Since \displaystyle 30 = \frac{60}{2}, each step is one square right and one square up: (2, -180), (4, -120), and on to (10, 60). Check: 30(10) - 240 = 60.
- Any two points lie on some line, so a point counted wrongly still gives a straight line, just the wrong one, with nothing to show the mistake. A third point found a different way, by substituting into the equation, will miss a line drawn through a wrong point. Three points in a row is strong evidence that all three are right.
- Moving from x to x + r changes mx + b by mr. With \displaystyle m = \frac{p}{q} and r = -q, the change is \displaystyle \frac{p}{q}(-q) = -p, so q left goes with p down. The ratio \displaystyle \frac{-p}{-q} is the same number as \displaystyle \frac{p}{q}, so the step has the slope of the line and lands on it.
- y = 3 is true for every point at height 3, whatever its x-coordinate, and those points form a horizontal line. x = 3 is true for every point with x-coordinate 3, whatever its height, and those form a vertical line. y = 3 is y = 0x + 3, with slope 0. x = 3 has no y to solve for, and any two of its points have run 0, so its slope would mean dividing by 0: it has no slope and no form y = mx + b.