Skip to content

Lines: slope, equations, parallel and perpendicular

Level: 101 · for anyone starting precalculus

One line: A line has one slope, the same whichever two of its points you measure it with, because any two make similar right triangles; every equation of a line is that fact rearranged, parallel lines share it, and perpendicular lines have slopes whose product is −1 because a quarter turn sends (run, rise) to (−rise, run).

The idea

Pick two points on a non-vertical line, (x₁, y₁) and (x₂, y₂). Going from the first to the second, the run is x₂ − x₁ and the rise is y₂ − y₁, and the slope is

m = (y₂ − y₁)/(x₂ − x₁), rise over run.

The fact that makes this one number, not a number per pair of points, is geometry: any two points of the line, with the corner below one and beside the other, make a right triangle, and all those triangles have the same angles, so they are similar and share the ratio of their legs. The program checks ten pairs of points on one line and gets 2/3 ten times.

Once the slope is one number, the equation of the line follows. A point (x, y) is on the line through (x₁, y₁) with slope m exactly when its slope from (x₁, y₁) is m: (y − y₁)/(x − x₁) = m. Multiply up and that is the point-slope form, y − y₁ = m(x − x₁). Everything else in the section is this equation rearranged.

This page follows section 1.3, Lines, in Michael Sullivan's Precalculus.

The forms of the equation

Form Equation What you read off
point-slope y − y₁ = m(x − x₁) a point and the slope: the form to write first
slope-intercept y = mx + b the slope m and the y-intercept b: the form to graph
general Ax + By = C, A and B not both 0 the intercepts, by setting x = 0 or y = 0; the only form that includes vertical lines
horizontal y = b slope 0
vertical x = a slope undefined

What the slope says, and what "undefined" means

Positive slope rises from left to right; negative falls; 0 is horizontal. A slope of 3 means up 3 for every 1 across; a slope of 1/3, up 1 for every 3 across. For a vertical line the run is 0 and rise/0 is not a number: the slope is undefined. That is not the same as "zero slope", which is the horizontal line, and it is not "infinite" either: there is simply nothing to compute. A vertical line has no equation of the form y = mx + b, only x = a.

The order of the points. Either point may be first, as long as both differences start from the same one: (−3 − 2)/(5 − 1) and (2 − (−3))/(1 − 5) are both −5/4. Mixing, (−3 − 2)/(1 − 5), gives +5/4, the wrong sign. The distance formula forgave mixing because it squares; slope does not.

Parallel and perpendicular

Parallel lines, which never meet, have the same slope and different intercepts. The same slope and the same intercept is not two parallel lines but one line written twice.

Perpendicular lines, which meet at a right angle, have slopes whose product is −1: each is the negative reciprocal of the other, so 2 and −1/2, or −5/2 and 2/5. Why: turning a step of (run, rise) = (a, b) a quarter turn gives (−b, a), the rule that multiplying by i follows. The slopes are b/a and a/(−b), and their product is −1. The program also checks each right angle the old way, with the converse of Pythagoras. The rule needs both slopes to exist: a horizontal line and a vertical line are perpendicular, but the vertical one has no slope to multiply.

What the program prints

Verified output of lines_and_slope.py — regenerated by tools/run_examples.py, never hand-typed.

1. RISE OVER RUN, AND THE ORDER OF THE POINTS
   P = (1, 2), Q = (5, -3)
   (y2 - y1)/(x2 - x1), P first:  (-3 - 2)/(5 - 1) = -5/4
   (y2 - y1)/(x2 - x1), Q first:  (2 - (-3))/(1 - 5) = -5/4
   mixed order, wrong:            (-3 - 2)/(1 - 5) = 5/4
   Either point may come first, as long as both differences start from the same one.

2. ONE SLOPE FOR THE WHOLE LINE: ANY TWO POINTS OF 2x - 3y = 6
   (-3, -4)  to (0, -2)   rise  2, run  3, slope 2/3
   (-3, -4)  to (3, 0)    rise  4, run  6, slope 2/3
   (-3, -4)  to (6, 2)    rise  6, run  9, slope 2/3
   (-3, -4)  to (9, 4)    rise  8, run 12, slope 2/3
   (0, -2)   to (3, 0)    rise  2, run  3, slope 2/3
   (0, -2)   to (6, 2)    rise  4, run  6, slope 2/3
   (0, -2)   to (9, 4)    rise  6, run  9, slope 2/3
   (3, 0)    to (6, 2)    rise  2, run  3, slope 2/3
   (3, 0)    to (9, 4)    rise  4, run  6, slope 2/3
   (6, 2)    to (9, 4)    rise  2, run  3, slope 2/3
   Ten pairs, ten right triangles of different sizes, all similar: one ratio, 2/3.

