Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Straight lines, slope, and intercept

~20 min

The graph of f(x) = 2x + 3 came out as a straight path. That is no accident. Any rule of the shape "multiply by something, then add something" draws a straight line, and a straight line is described completely by just two numbers. Why do we care? Because the first model this course ever builds, in Chapter 1, is a straight line laid through a cloud of dots. Knowing what its two numbers mean, and how to find them, is most of that chapter.

Back on the tiled kitchen floor, lay a taut string from one wall toward the other. That string is a straight line. Only two facts describe it. How high up the left wall does it start? And for every tile you walk to the right, how many tiles does it climb? The starting height is the intercept, written b. The climb per tile is the slope, written m. Math packs both into one label, y = mx + b: "height equals climb-per- tile times tiles-walked, plus the starting height."

For the string y = 2x + 1, the start is 1 tile up and the climb is 2 tiles per step. Walk 0 tiles: height 1. Walk 1: height 3. Walk 2: height 5. A negative slope is a string that sags downward as you walk. A zero slope is a string held level.

If you only know two spots the string passes through, you can still find the climb. Count how many tiles higher the second spot is, and how many tiles farther across it is, then divide: "rise over run." From (0, 1) to (2, 5) the string rises 4 tiles over 2 tiles of walking, so it climbs 2 per tile. Subtract the second spot minus the first on top, and the same way on the bottom. Swap the order on only one of them and the climb comes out with the wrong sign.

Take y = 2x + 1. Input 0 gives 1. Input 1 gives 3. Input 2 gives 5. Each time x grows by 1, y grows by 2. Always 2, never more, never less.

A straight line is a graph that rises (or falls) by the same amount for every one-step move to the right. The slope is that amount: the change in y for each single step in x. The intercept is the height at which the line crosses the y-axis, which is the value of y when x = 0.

Every straight line that is not vertical can be written y = mx + b. Here m is the slope, the "how steep." b is the intercept, the "where it starts." For y = 2x + 1: m = 2 and b = 1. Check: at x = 0, y = 2(0) + 1 = 1, so the line crosses the y-axis at height 1. One step right, at x = 1, gives y = 3, two higher. A negative slope means the line falls as you move right: y = -x + 4 drops by 1 per step. A slope of 0 is a flat line.

To find the slope from two points (x_1, y_1) and (x_2, y_2), divide the change in height by the change in position: m = \frac{y_2 - y_1}{x_2 - x_1}, \qquad \text{"rise over run."} From (0, 1) and (2, 5): m = \dfrac{5 - 1}{2 - 0} = \dfrac{4}{2} = 2. Subtract in the same order on the top and the bottom. Mixing the orders flips the sign. Once m is known, plug either point into y = mx + b and solve for b.

Two lines with different slopes cross exactly once. The crossing is the one input where both rules give the same output. Solving 2x + 1 = -x + 4 gives 3x = 3, so x = 1 and y = 3: the lines cross at (1, 3).

Draw y = 2x + 1

Drag the two handles so the line starts at height 1 on the y-axis and climbs 2 for every step to the right. It should pass through (0, 1), (1, 3), and (2, 5). Then press Check.

Loading interactive…

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

What this task checks

Structure checked automatically. Whether your ideas are convincing isn't graded, so reread with the checklist.

The compiler says

A model answer

Correct answer

Also accepted:

Why

Why

The intercept 1 is where the line crosses the y-axis, at (0, 1). The slope 2 is the climb per step right, so from (0, 1) the next lattice point is (1, 3), then (2, 5).

One knob for steepness, one knob for the start

The graph starts as y = 2x + 1. Move only the m slider and watch the line tilt around its starting point. Then move only b and watch the whole line slide up and down without tilting. Try a negative m last.

Loading interactive…

Find the line these five dots sit on

These five dots all lie on one straight line. Turn the two sliders until the error readout drops to exactly 0, then read off the slope and intercept you found. Before you start, look at how much the dots climb per step and guess both numbers.

Loading interactive…

Worked example

Basic: read m and b, then make the table

  1. 1

    For the line y = 2x + 1, state the slope and the intercept, and list the points at x = 0, 1, 2.

  2. 2

    Match the shape y = mx + b: the number multiplying x is m = 2, the number added on is b = 1.

    slope 2, intercept 1

  3. 3

    Plug in x = 0: y = 2(0) + 1 = 1. Plug in x = 1: y = 3. Plug in x = 2: y = 5.

  4. 4
    \boxed{(0, 1),\ (1, 3),\ (2, 5)}

    Each step right adds exactly 2 to the height. That constant 2 is the slope showing up in the table.

Worked example

Typical: the line through (1, 3) and (4, 9)

  1. 1

    A straight line passes through (1, 3) and (4, 9). Find its slope, its intercept, and its equation.

  2. 2

    Slope first. Call (1, 3) the first point and (4, 9) the second: m = \frac{9 - 3}{4 - 1} = \frac{6}{3} = 2.

  3. 3

    Now the intercept. Put m = 2 and the point (1, 3) into y = mx + b: 3 = 2(1) + b, \qquad \text{so } b = 1.

    either point works; the other gives 9 = 8 + b, the same b

  4. 4
    \boxed{y = 2x + 1}

    Check with the point not yet used: 2(4) + 1 = 9. It lands on (4, 9).

