edubun
English
1 / 18

5 / 6 · Basic

Finding the equation of a line

Through (−2, 1) and (4, 4) there is exactly one line, and its equation is y = (1/2)x + 2.

Jump to the 10 practice questions

You will learn

  • Write a line from its slope and intercept
  • Use point-slope form, or solve for b
  • Find a line through two points

Before this: Slope-intercept form: y = mx + b

1Explain

Working backwards from the picture

So far you have started from an equation and drawn its line. This unit goes the other way: you know something about a line, such as two points on it, and you want its equation. For a line that is not vertical, find its slope m and y-intercept b, then write y = mx + b. A vertical line has an equation such as x = 3. The easiest case is when both are given. A line with slope −2 and y-intercept (0, 4) has the equation y = −2x + 4, and there is nothing to calculate.

2Problem

Slope −2, intercept 4

Which is the line with slope −2 and y-intercept (0, 4)?

Hint

y = mx + b.

Solution

Answer: y = −2x + 4

Put m = −2 and b = 4 into y = mx + b.

3Explain

A slope and any point: point-slope form

Often the point you know is not on the y-axis. Suppose the slope is 2/3 and the line passes through (3, 1). Any other point (x, y) on the line must make the same slope with (3, 1), so (y − 1)/(x − 3) = 2/3. Multiply both sides by (x − 3) and you get y − 1 = (2/3)(x − 3). In general this is the point-slope form, y − y₁ = m(x − x₁), where (x₁, y₁) is the known point. To reach slope-intercept form, distribute and add: y − 1 = (2/3)x − 2, so y = (2/3)x − 1.

4Explore

Solve for b

A shortcut gives the same result: put the point into y = mx + b and solve for b. With m = 2/3 and the point (3, 1): 1 = (2/3)(3) + b, so 1 = 2 + b and b = −1. Either way, check by substituting the known point into your final equation. (2/3) × 3 − 1 = 1, which matches the point. Watch the signs in point-slope form. For the point (−4, 2) the form reads y − 2 = m(x + 4), because x − (−4) is x + 4.

Set the slope and a point: b = y − m·x moves the line so it passes through the point.

−6−6−4−4−2−2224466
b = y − m·x2
equationy = (1/2)x + 2
point-slope formy − 1 = (1/2)(x + 2)

5Problem

Slope 2/3 through (3, 1)

A line has slope 2/3 and passes through (3, 1). What is b in y = mx + b?

Hint

1 = 2 + b.

Solution

Answer: −1

1 = (2/3)(3) + b = 2 + b, so b = −1.

6Problem

Point-slope form

Which is the point-slope form of the line with slope 5 through (−4, 2)?

Hint

y − y₁ = m(x − x₁).

Solution

Answer: y − 2 = 5(x + 4)

y − y₁ = m(x − x₁) with x₁ = −4: x − (−4) = x + 4.

7Explain

Two points

Given two points, find the slope first with the slope formula, then use either point as above. For (−2, 1) and (4, 4), m = (4 − 1)/(4 − (−2)) = 3/6 = 1/2. Using (−2, 1): 1 = (1/2)(−2) + b, so 1 = −1 + b and b = 2. The line is y = (1/2)x + 2. Check with the other point: (1/2)(4) + 2 = 4. It is good practice to use one point to find b and the other to check, because a slip in the slope would then show up as a mismatch.

8Problem

The slope from (−2, 1) to (4, 4)

What is the slope of the line through (−2, 1) and (4, 4)?

Hint

3 ÷ 6.

Solution

Answer: 1/2

m = (4 − 1) / (4 − (−2)) = 3/6 = 1/2.

9Problem

b for slope 1/2 through (−2, 1)

The line through (−2, 1) and (4, 4) has slope 1/2. What is b?

Hint

1 = (1/2)(−2) + b.

Solution

Answer: 2

1 = (1/2)(−2) + b = −1 + b, so b = 2. Check: (1/2)(4) + 2 = 4.

10Problem

The slope from (1, −3) to (5, 5)

What is the slope of the line through (1, −3) and (5, 5)?

Hint

8 ÷ 4.

Solution

Answer: 2

m = (5 − (−3)) / (5 − 1) = 8/4 = 2.

11Problem

b for slope 2 through (1, −3)

The line through (1, −3) and (5, 5) has slope 2. What is b?

Hint

−3 = 2 + b.

Solution

Answer: −5

−3 = 2(1) + b, so b = −5. Check: 2(5) − 5 = 5.

12Explain

Borrowed slopes

Parallel and perpendicular lines use the same steps with a slope you borrow. The line parallel to y = 3x − 1 through (1, 5) has slope 3, so 5 = 3(1) + b and b = 2: y = 3x + 2. The line perpendicular to y = 2x + 3 through (4, 1) has slope −1/2, so 1 = (−1/2)(4) + b and b = 3: y = −(1/2)x + 3. In the graph lab, drag the two points anywhere on the grid and the panel writes out both forms of the line through them.

13Problem

Parallel through (1, 5)

Which line is parallel to y = 3x − 1 and passes through (1, 5)?

Hint

Slope 3, then 5 = 3 + b.

Solution

Answer: y = 3x + 2

Slope 3; 5 = 3(1) + b gives b = 2.

14Problem

Perpendicular through (4, 1)

Which line is perpendicular to y = 2x + 3 and passes through (4, 1)?

Hint

Slope −1/2, then 1 = −2 + b.

Solution

Answer: y = −(1/2)x + 3

Slope −1/2; 1 = (−1/2)(4) + b gives b = 3.

15Problem

Horizontal through (2, −6)