3. WHAT THE NUMBER SAYS
   m =    3   rises steeply: up 3 for each 1 across
   m =  1/3   rises gently: up 1 for each 3 across
   m =    0   horizontal: no rise at all
   m =   -2   falls: down 2 for each 1 across
   vertical: the run is 0 and rise/0 is not a number. Undefined, not 0,
   and not infinity: 'no slope' means the formula has nothing to divide by.

4. THE SAME LINE IN EVERY FORM
   through (1, 2) and (5, -3):
     slope m = (-3 - 2) / (5 - 1) = -5/4
     point-slope:     y - 2 = (-5/4)(x - 1)
     slope-intercept: y = (-5/4)x + 13/4
     general form:    5x + 4y = 13
   through (-2, 4) and (3, 4):
     slope m = (4 - 4) / (3 - (-2)) = 0
     point-slope:     y - 4 = 0
     slope-intercept: y = 4
     general form:    y = 4
   through (3, -1) and (3, 7):
     run x2 - x1 = 0: slope undefined, a vertical line, x = 3
     general form:    x = 3
   through (0, 0) and (2, 1):
     slope m = (1 - 0) / (2 - 0) = 1/2
     point-slope:     y = (1/2)x
     slope-intercept: y = (1/2)x
     general form:    x - 2y = 0
   Only the general form covers the vertical line: y = mx + b needs a slope.

5. INTERCEPTS OF A LINE: 2x - 3y = 6
   y = 0: 2x = 6, x-intercept 3.   x = 0: -3y = 6, y-intercept -2.
   Solved for y: y = (2/3)x - 2. The b in y = mx + b is the y-intercept.

6. PARALLEL: SAME SLOPE, DIFFERENT INTERCEPT
   y = 2x + 1 and y = 2x - 3 never meet: 2x + 1 = 2x - 3 means 1 = -3.
   y = 2x + 1 and 4x - 2y = -2: the second is y = 2x + 1 again, the same line.

7. PERPENDICULAR: SLOPES MULTIPLY TO -1
   A quarter turn sends the step (run, rise) = (a, b) to (-b, a):
   (1,  2) -> (-2, 1):  slopes    2 and -1/2,  product -1;  Pythagoras check 5 + 5 = 10
   (3,  1) -> (-1, 3):  slopes  1/3 and   -3,  product -1;  Pythagoras check 10 + 10 = 20
   (2, -5) -> ( 5, 2):  slopes -5/2 and  2/5,  product -1;  Pythagoras check 29 + 29 = 58
   The two steps are the legs of a right triangle at the origin, and the
   converse of Pythagoras confirms the right angle: leg^2 + leg^2 = hypotenuse^2.
   Negative reciprocal: flip the fraction and change its sign. 2 -> -1/2, -5/2 -> 2/5.
   A horizontal and a vertical line are perpendicular too, but 0 has no reciprocal:
   the product rule needs both slopes to exist.

To get every form of the line through two points of your own:

python3 08_Analytic_Geometry/lines_and_slope/examples/lines_and_slope.py 2,3 -4,5

Questions

1. Find the slope of the line through (2, 3) and (−4, 5), and interpret it.

Answer (5 − 3)/(−4 − 2) = 2/(−6) = −1/3. The line falls 1 unit for every 3 units to the right.

2. Find the slope of the line through (3, −1) and (3, 7). Of the line through (−2, 4) and (3, 4).

Answer First: run 3 − 3 = 0, so undefined: the vertical line x = 3. Second: rise 0, so slope 0: the horizontal line y = 4.

3. Write the equation of the line with slope 4 through (1, 2), in point-slope and slope-intercept forms.

Answer y − 2 = 4(x − 1). Distribute and add 2: y = 4x − 2.

4. Write the line through (1, 2) and (5, −3) in general form.

Answer m = −5/4. y − 2 = −(5/4)(x − 1); times 4: 4y − 8 = −5x + 5; so 5x + 4y = 13. Check with (5, −3): 25 − 12 = 13.

5. Find the slope and y-intercept of 2x − 3y = 6. Then its x-intercept.

