Graphs to Linear Equations


For this topic, you need to know how to find the slope of a line from its graph.
To review the Determining Slope topic, see here.

In this topic, you will find the equation of a line based on its graph.
One way to write an equation for a straight line is the slope-intercept form:

y = mx + b     where m is the slope and b is the y-intercept
The y-intercept is the point (0, b) on the line, or the point where the line passes through the y-axis.

To find the equation of a line, follow these steps:

  1. Find the slope of the line, m.
  2. Find the y-intercept of the line, b.
  3. Plug m and b into the equation y = mx + b.


Example 1: Horizontal and Vertical Lines

Write the equation that represents this line. Examples: y=3x/4, x=2, y=1, y=2x

Horizontal Line Vertical Line
A horizontal line has zero slope, m = 0.
Horizontal lines have equations like y = b.

For this line, the line crosses the y-axis at (0, 5).
The y-intercept of the line is 5.
The equation for the line is

A vertical line has an undefined slope, m doesn't exist.
Vertical lines have equations like x = c.

There is no y-intercept for this line because it does not cross the y-axis.
The equation for the line is


Example 2: y = mx + b

Write the equation in y=mx+b format.


Step 1: Find the slope, m.
Let's pick the two points (0, 4) and (4, 1) on the line to find the slope.
m =   4 - 1  
  0 - 4  
=  3
 -4

Step 2: Find the y-intercept, b.
The line crosses the y-axis at point (0, 4) so the y-intercept is 4.

Step 3: Put m and b in the equation.
y = mx + b
y = -3 
 4
x + 4
The answer is .

Math Score homepage