Equation of a Line: Slope-Intercept, Point-Slope and Two Points
The equation of a line can be written in three common forms: slope-intercept y = mx + b, point-slope y − y1 = m(x − x1), and a form built from two points. In brief: the line through (1, 2) and (3, 8) has slope 3, so by point-slope form y − 2 = 3(x − 1), which simplifies to y = 3x − 1.
Which form to use depends on what you are given. If you know the slope and the y-intercept, use slope-intercept form. If you know the slope and any point, use point-slope. If you know two points, find the slope first. This guide shows each form, how to convert between them and gives a table that tells you which one to choose.
What is slope-intercept form?
The form y = mx + b shows the slope m and the y-intercept (0, b) directly. To write an equation, substitute the two numbers. A line with slope −2 and y-intercept 5 has the equation y = −2x + 5.
If the slope and one other point are known, substitute the point to find b. For m = 4 through (2, 3): 3 = 4 · 2 + b, so b = −5 and y = 4x − 5.
What is point-slope form?
The form y − y1 = m(x − x1) describes the line with slope m passing through (x1, y1). It comes from the slope formula: for any other point (x, y) on the line, (y − y1)/(x − x1) = m.
Example: slope 2/3 through (6, −1). The equation is y + 1 = (2/3)(x − 6). Expanding: y + 1 = (2/3)x − 4, so y = (2/3)x − 5. Note that y − (−1) becomes y + 1.
How do you find the equation of a line through two points?
- Compute the slope m = (y2 − y1)/(x2 − x1).
- Use point-slope form with either point.
- Simplify to y = mx + b.
- Check with the other point.
Example: (−1, 7) and (2, −2)
Slope: (−2 − 7)/(2 − (−1)) = −9/3 = −3. Using (2, −2): y + 2 = −3(x − 2), so y + 2 = −3x + 6, giving y = −3x + 4. Check with (−1, 7): −3(−1) + 4 = 7 ✓.
Example: fractional slope
Points (1, 1) and (5, 4). The slope is 3/4. Then y − 1 = (3/4)(x − 1), so y = (3/4)x + 1/4. Check: at x = 5, (15/4) + 1/4 = 4 ✓.
What is standard form?
Standard form is Ax + By = C, usually with integer coefficients and A ≥ 0. It works for every line, including vertical ones. To convert y = (3/4)x + 1/4, multiply by 4: 4y = 3x + 1, so −3x + 4y = 1 or 3x − 4y = −1. From standard form, the slope is −A/B (if B ≠ 0) and the y-intercept is C/B. The intercepts are easy to find by setting x = 0 or y = 0: for 3x + 2y = 12, the intercepts are (4, 0) and (0, 6).
Which form should you use?
| Form | Equation | Use when you know |
|---|---|---|
| Slope-intercept | y = mx + b | slope and y-intercept |
| Point-slope | y − y1 = m(x − x1) | slope and one point |
| Two-point | y − y1 = [(y2 − y1)/(x2 − x1)](x − x1) | two points |
| Standard | Ax + By = C | intercepts or integer coefficients |
| Intercept | x/a + y/b = 1 | both intercepts (a, b ≠ 0) |
What about horizontal and vertical lines?
A horizontal line through (a, k) has the equation y = k, with slope 0. A vertical line through (k, b) has the equation x = k, and its slope is undefined, so slope-intercept form cannot represent it. Two points with the same x-coordinate, such as (3, 1) and (3, 7), give the vertical line x = 3, and the slope formula fails, because the denominator is 0.
Where do line equations come from?
The idea that a line is described by an equation comes from the invention of analytic geometry in the 1630s by Pierre de Fermat and René Descartes. The forms we use today were standardised in textbooks during the following centuries, and the names slope-intercept and point-slope belong mainly to school curricula.
Where are they used today?
When two data points are known, a line equation gives a simple model for estimating values in between: a temperature of 10° at 6 a.m. and 22° at noon gives 2° per hour. With t in hours after midnight, point-slope form gives T − 10 = 2(t − 6), so T = 2t − 2. Computer graphics draw lines with such equations, and spreadsheets create trend lines. Linear interpolation in tables uses the two-point form.
Which mistakes are common?
Sign error in point-slope form
For the point (4, −3), the form is y + 3 = m(x − 4). The signs inside the brackets are opposite to the coordinates.
Wrong slope when points are listed in a different order
Use the same order of subtraction in the numerator and denominator.
Forgetting to distribute
In y − 2 = 3(x − 1), multiply both terms: 3x − 3, so y = 3x − 1, not y = 3x − 1 + 2.
Writing a vertical line as y = mx + b
Vertical lines are x = k.