Unit 2, lesson 13

Writing the Equation of a Line

How to write the equation of a line from a slope and a point, from two points, or from a graph, and how to move between slope-intercept, point-slope and standard form.

  • Theory part 25
  • Practice part 26
  • Functions and Lines

Theory, part 25

Practice, part 26

A question gives you a slope and one point, or two points, or a graph with its intercepts marked, and asks for the equation of the line. Each kind of information fits one form of the equation best. Pick the form that uses what you were given, then rearrange into whatever form the answer choices use.

See also Drawing Lines from Slope and Intercepts in Foundations for Calculus and Linear Functions and Constant Rate of Change in Precalculus.

Key terms

Slope-intercept form

Definition A nonvertical line in the xyxy-plane with slope mm that crosses the yy-axis at (0,b)(0, b) has the equation

y=mx+b.y = mx + b.

The number bb is the yy-intercept. Every nonvertical line has exactly one equation of this form, so two equations in slope-intercept form describe the same line only when they have the same mm and the same bb.

In plain words Start at height bb on the yy-axis, and for every step of 1 to the right, go up mm (or down, when mm is negative).

Example The line with slope 33 and yy-intercept −2-2 is y=3x−2y = 3x - 2. At x=1x = 1 it gives y=1y = 1, so the point (1,1)(1, 1) lies on it, and indeed from (0,−2)(0, -2) one step right and three steps up lands on (1,1)(1, 1).

Point-slope form

Definition The nonvertical line with slope mm through the point (x1,y1)(x_1, y_1) has the equation

y−y1=m(x−x1).y - y_1 = m(x - x_1).

A point (x,y)(x, y) is on this line exactly when it satisfies the equation. The reason is the slope formula. For x≠x1x \ne x_1 the equation says y−y1x−x1=m\frac{y - y_1}{x - x_1} = m, and the point (x1,y1)(x_1, y_1) itself satisfies it too.

In plain words You know one point and how steep the line is. Plug the point and the slope straight in, with minus signs in front of the coordinates.

Example The line through (2,5)(2, 5) with slope −3-3 is y−5=−3(x−2)y - 5 = -3(x - 2). Expanding gives y−5=−3x+6y - 5 = -3x + 6, so

y=−3x+11.y = -3x + 11.

The point still checks out, since −3(2)+11=5-3(2) + 11 = 5. Watch the signs with a negative coordinate. Through (−4,1)(-4, 1) the form reads y−1=m(x+4)y - 1 = m(x + 4).

Two-point equation

Definition The line through two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) with x1≠x2x_1 \ne x_2 has the equation

y−y1=y2−y1x2−x1 (x−x1).y - y_1 = \frac{y_2 - y_1}{x_2 - x_1}\,(x - x_1).

It is point-slope form with the slope computed from the two points. It does not matter which point you call the first one, because both give the same line. When x1=x2x_1 = x_2 the slope is undefined and the line is vertical, which is covered below.

In plain words Two points fix a line. Find the slope from them, then use either point in point-slope form.

Example Take (1,4)(1, 4) and (5,−4)(5, -4). The slope is

m=−4−45−1=−84=−2.m = \frac{-4 - 4}{5 - 1} = \frac{-8}{4} = -2.

Using (1,4)(1, 4) gives y−4=−2(x−1)y - 4 = -2(x - 1), which simplifies to y=−2x+6y = -2x + 6. Check the other point. At x=5x = 5 the line gives −10+6=−4-10 + 6 = -4, which matches.

Standard form

Definition The standard form of a line is

Ax+By=C,Ax + By = C,

where AA, BB and CC are real constants and AA and BB are not both 00. When B≠0B \ne 0 the line has slope −AB-\frac{A}{B} and yy-intercept CB\frac{C}{B}. When A≠0A \ne 0 its xx-intercept is CA\frac{C}{A}. When B=0B = 0 the line is vertical. Multiplying the whole equation by any nonzero number gives another standard form of the same line, so answer choices often clear fractions and use integers.

In plain words Both variables sit on the left and the constant sits on the right. This form makes intercepts quick to find, since you just set the other variable to 00.

Example For 3x+4y=123x + 4y = 12, setting y=0y = 0 gives x=4x = 4 and setting x=0x = 0 gives y=3y = 3. The intercepts are (4,0)(4, 0) and (0,3)(0, 3), and the slope is

−AB=−34.-\frac{A}{B} = -\frac{3}{4}.

Going the other way, the line y=−2x+6y = -2x + 6 from above becomes 2x+y=62x + y = 6 after adding 2x2x to both sides.

Vertical and horizontal lines

Definition A vertical line consists of all points with the same xx-coordinate aa, and its equation is

x=a.x = a.

Its slope is undefined, so it has no equation of the form y=mx+by = mx + b and no point-slope equation. In standard form it has B=0B = 0. A horizontal line consists of all points with the same yy-coordinate kk, its equation is y=ky = k, and its slope is 00.

In plain words If two points share an xx-coordinate, the run is zero, the slope formula breaks, and the answer is simply xx equals that number.

