Chapter 6 ยท Proportional relationships, lines, and slope

Graphing Lines and Writing Equations from Graphs

Graph a line from its equation by plotting where it crosses the vertical axis and stepping with the slope. Then read a graph to write the equation of its line.

15 min read

In the last lesson you worked with equations in slope-intercept form, y=mx+by = mx + b. You read two numbers from them: the slope mm, which is how much yy changes each time xx increases by 11, and the yy-intercept bb, which is the value of yy when x=0x = 0. The graph of an equation like this is a straight line, so it is called a linear equation.

Now you will connect those two numbers to a picture. First you will turn an equation into a graph. Then you will go the other way and turn a graph into an equation.

Every graph in this lesson is drawn on a coordinate plane. The horizontal axis shows xx and the vertical axis shows yy. Both are plain numbers with no units, and the grid lines are 11 apart.

Start with one equation: y=2x+1y = 2x + 1, where m=2m = 2 and b=1b = 1. The table that follows lists exact pairs of values that make this equation true. Look for the two numbers in it.

  • When x=0x = 0, y=1y = 1. Every point with x=0x = 0 lies on the yy-axis, so the line crosses the yy-axis at (0,1)(0, 1). That is what bb looks like on a graph.
  • Each time xx goes up by 11, yy goes up by 22. On a graph, a change in xx is a sideways move called the run, and a change in yy is an up-or-down move called the rise. Here a run of 11 to the right goes with a rise of 22 up. That is what mm looks like on a graph: m=riserun=21=2m = \frac{\text{rise}}{\text{run}} = \frac{2}{1} = 2.
Exact values for the equation y = 2x + 1
xWork for 2x + 1yPoint on the line
โˆ’1-1
2(โˆ’1)+1=โˆ’2+12(-1) + 1 = -2 + 1
โˆ’1-1
(โˆ’1,โˆ’1)(-1, -1)
00
2(0)+1=0+12(0) + 1 = 0 + 1
11
(0,1)(0, 1)
11
2(1)+1=2+12(1) + 1 = 2 + 1
33
(1,3)(1, 3)
22
2(2)+1=4+12(2) + 1 = 4 + 1
55
(2,5)(2, 5)

Key concept

One line, two facts: slope and y-intercept

Every non-vertical line (any line that is not straight up and down) has exactly one equation in slope-intercept form. The equation and the graph hold the same two facts.

  • bb is where the line crosses the yy-axis: at the point (0,b)(0, b).
  • mm is how the line moves: m=riserunm = \frac{\text{rise}}{\text{run}}, so a run of 11 to the right changes yy by mm.

Equation to graph: plot (0,b)(0, b), use the slope to step to a second point, and draw the line through both.

Graph to equation: read bb on the yy-axis, find mm from two exact points, and write the equation.

A vertical line has an undefined slope, so it has no equation of this form.

y=mx+by = mx + b

Worked example

Graph a line with a whole-number slope

Graph the line y=2x+1y = 2x + 1 on a coordinate plane. The horizontal axis shows xx, the vertical axis shows yy, both are plain numbers with no units, and the grid lines are 11 apart.

  1. Read the slope and the y-intercept from the equation. Compared with y = mx + b, the number multiplying x is m and the number added is b.

    m=2,b=1m = 2, \quad b = 1
  2. Plot the y-intercept first. When x is 0, the equation gives y = 1, so the line crosses the y-axis at the point (0, 1).

    y=2(0)+1=1y = 2(0) + 1 = 1
  3. Use the slope to step to a second point. A slope of 2 is a rise of 2 for a run of 1. From (0, 1), move 1 to the right and 2 up. You land on (1, 3).

    (0+1,1+2)=(1,3)(0 + 1, 1 + 2) = (1, 3)
  4. Check the new point. A point is on the graph exactly when its coordinates make the equation true, so substitute x = 1 and see whether y comes out as 3.

    2(1)+1=2+1=32(1) + 1 = 2 + 1 = 3
  5. Draw the straight line through (0, 1) and (1, 3). Only one straight line passes through two different points, so these two points fix the graph. Extend the line past both points, because x can be any number.

Answer

The graph of y=2x+1y = 2x + 1 is the straight line through (0,1)(0, 1) and (1,3)(1, 3). It rises 22 for every 11 it moves to the right, as the figure that follows shows.

Coordinate grid from x -6 to 6 and y -6 to 6, with a grid step of 1, showing 3 plotted elements. Details: line 2 x plus -1 y equals -1; point at (0, 1), named (0, 1); point at (1, 3), named (1, 3).
The line is y=2x+1y = 2x + 1. It crosses the yy-axis at (0,1)(0, 1), and a move of 11 right and 22 up lands on (1,3)(1, 3).

Worked example

Graph a line with a negative fraction slope