Which is the equation of the horizontal line through (2, −6)?

Hint

y is always −6.

Solution

Answer: y = −6

A horizontal line has slope 0, so y is the same everywhere: y = −6.

16Explore

Two points in the lab

Loading

Drag to turn. Scroll or pinch to zoom.

The line through (−2, 1) and (4, 4). The panel shows the slope, the point-slope form using the first point, and y = mx + b.

17Explain

A point’s y is not the intercept

The y-coordinate of a known point is not automatically the intercept. That is true only when the point lies on the y-axis. Otherwise the slope accounts for the change between that point and the axis. Substituting the point into the equation keeps this distinction clear. After finding the intercept, check that the original point still satisfies the completed equation.

18

Summary

  • Find m and b, then write y = mx + b.
  • Point-slope form: y − y₁ = m(x − x₁).
  • From two points: slope first, then b from one point, check with the other.
  • Parallel lines borrow the slope; perpendicular lines use its negative reciprocal.

Next unitSolving systems by graphing
Full text · The whole lesson as one text

Working backwards from the picture

So far you have started from an equation and drawn its line. This unit goes the other way: you know something about a line, such as two points on it, and you want its equation. For a line that is not vertical, find its slope m and y-intercept b, then write y = mx + b. A vertical line has an equation such as x = 3. The easiest case is when both are given. A line with slope −2 and y-intercept (0, 4) has the equation y = −2x + 4, and there is nothing to calculate.

A slope and any point: point-slope form

Often the point you know is not on the y-axis. Suppose the slope is 2/3 and the line passes through (3, 1). Any other point (x, y) on the line must make the same slope with (3, 1), so (y − 1)/(x − 3) = 2/3. Multiply both sides by (x − 3) and you get y − 1 = (2/3)(x − 3). In general this is the point-slope form, y − y₁ = m(x − x₁), where (x₁, y₁) is the known point. To reach slope-intercept form, distribute and add: y − 1 = (2/3)x − 2, so y = (2/3)x − 1.

A shortcut gives the same result: put the point into y = mx + b and solve for b. With m = 2/3 and the point (3, 1): 1 = (2/3)(3) + b, so 1 = 2 + b and b = −1. Either way, check by substituting the known point into your final equation. (2/3) × 3 − 1 = 1, which matches the point. Watch the signs in point-slope form. For the point (−4, 2) the form reads y − 2 = m(x + 4), because x − (−4) is x + 4.

Two points

Given two points, find the slope first with the slope formula, then use either point as above. For (−2, 1) and (4, 4), m = (4 − 1)/(4 − (−2)) = 3/6 = 1/2. Using (−2, 1): 1 = (1/2)(−2) + b, so 1 = −1 + b and b = 2. The line is y = (1/2)x + 2. Check with the other point: (1/2)(4) + 2 = 4. It is good practice to use one point to find b and the other to check, because a slip in the slope would then show up as a mismatch.

Parallel and perpendicular lines use the same steps with a slope you borrow. The line parallel to y = 3x − 1 through (1, 5) has slope 3, so 5 = 3(1) + b and b = 2: y = 3x + 2. The line perpendicular to y = 2x + 3 through (4, 1) has slope −1/2, so 1 = (−1/2)(4) + b and b = 3: y = −(1/2)x + 3. In the graph lab, drag the two points anywhere on the grid and the panel writes out both forms of the line through them.

The line through (−2, 1) and (4, 4). The panel shows the slope, the point-slope form using the first point, and y = mx + b.

The y-coordinate of a known point is not automatically the intercept. That is true only when the point lies on the y-axis. Otherwise the slope accounts for the change between that point and the axis. Substituting the point into the equation keeps this distinction clear. After finding the intercept, check that the original point still satisfies the completed equation.

Key points
  • Find m and b, then write y = mx + b.
  • Point-slope form: y − y₁ = m(x − x₁).
  • From two points: slope first, then b from one point, check with the other.
  • Parallel lines borrow the slope; perpendicular lines use its negative reciprocal.

Practice questions from Finding the equation of a line on edubun

Embed this quiz

Free to embed. Please keep the credit line.

Sources for this course (6)
  • OpenStax, Elementary Algebra 2e , chapter 4 Graphs: 4.1 Use the Rectangular Coordinate System (quadrants numbered from the upper right, counterclockwise; ordered pairs: openstax.org/books/elementary-algebra-2e/pages/4-1-use-the-rectangular-coordinate-system)
  • 4.2 Graph Linear Equations in Two Variables, 4.3 Graph with Intercepts, 4.4 Understand Slope of a Line (m = rise/run, horizontal 0, vertical undefined, roof pitch, road grade as a percent, wheelchair ramp 1-inch rise per 12-inch run: .../pages/4-4-understand-slope-of-a-line)
  • 4.5 Use the Slope-Intercept Form (x + 2y = 6, F = 9/5 C + 32, parallel lines same slope, perpendicular slopes multiply to −1: .../pages/4-5-use-the-slope-intercept-form-of-an-equation-of-a-line)
  • 4.6 Find the Equation of a Line (point-slope form: .../pages/4-6-find-the-equation-of-a-line)
  • 5.1 Solve Systems of Equations by Graphing (3x − y = 7, x − 2y = 4 and (2, −1); consistent, inconsistent, independent, dependent, coincident lines: .../pages/5-1-solve-systems-of-equations-by-graphing)
  • MacTutor, University of St Andrews, René Descartes biography (La Géométrie, published at Leiden in 1637 as an appendix to the Discours de la méthode: mathshistory.st-andrews.ac.uk/Biographies/Descartes).

Checked: 2026-10-17