Example The points (3,−1)(3, -1) and (3,5)(3, 5) give a run of 3−3=03 - 3 = 0, so there is no slope to compute. The line through them is x=3x = 3. Every point on it has xx-coordinate 33, whatever its yy. The points (−2,7)(-2, 7) and (4,7)(4, 7) lie on the horizontal line y=7y = 7.

Equivalent forms of one line

Definition Two equations in xx and yy are equivalent when they have exactly the same solution set, that is the same set of points (x,y)(x, y). Adding the same expression to both sides, or multiplying both sides by the same nonzero number, turns an equation into an equivalent one. So point-slope, slope-intercept and standard form of a line are different names for one set of points.

In plain words Rearranging does not move the line. If your rearranged equation is right, every point of the original line still satisfies it. A fast way to catch a slip is to test the given point in your final equation.

Example These three equations describe the same line, the one through (2,5)(2, 5) with slope −3-3.

y−5=−3(x−2)y=−3x+113x+y=11\begin{aligned} y - 5 &= -3(x - 2) \\[0.4em] y &= -3x + 11 \\[0.4em] 3x + y &= 11 \end{aligned}

Test (2,5)(2, 5) in the last one. The left side is 6+5=116 + 5 = 11, as it should be. A version with a sign slip, such as 3x+y=13x + y = 1, fails the test right away, since 11≠111 \ne 1.

Equations from a graph or intercepts

Definition If a line crosses the xx-axis at (p,0)(p, 0) and the yy-axis at (0,q)(0, q) with p≠0p \ne 0, then its slope is

m=q−00−p=−qp,m = \frac{q - 0}{0 - p} = -\frac{q}{p},

and its slope-intercept form is y=−qpx+qy = -\frac{q}{p}x + q. From any graph, read two points whose coordinates are exact, usually intercepts or grid crossings, and use the two-point equation.

In plain words Intercepts are two free points. The yy-intercept even hands you bb directly, so only the slope is left to find.

Example A graph shows a line through (4,0)(4, 0) and (0,−6)(0, -6). The slope is

m=−6−00−4=32,m = \frac{-6 - 0}{0 - 4} = \frac{3}{2},

and the yy-intercept is −6-6, so the line is y=32x−6y = \frac{3}{2}x - 6. Multiplying by 22 and rearranging gives the standard form 3x−2y=123x - 2y = 12. Both intercepts check, since 3(4)−0=123(4) - 0 = 12 and 0−2(−6)=120 - 2(-6) = 12. In the Desmos graphing calculator you can type the equation and see that the graph passes through both marked points.

Check yourself

  1. A line in the xyxy-plane passes through (2,−1)(2, -1) and (6,7)(6, 7). Which equation defines the line? (A) y=2x−5y = 2x - 5 (B) y=2x−3y = 2x - 3 (C) y=12x−2y = \frac{1}{2}x - 2 (D) y=2x+3y = 2x + 3
Show the answer

The answer is (A). The slope is

7−(−1)6−2=84=2,\frac{7 - (-1)}{6 - 2} = \frac{8}{4} = 2,

and y+1=2(x−2)y + 1 = 2(x - 2) gives y=2x−5y = 2x - 5. Both points check, since 4−5=−14 - 5 = -1 and 12−5=712 - 5 = 7. Choice (B) comes from writing y−1y - 1 instead of y+1y + 1, and it gives 11 at x=2x = 2. Choice (C) uses run over rise and misses (6,7)(6, 7). Choice (D) comes from pairing x=2x = 2 with y=7y = 7 in y−7=2(x−2)y - 7 = 2(x - 2), and it misses both points.

  1. In the xyxy-plane, a line has xx-intercept 66 and yy-intercept −4-4. An equation of the line can be written as y=mx+by = mx + b. What is the value of mm?
Show the answer

The line passes through (6,0)(6, 0) and (0,−4)(0, -4), so

m=−4−00−6=23.m = \frac{-4 - 0}{0 - 6} = \frac{2}{3}.

Enter 2/32/3, or a decimal such as .6666.6666 or .6667.6667. A negative answer usually means the order of the coordinates was mixed up in the numerator or the denominator.

  1. Line ℓ\ell has slope −23-\frac{2}{3} and passes through (3,1)(3, 1). Which equation defines ℓ\ell? (A) 2x+3y=92x + 3y = 9 (B) 2x−3y=32x - 3y = 3 (C) 3x+2y=113x + 2y = 11 (D) 2x+3y=32x + 3y = 3
Show the answer

The answer is (A). Point-slope form gives y−1=−23(x−3)y - 1 = -\frac{2}{3}(x - 3). Multiplying by 33 gives 3y−3=−2x+63y - 3 = -2x + 6, so 2x+3y=92x + 3y = 9. Its slope is −23-\frac{2}{3}, and the point checks, since 6+3=96 + 3 = 9. Choices (B) and (C) also pass through (3,1)(3, 1), but their slopes are 23\frac{2}{3} and −32-\frac{3}{2}. Choice (D) has the right slope but comes from moving the −3-3 across as 6−36 - 3 instead of 6+36 + 3, and it gives 9≠39 \ne 3 at the point.

How this lesson connects