Chapter 3 ยท Parallel and Perpendicular Lines

Writing Equations of Lines

You will write the equation of a line from a slope and a point or from two points, using slope-intercept form and point-slope form.

20 min read

You can already find the slope of a line from two points. In this lesson, you use that slope to write the line's equation.

An equation of a line is an equation in xx and yy whose solutions are exactly the points on that line. This definition works in both directions: a point on the line makes the equation true, and a point that makes the equation true is on the line.

Remember that slope is the change in yy over the change in xx, for a nonzero change in xx. A vertical line, where every point has the same xx-coordinate, has undefined slope, because its change in xx is 00 and you cannot divide by 00. Any other line is nonvertical, and any two of its points give the same slope. A horizontal line, where every point has the same yy-coordinate, is nonvertical and has slope 00, because its change in yy is 00.

Key concept

A slope and a point fix a nonvertical line

Through a given point, exactly one line has a given slope. So a slope mm and a known point (x1,y1)(x_1, y_1) fix one nonvertical line. The small 11 just marks the known point. Let (x,y)(x, y) stand for any other point with xโ‰ x1x \ne x_1. That point is on the line exactly when the slope from (x1,y1)(x_1, y_1) to (x,y)(x, y) equals mm. The two equation forms in this lesson both write this fact in algebra. A vertical line has undefined slope, so this idea does not apply to it, and it needs a different kind of equation.

yโˆ’y1xโˆ’x1=m,xโ‰ x1\frac{y - y_1}{x - x_1} = m, \quad x \ne x_1

The y-intercept of a line is the yy-coordinate of the point where the line crosses the yy-axis, the point with x=0x = 0. Every nonvertical line crosses the yy-axis exactly once.

Given: a nonvertical line has slope mm and yy-intercept bb, so (0,b)(0, b) is on it. Take any other point (x,y)(x, y) on the line. Because the line is nonvertical, no two of its points share an xx-coordinate, so xโ‰ 0x \ne 0. The definition of slope gives yโˆ’bxโˆ’0=m\frac{y - b}{x - 0} = m, which is yโˆ’bx=m\frac{y - b}{x} = m. Multiply both sides by the nonzero number xx to get yโˆ’b=mxy - b = mx. Then add bb to both sides to get slope-intercept form, shown below. The point (0,b)(0, b) satisfies it too, because m(0)+b=bm(0) + b = b.

So every point on the line satisfies the equation. The steps also run backward, so the converse, the statement with its two parts swapped, holds too: a point that satisfies the equation is on the line.

When you know the slope and one point, substitute them into this form and solve for bb.

y=mx+b(nonverticalย linesย only)y = mx + b \quad \text{(nonvertical lines only)}

Worked example

From a slope and a point

Given: a line has slope 22 and passes through (3,1)(3, 1). Find: its equation in slope-intercept form.

  1. A line with a defined slope is nonvertical, so slope-intercept form applies. Put the given slope, 2, in place of m.

    y=2x+by = 2x + b
  2. The point (3, 1) is on the line. By the definition of an equation of a line, its coordinates make the equation true. Substitute 3 for x and 1 for y.

    1=2(3)+b1 = 2(3) + b
  3. Multiply 2 by 3, following the order of operations.

    1=6+b1 = 6 + b
  4. Subtract 6 from both sides, using the subtraction property of equality, so that b stands alone.

    1โˆ’6=6+bโˆ’6,ย soย โˆ’5=b1 - 6 = 6 + b - 6, \text{ so } -5 = b
  5. Put -5 in place of b. Adding -5 is the same as subtracting 5.

    y=2x+(โˆ’5),ย soย y=2xโˆ’5y = 2x + (-5), \text{ so } y = 2x - 5
  6. Check in the other direction of the definition: a point that makes the equation true is on the line. Substituting x = 3 gives y = 1, so (3, 1) is on the line. The number multiplying x is 2, the given slope.

    2(3)โˆ’5=6โˆ’5=12(3) - 5 = 6 - 5 = 1

Answer

The equation of the line in slope-intercept form is y=2xโˆ’5y = 2x - 5.

Coordinate grid from x -2 to 6 and y -6 to 4, with a grid step of 1, showing 3 plotted elements. Details: line 2 x plus -1 y equals 5, named Line A; point at (3, 1), named Point A; point at (0, -5), named Point B.
Line A is y=2xโˆ’5y = 2x - 5. Point A is the given point (3,1)(3, 1), and Point B is (0,โˆ’5)(0, -5), the point on Line A where x=0x = 0.

In the figure above, the horizontal axis is the xx-axis and the vertical axis is the yy-axis. Line A is the line y=2xโˆ’5y = 2x - 5. Point A is the given point (3,1)(3, 1). Point B is (0,โˆ’5)(0, -5), because x=0x = 0 gives y=2(0)โˆ’5=โˆ’5y = 2(0) - 5 = -5. So b=โˆ’5b = -5 is the yy-coordinate at x=0x = 0, while the given point's yy-coordinate is 11.