Worked example

Common trap: subtracting in two different orders

  1. 1

    Using the points (1, 3) and (4, 9), a student computes the slope as \dfrac{9 - 3}{1 - 4}. What do they get, and what went wrong?

  2. 2

    The arithmetic: \dfrac{9 - 3}{1 - 4} = \dfrac{6}{-3} = -2. A negative slope, so a line that falls to the right.

    the wrong belief: "the order of subtraction doesn't matter"

  3. 3

    But look at the two points. Moving from (1, 3) to (4, 9), the height goes up. The line rises, so its slope must be positive. The top was "second minus first," the bottom was "first minus second."

  4. 4

    Use the same order in both places: m = \frac{9 - 3}{4 - 1} = \frac{6}{3} = \boxed{2,\ \text{not } -2} A quick sign check saves the calculation: if the second point is higher and farther right, the slope is positive, full stop.

Where this goes next

This course, Chapter 1 and Chapter 8

Chapter 1 spends two whole sections on the two numbers from this one. "Weights: what turning one knob does" is about m, renamed the weight w. "The bias: shifting the whole answer" is about b, which keeps its letter and gets the name bias. The five used cars reappear there with the line y = -2x + 26: slope -2, so every extra 10{,}000 miles costs about \$2{,}000, and intercept 26, the price of a car with no miles at all. Chapter 8, "Slopes, derivatives, and gradients," starts from "rise over run" and asks what slope a curve has at a single point. The whole idea of a derivative is this section's m, measured on a curve that is not straight.

🧪 Computational Laboratory Run it

Draw y = 2x + 1 and change its two numbers

The notebook plots y = 2x + 1 through (0, 1), (1, 3), (2, 5), then changes m, changes b, and flips the slope negative. Same numbers as the lesson.

Runs in your browser through Google Colab, nothing to install. Or download it and open it in Jupyter.

Check your understanding (counts toward your progress)

For the line y = 3x - 2, what is the intercept, its height at x = 0?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

At x = 0, y = 3(0) - 2 = -2. The line crosses the y-axis 2 below the origin.

Correct answer

Also accepted:

Why

Drag the line so that it is y = -x + 4: it should cross the y-axis at 4 and drop 1 for each step right.

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

What this task checks

Structure checked automatically. Whether your ideas are convincing isn't graded, so reread with the checklist.

The compiler says

A model answer

Why

Start at (0, 4). One step right drops to (1, 3), and another to (2, 2).

Correct answer

Also accepted:

Why

Which line falls as you move to the right?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

The slope here is +3. The -5 is the intercept, which only sets the starting height.

A slope of 0 is a flat line: it neither rises nor falls.

Slope +3 rises. Both numbers in this line are positive.

Why

Rising or falling is decided by the sign of the slope alone. Only y = -3x + 5 has a negative slope.

Check your understanding (counts toward your progress)

A line has slope 3 and passes through (2, 9). What is its intercept?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

Plug into y = mx + b: 9 = 3(2) + b, so b = 3.

Correct answer

Also accepted:

Why

Find the slope of the line through (0, 2) and (3, 11).

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

Rise over run: (11 - 2)/(3 - 0) = 9/3 = 3.

Correct answer

Also accepted:

Why

Practice: Slope and intercept, from reading them off to finding them (5 problems · doesn’t affect your progress)

In y = mx + b, which number tells you how steep the line is?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

The slope m is the climb per step to the right. The intercept b only sets where the line starts on the y-axis.

m, the slope.

For y = 4x - 7, what is the height at x = 0?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

At x = 0 the 4x part vanishes, leaving the intercept -7.

Correct answer

Also accepted:

Why

-7

Compute the slope of the line through (2, 5) and (6, 17).

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

(17 - 5)/(6 - 2) = 12/4 = 3.

Correct answer

Also accepted:

Why

3

Work out the slope of the line through (0, 6) and (4, 0).

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

(0 - 6)/(4 - 0) = -6/4 = -1.5. The line drops as it goes right, so the slope is negative.

Correct answer

Also accepted:

Why

-1.5

A line passes through (2, 5) and (6, 17). Write y as an expression in x of the form mx + b.

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Any equivalent form counts — 2x+3, 3 + 2·x, … Use the keypad below the field for fractions, roots, and other symbols.

Why

The slope is 3. Then 5 = 3(2) + b gives b = -1, so y = 3x - 1. Check: 3(6) - 1 = 17.

Correct answer

Also accepted:

Why

3*x - 1

Feeling good about this section?

Take the section quiz

Every answer gets a full explanation at the end.

Graph settings

Calculator

Sign in to save highlights

Insert an equation

  • No matches.