Equation of a straight line
y
Every straight line that is not vertical is y = mx + c: m is how steep it is, c is where it crosses the y-axis.
y=7
y equals (2 times 3) plus 1, equals 6 plus 1, equals 7
Den här sidan finns på svenska. Byt till svenska
Definition — what does that mean?
Every straight line that is not vertical can be written y = mx + c. Two numbers fix the whole line.
In Swedish: Räta linjens ekvation
y
Every straight line that is not vertical is y = mx + c: m is how steep it is, c is where it crosses the y-axis.
y=7
y equals (2 times 3) plus 1, equals 6 plus 1, equals 7
You are given
m is the slope. It says how much y changes when x increases by 1. If m = 3 the line climbs three steps for every step to the right; if m = −0.5 it drops half a step. Written f(x) = mx + c, the line is the graph of a linear function.
c is the y-intercept. It is the value of y when x = 0 — where the line crosses the vertical axis.
| m | The line |
|---|---|
| m > 0 | Rises to the right |
| m = 0 | Horizontal |
| m < 0 | Falls to the right |
Two lines with the same m are parallel, or the same line if c is also equal. c only decides where on the page the line sits, not which way it leans.
The slope is the change in y divided by the change in x:
m = (y₂ − y₁) / (x₂ − x₁)
Example. The line passes through (2, 5) and (6, 13).
m = (13 − 5) / (6 − 2) = 8 / 4 = 2
Then substitute one of the points to get c: 5 = 2 · 2 + c gives c = 1. The line is y = 2x + 1.
The card above does the same thing: choose c as the unknown, enter m, x and y, and the working is shown
a step at a time.
A straight line is any situation where something increases by the same amount per step:
A straight line means the same amount per step, not the same percentage per step.
Why m and c, and not k and m?
Conventions differ by country. Swedish textbooks write the same line y = kx + m, where k is the slope
and m the intercept, so the letter m means something different there from what it means here. This
page uses m and c, as English books do; the Swedish version uses k and m.
What happens when x = 0?
Then y = c. That is the definition of the intercept: the height of the line where it crosses the
y-axis. A single point, however, says nothing about the slope, whether x is zero or not: lines of every
slope pass through one point. It takes a second one.
How do I tell whether a point lies on the line?
Substitute the point’s x into the equation and compare with its y. If they agree the point is on the
line. Is (4, 9) on y = 2x + 1? 2 · 4 + 1 = 9. Yes.
| Solve for | Rearranged | With the numbers | Comes to |
|---|---|---|---|
| m | y | 7 | 2 |
| x | y | 7 | 3 |
| c | y | 7 | 1 |
| y | mx | 2·3 | 7 |
Last reviewed October 6, 2026 ·How pages are reviewed
Sheets that ask this formula, with their answer keys. Open one to see the questions or print it.
Eight questions on the equation of a line, asking for x, y or the intercept, and eight on the slope between two points, sometimes asking for a coordinate.
Copy the code into your page where the formula card should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.