Answer Solve for y: −3y = −2x + 6, y = (2/3)x − 2. Slope 2/3, y-intercept −2. y = 0 gives x = 3.

6. Find the line parallel to y = 2x + 1 through (3, 4), and the line perpendicular to it through (3, 4).

Answer Parallel: slope 2, y − 4 = 2(x − 3), so y = 2x − 2. Perpendicular: slope −1/2, y − 4 = −½(x − 3), so y = −½x + 11/2.

7. Are y = 3x − 1 and 6x − 2y = 2 parallel?

Answer The second is y = 3x − 1: the same line. Same slope and same intercept means one line, not two parallel ones.

8. What is the slope of a line perpendicular to x = 5?

Answer 0: the perpendicular lines are horizontal, y = b. The product rule cannot be used, because x = 5 has no slope; this is the case it excludes.

9. Using slopes, show that (1, 1), (4, 3) and (7, 5) lie on one line.

Answer Slope from the first to the second: 2/3. From the second to the third: 2/3. Equal slopes through a shared point mean the same line.

10. Using slopes, show that A = (−2, 1), B = (2, 3), C = (3, 1) make a right triangle.

Answer Slope AB = 2/4 = 1/2, slope BC = −2/1 = −2. Product −1, so AB ⊥ BC and the right angle is at B, which is what the [distance formula lesson](../distance_formula/README.md) found with the converse of Pythagoras.

11. Why is slope the same for every pair of points on a line?

Answer Each pair makes a right triangle whose legs are the run and the rise and whose hypotenuse lies along the line. All those triangles have the same angles, so they are similar, and similar triangles have the same ratio of corresponding sides: rise/run.

12. The negative reciprocal of 2/3 is −3/2. Why does a perpendicular line flip the fraction, not just the sign?

Answer A quarter turn swaps the roles of run and rise: the step (3, 2) becomes (−2, 3). Its slope is 3/(−2). Changing only the sign would give a mirror image, −2/3, which is not at right angles.

How to practise

  1. Start every "find the line" problem in point-slope form. It needs a point and a slope, and nothing else; rearrange afterwards.
  2. Check with a second point. After writing a line through two points, put the other point in. One substitution catches most mistakes.
  3. Keep the order of subtraction. Write the two differences one under the other, both starting from the same point.
  4. Check the program, and do the cards.

Flashcards

The page as a deck of Anki cards: lines_and_slope.txt. Import with File → Import. Tags: slope, forms, parallel-perpendicular, problems, trap.

Where this goes next

Circles, the last section of the book's first chapter, where a line through the center and the tangent line meet at a right angle, and the perpendicular slopes of this page find the tangent. In chapter 3 of the book, the slope becomes the average rate of change of a function, and in calculus, the slope of a curve at a single point.

Po polsku, w skrócie

Nachylenie prostej to przyrost y przez przyrost x: m = (y₂ − y₁)/(x₂ − x₁). Jest jedną liczbą dla całej prostej, bo dowolne dwa jej punkty tworzą trójkąt prostokątny o tych samych kątach, a trójkąty podobne mają ten sam stosunek boków. Z tego jednego faktu wynikają wszystkie postacie równania: punktowo-kierunkowa y − y₁ = m(x − x₁), kierunkowa y = mx + b (b to punkt przecięcia z osią y) i ogólna Ax + By = C, jedyna, która obejmuje prostą pionową x = a. Prosta pionowa nie ma nachylenia: dzielenie przez zero, nie „zero" ani „nieskończoność".

Proste równoległe mają równe nachylenia; prostopadłe mają nachylenia o iloczynie −1, bo obrót o ćwierć obrotu zamienia krok (a, b) na (−b, a). Pułapki: przy odejmowaniu obie różnice muszą zaczynać się od tego samego punktu; to samo nachylenie i ten sam wyraz wolny to jedna prosta, nie dwie równoległe. Program sprawdza to na dokładnych ułamkach.

Auf Deutsch: Stichwörter

Eine Gerade hat eine Steigung, weil ähnliche Dreiecke dasselbe Verhältnis haben; Punkt-Steigungs-Form, Normalform, parallel und senkrecht.

Stichwörter: Gerade, Steigung (Anstieg), Steigungsdreieck, Punkt-Steigungs-Form, Normalform y = mx + b, allgemeine Form, parallel, senkrecht (negativer Kehrwert).

See also