The slope matches too. From Point B to Point A, the change in yy is 1โˆ’(โˆ’5)=61 - (-5) = 6 and the change in xx is 3โˆ’0=33 - 0 = 3, so the slope is 63=2\frac{6}{3} = 2. These facts come from the stated coordinates and the algebra, not from how the drawing looks.

Now suppose you know two points instead of a slope. By the postulate that through any two different points there is exactly one line, those points fix one line. A postulate is a statement accepted without proof. If the points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) have x1โ‰ x2x_1 \ne x_2, the change in xx is nonzero, so the definition of slope gives m=y2โˆ’y1x2โˆ’x1m = \frac{y_2 - y_1}{x_2 - x_1}. You then have a slope and a point, the same problem you just solved. Either given point works, because both are on the line.

Worked example

An equation through two points

Given: a line passes through (โˆ’3,5)(-3, 5) and (3,1)(3, 1). Find: its equation in slope-intercept form.

  1. The x-coordinates, -3 and 3, differ, so the change in x is nonzero and the line is nonvertical. Use the definition of slope, subtracting in the same order on the top and the bottom.

    m=1โˆ’53โˆ’(โˆ’3)=โˆ’46=โˆ’23m = \frac{1 - 5}{3 - (-3)} = \frac{-4}{6} = -\frac{2}{3}
  2. By the definition of an equation of a line, the point (-3, 5) makes y = mx + b true. Substitute the slope, -3 for x and 5 for y.

    5=โˆ’23(โˆ’3)+b5 = -\frac{2}{3}(-3) + b
  3. Multiply, keeping the fraction exact. A negative times a negative is positive.

    5=63+b,ย soย 5=2+b5 = \frac{6}{3} + b, \text{ so } 5 = 2 + b
  4. Subtract 2 from both sides, using the subtraction property of equality.

    5โˆ’2=2+bโˆ’2,ย soย 3=b5 - 2 = 2 + b - 2, \text{ so } 3 = b
  5. Put the slope and the value of b into slope-intercept form.

    y=โˆ’23x+3y = -\frac{2}{3}x + 3
  6. Check the other given point, (3, 1). Substituting x = 3 gives y = 1, so by the definition of an equation of a line, (3, 1) is on this line too.

    โˆ’23(3)+3=โˆ’2+3=1-\frac{2}{3}(3) + 3 = -2 + 3 = 1

Answer

The equation of the line through (โˆ’3,5)(-3, 5) and (3,1)(3, 1) is y=โˆ’23x+3y = -\frac{2}{3}x + 3.

Two different points can also give a slope of 00 or no slope at all, so compare their coordinates before you start. In the figure below, the horizontal axis is the xx-axis and the vertical axis is the yy-axis.

Point A at (โˆ’1,4)(-1, 4) and Point B at (3,4)(3, 4) share a yy-coordinate. Their slope is 4โˆ’43โˆ’(โˆ’1)=04=0\frac{4 - 4}{3 - (-1)} = \frac{0}{4} = 0, so Line A through them is horizontal. Substituting (3,4)(3, 4) into y=0x+by = 0x + b gives 4=0(3)+b4 = 0(3) + b, so b=4b = 4 and the equation is y=4y = 4.

Point C at (2,โˆ’1)(2, -1) and Point D at (2,3)(2, 3) share an xx-coordinate. The change in xx is 2โˆ’2=02 - 2 = 0, so the slope is undefined and Line B through them is vertical. Slope-intercept form needs a slope, so it does not apply. Every point on Line B has xx-coordinate 22, and every point with xx-coordinate 22 is on Line B, so by the definition of an equation of a line, its equation is x=2x = 2.

Coordinate grid from x -3 to 5 and y -3 to 6, with a grid step of 1, showing 6 plotted elements. Details: line 0 x plus 1 y equals 4, named Line A; line 1 x plus 0 y equals 2, named Line B; point at (-1, 4), named Point A; point at (3, 4), named Point B; point at (2, -1), named Point C; point at (2, 3), named Point D.
Line A is y=4y = 4, through Point A and Point B. Line B is x=2x = 2, through Point C and Point D.

Point-slope form writes a line's equation directly from its slope and one of its points, so you do not need to find bb.

Given: a nonvertical line has slope mm and passes through (x1,y1)(x_1, y_1). To show: a point (x,y)(x, y) is on the line exactly when it satisfies the equation displayed below.

First, take any other point (x,y)(x, y) on the line. Because the line is nonvertical, no two of its points share an xx-coordinate, so xโ‰ x1x \ne x_1. The definition of slope gives yโˆ’y1xโˆ’x1=m\frac{y - y_1}{x - x_1} = m. Multiplying both sides by the nonzero number xโˆ’x1x - x_1 gives yโˆ’y1=m(xโˆ’x1)y - y_1 = m(x - x_1). The point (x1,y1)(x_1, y_1) satisfies this too, because both sides equal 00.

For the converse, start with a point that satisfies the equation. If xโ‰ x1x \ne x_1, dividing both sides by xโˆ’x1x - x_1 shows that its slope from (x1,y1)(x_1, y_1) is mm, so the key concept puts it on the line. If x=x1x = x_1, the equation forces y=y1y = y_1, so it is the known point. A vertical line has no slope to use as mm, so this form does not apply to it.