Graph the line y=โˆ’23x+4y = -\frac{2}{3}x + 4 on a coordinate plane with xx on the horizontal axis and yy on the vertical axis. Both are plain numbers with no units, and the grid lines are 11 apart.

  1. Read the slope and the y-intercept from the equation. The slope is negative, so y goes down as x goes up.

    m=โˆ’23,b=4m = -\frac{2}{3}, \quad b = 4
  2. Plot the y-intercept. When x is 0, y is 4, so the line crosses the y-axis at (0, 4).

    y=โˆ’23(0)+4=4y = -\frac{2}{3}(0) + 4 = 4
  3. Read the slope as rise over run, with the negative sign on the rise: a run of 3 to the right goes with a rise of -2, which is 2 down. A run of 3 lands exactly on a grid point. From (0, 4), move 3 right and 2 down to (3, 2).

    (0+3,4โˆ’2)=(3,2)(0 + 3, 4 - 2) = (3, 2)
  4. Check (3, 2) in the equation. Two-thirds of 3 is 2, so the product is -2, and -2 + 4 = 2. The point is on the line.

    โˆ’23(3)+4=โˆ’2+4=2-\frac{2}{3}(3) + 4 = -2 + 4 = 2
  5. Take the same step again for a third point: 3 right and 2 down from (3, 2) is (6, 0). Check it the same way.

    โˆ’23(6)+4=โˆ’4+4=0-\frac{2}{3}(6) + 4 = -4 + 4 = 0
  6. Draw the straight line through (0, 4), (3, 2) and (6, 0). All three points make the equation true, so this line is the graph. Extend it in both directions.

Answer

The graph of y=โˆ’23x+4y = -\frac{2}{3}x + 4 is the straight line through (0,4)(0, 4), (3,2)(3, 2) and (6,0)(6, 0). It falls 22 for every 33 it moves to the right, as the figure that follows shows.

Coordinate grid from x -4 to 8 and y -4 to 8, with a grid step of 1, showing 5 plotted elements. Details: line 2 x plus 3 y equals 12; point at (0, 4), named (0, 4); point at (3, 2), named (3, 2); point at (6, 0), named (6, 0); point at (-3, 2), named Point A.
The line is y=โˆ’23x+4y = -\frac{2}{3}x + 4. Steps of 33 right and 22 down go from (0,4)(0, 4) to (3,2)(3, 2) to (6,0)(6, 0). Point A at (โˆ’3,2)(-3, 2) is off the line; the note after this figure explains why.

Now reverse the process. The graph of a non-vertical line shows the same two facts, so you can read them and write the equation.

  • Find bb. Look at the point where the line crosses the yy-axis. That point is (0,b)(0, b). In this lesson the crossing is always a point you can read exactly.
  • Find mm. Choose two points on the line whose coordinates you know exactly. Divide the change in yy by the change in xx, subtracting in the same order both times. The change in xx is not 00, because the line is not vertical. On a non-vertical line, any two different points give the same slope, so pick the two that are easiest to read.

Trust coordinates, not looks. A line can seem steep or flat, but only exact points give exact values of mm and bb. Try it with the line in the figure that follows.

Coordinate grid from x -6 to 6 and y -6 to 6, with a grid step of 1, showing 4 plotted elements. Details: line 3 x plus -4 y equals 8; point at (0, -2), named Point B; point at (4, 1), named Point C; point at (-4, -5), named Point D.
The line passes through Point B at (0,โˆ’2)(0, -2), Point C at (4,1)(4, 1) and Point D at (โˆ’4,โˆ’5)(-4, -5).

Worked example

Write the equation of a line from its graph

The figure before this example shows a line on a coordinate plane with xx on the horizontal axis and yy on the vertical axis. Both are plain numbers with no units, and the grid lines are 11 apart. The line passes through Point B at (0,โˆ’2)(0, -2) and Point C at (4,1)(4, 1). Write the equation of the line in slope-intercept form.

  1. Read the y-intercept. Point B has an x-coordinate of 0, so it is the point where the line crosses the y-axis. Its y-coordinate is b.

    b=โˆ’2b = -2
  2. Find the slope from Point B to Point C. On the graph you move 4 to the right and 3 up. In symbols, subtract the coordinates of B from the coordinates of C, in the same order on top and bottom. Subtracting -2 is the same as adding 2.

    m=1โˆ’(โˆ’2)4โˆ’0=1+24=34m = \frac{1 - (-2)}{4 - 0} = \frac{1 + 2}{4} = \frac{3}{4}
  3. Put m and b into y = mx + b. Adding -2 is the same as subtracting 2.

    y=34x+(โˆ’2)=34xโˆ’2y = \frac{3}{4}x + (-2) = \frac{3}{4}x - 2
  4. Check with a point you have not used yet. Point D is at (-4, -5). Substitute x = -4 into your equation and see whether y comes out as -5. Three-fourths of -4 is -3.

    34(โˆ’4)โˆ’2=โˆ’3โˆ’2=โˆ’5\frac{3}{4}(-4) - 2 = -3 - 2 = -5

Answer

The equation of the line is y=34xโˆ’2y = \frac{3}{4}x - 2. Its slope is 34\frac{3}{4} and its yy-intercept is โˆ’2-2. Because bb is not 00, the line does not pass through the origin, so it is linear but not proportional.

Takeaway. For any non-vertical line, the equation y=mx+by = mx + b and the graph tell you the same two facts. The yy-intercept bb gives a starting point, (0,b)(0, b). The slope mm gives the step, riserun\frac{\text{rise}}{\text{run}}. To graph a line, plot the starting point and take the step. To write an equation, read the starting point and measure the step between two exact points. Either way, test one more point in the equation to check your work.

Next, you will write a linear equation from any two points, see why lines through the origin and lines through a yy-intercept have the equations they do, and practice finding and fixing errors in linear equations.