Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 37 ยท Linear Functions and Graphs

Slope-Intercept Form: y = mx + b

Learn y = mx + b: read slope and y-intercept from an equation, graph a line quickly, and write an equation from a graph or two points.

The most useful way to write a line is slope-intercept form:

Text
y = mx + b

Here m is the slope and b is the y-intercept (the line crosses the y-axis at (0, b)). Two numbers describe the whole line. That is why this form is everywhere, from physics to economics.

Reading an equation

Equation Slope m y-intercept b
y = 3x + 2 3 2
y = -x + 5 -1 5
y = x/2 - 4 1/2 -4
y = 6 0 6
y = 4x 4 0

If the equation is not yet in this form, solve for y. For 2x + y = 7, subtract 2x: y = -2x + 7. For 4x + 2y = 6, subtract and divide by 2: y = -2x + 3.

Graphing in three steps

Graph y = (2/3)x - 1.

  1. Plot the y-intercept (0, -1).
  2. From there, use the slope 2/3: rise 2, run 3. Go up 2 and right 3 to reach (3, 1).
  3. Draw the line through the points (and a third one, such as (-3, -3), to check).
Python Graph y = mx + b with sliders written as a loop

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Changing b slides the line up or down. Changing m tilts it.

Writing an equation from a slope and a point

If you know m and the y-intercept, substitute. For m = -2 and b = 5: y = -2x + 5.

If you know the slope and another point, substitute the point into y = mx + b and solve for b.

Example. Slope 3 through (2, 4).

4 = 3(2) + b, so 4 = 6 + b and b = -2. The line is y = 3x - 2.

Writing an equation from two points

Example. A line through (1, 5) and (3, 11).

  • Slope: (11 - 5) / (3 - 1) = 6/2 = 3
  • Use (1, 5): 5 = 3(1) + b, so b = 2
  • Line: y = 3x + 2
  • Check with the other point: 3(3) + 2 = 11. Correct.
Python Find the line through two points

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Using the form in real problems

A streaming service charges 5 dollars to sign up and 9 dollars per month. The total after t months is C = 9t + 5. The slope 9 is the monthly rate; the intercept 5 is the starting amount (at t = 0).

The intercept in a model is the value when the input is zero, while the slope is the change per unit. When you interpret a model, say both in context: "The cost starts at 5 dollars and rises 9 dollars each month."

Common mistakes

  1. Mixing up m and b. In y = 5 - 2x the slope is -2 and the intercept is 5.
  2. Not solving for y first. In 3y = 6x + 9, divide everything: y = 2x + 3.
  3. Sign errors with the slope when going down. A negative slope means down when you go right.
  4. Forgetting to check with the second point.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What are the slope and y-intercept of y = -4x + 9?

    In y = mx + b, the coefficient of x is the slope and the constant is the y-intercept.
  2. 2. Rewrite 2x + y = 7 in slope-intercept form.

    Subtract 2x from both sides: y = -2x + 7.
  3. 3. A line has slope 2 and passes through (3, 10). What is b?

    10 = 2(3) + b gives b = 4.
  4. 4. What is the equation of the line through (0, 1) and (2, 5)?

    Slope = 4/2 = 2; the y-intercept is 1 (the point at x = 0).

Summary

  • y = mx + b: m is the slope, b the y-intercept.
  • Graph by plotting (0, b) and moving rise/run.
  • Find b from a point by substituting into y = mx + b.
  • Two points give the slope first, then b.

Next: Point-Slope and Standard Form