yโˆ’y1=m(xโˆ’x1)(nonverticalย linesย only)y - y_1 = m(x - x_1) \quad \text{(nonvertical lines only)}

Worked example

Point-slope form with negative coordinates

Given: a line has slope 12\frac{1}{2} and passes through (โˆ’2,โˆ’3)(-2, -3). Find: its equation in point-slope form.

  1. A defined slope means the line is nonvertical, so point-slope form applies. Substitute the slope 1/2, the x-coordinate -2 and the y-coordinate -3, keeping each subtraction in place.

    yโˆ’(โˆ’3)=12(xโˆ’(โˆ’2))y - (-3) = \frac{1}{2}(x - (-2))
  2. By the definition of subtraction, subtracting a number means adding its opposite. So subtracting -3 means adding 3, and subtracting -2 means adding 2.

    y+3=12(x+2)y + 3 = \frac{1}{2}(x + 2)
  3. Check the given point by substituting x = -2 and y = -3. Both sides equal 0, so by the definition of an equation of a line, (-2, -3) is on the line. The number multiplying the parentheses is 1/2, the given slope.

    โˆ’3+3=0,12(โˆ’2+2)=12(0)=0-3 + 3 = 0, \quad \frac{1}{2}(-2 + 2) = \frac{1}{2}(0) = 0

Answer

The equation of the line in point-slope form is y+3=12(x+2)y + 3 = \frac{1}{2}(x + 2).

Worked example

Point-slope form from two points

Given: a line passes through (โˆ’3,2)(-3, 2) and (1,โˆ’4)(1, -4). Find: an equation in point-slope form using each point, and show that both equations describe the same line.

  1. The x-coordinates differ, so the change in x is nonzero and the line is nonvertical. Use the definition of slope.

    m=โˆ’4โˆ’21โˆ’(โˆ’3)=โˆ’64=โˆ’32m = \frac{-4 - 2}{1 - (-3)} = \frac{-6}{4} = -\frac{3}{2}
  2. Substitute the slope and the point (-3, 2) into point-slope form, then apply the definition of subtraction.

    yโˆ’2=โˆ’32(xโˆ’(โˆ’3)),ย soย yโˆ’2=โˆ’32(x+3)y - 2 = -\frac{3}{2}(x - (-3)), \text{ so } y - 2 = -\frac{3}{2}(x + 3)
  3. Do the same with the point (1, -4).

    yโˆ’(โˆ’4)=โˆ’32(xโˆ’1),ย soย y+4=โˆ’32(xโˆ’1)y - (-4) = -\frac{3}{2}(x - 1), \text{ so } y + 4 = -\frac{3}{2}(x - 1)
  4. To compare them, rewrite the first equation in slope-intercept form. Use the distributive property, then add 2 to both sides by the addition property of equality.

    yโˆ’2=โˆ’32xโˆ’92,ย soย y=โˆ’32xโˆ’92+42=โˆ’32xโˆ’52y - 2 = -\frac{3}{2}x - \frac{9}{2}, \text{ so } y = -\frac{3}{2}x - \frac{9}{2} + \frac{4}{2} = -\frac{3}{2}x - \frac{5}{2}
  5. Rewrite the second equation. Use the distributive property, then subtract 4 from both sides by the subtraction property of equality.

    y+4=โˆ’32x+32,ย soย y=โˆ’32x+32โˆ’82=โˆ’32xโˆ’52y + 4 = -\frac{3}{2}x + \frac{3}{2}, \text{ so } y = -\frac{3}{2}x + \frac{3}{2} - \frac{8}{2} = -\frac{3}{2}x - \frac{5}{2}
  6. Check both given points in the result. Each one makes the equation true.

    โˆ’32(โˆ’3)โˆ’52=92โˆ’52=2,โˆ’32(1)โˆ’52=โˆ’82=โˆ’4-\frac{3}{2}(-3) - \frac{5}{2} = \frac{9}{2} - \frac{5}{2} = 2, \quad -\frac{3}{2}(1) - \frac{5}{2} = -\frac{8}{2} = -4

Answer

Both yโˆ’2=โˆ’32(x+3)y - 2 = -\frac{3}{2}(x + 3) and y+4=โˆ’32(xโˆ’1)y + 4 = -\frac{3}{2}(x - 1) are correct, and each simplifies to y=โˆ’32xโˆ’52y = -\frac{3}{2}x - \frac{5}{2}, so they describe the same line.

Takeaway: a slope and a point fix a nonvertical line, and two points with different xx-coordinates give you that slope. You can write the line as y=mx+by = mx + b by solving for bb, or as yโˆ’y1=m(xโˆ’x1)y - y_1 = m(x - x_1) by substituting directly. If two different points share an xx-coordinate, the slope is undefined, the line is vertical, and its equation is x=cx = c, where cc is that shared coordinate. Next, you will write the equation of a line parallel or perpendicular to a given line through a point.