Skip to content

The slope and the equation of a line

The slope and the equation of a line

The slope from two points

The slope of a line is the ratio of the change in y\displaystyle y to the change in x\displaystyle x, going from one point of the line to another. The ratio is the same for any two points of the line, so any two points give it.

m\displaystyle m =\displaystyle = y2−y1x2−x1\displaystyle \frac{y_2-y_1}{x_2-x_1}x1≠x2\displaystyle x_1\neq x_2
y=2x−1\displaystyle y=2x-1
A=(1,1)\displaystyle A=(1,1)
B=(4,7)\displaystyle B=(4,7)

In the drawing, the line passes through A(1,1)\displaystyle A(1,1) and B(4,7)\displaystyle B(4,7):

  • from A\displaystyle A to B\displaystyle B, y\displaystyle y rises by 7−1=6\displaystyle {7-1}={6}, and x\displaystyle x grows by 4−1=3\displaystyle {4-1}={3};
  • m=63=2\displaystyle {m}={\frac{6}{3}}={2}: for each step to the right, the line rises 2\displaystyle 2.
The sign of the slope

The sign of the slope says which way the line goes, read from left to right:

y=x+1\displaystyle y=x+1
y=−12x+3\displaystyle y=-\frac{1}{2}x+3
y=−2\displaystyle y=-2
x=3\displaystyle x=3
  • a positive slope – the line goes up (y=x+1\displaystyle {y}={x+1});
  • a negative slope – the line goes down (y=−12x+3\displaystyle {y}={-\frac{1}{2}x+3});
  • a slope of 0\displaystyle 0 – the line is parallel to the x\displaystyle x-axis: all its points have the same y\displaystyle y, and its equation is y=−2\displaystyle {y}={-2};
  • a line parallel to the y\displaystyle y-axis: all its points have the same x\displaystyle x, and its equation is x=3\displaystyle {x}={3}. There x\displaystyle x does not change, the denominator in the slope formula is 0\displaystyle 0, so such a line has no slope.
Exercise 1

Find the slope of the line through the two points.

a
(2,3)\displaystyle (2,3), (6,11)\displaystyle (6,11)

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

    b
    (−1,4)\displaystyle (-1,4), (3,−2)\displaystyle (3,-2)

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

      c
      (0,5)\displaystyle (0,5), (4,5)\displaystyle (4,5)

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

        The explicit form and the implicit form

        A line’s equation is written in one of two forms:

        • explicit form – y\displaystyle y alone on one side; m\displaystyle m is the slope, and b\displaystyle b the y\displaystyle y-coordinate of the point where the line crosses the y\displaystyle y-axis:
        y\displaystyle y =\displaystyle = mx+b\displaystyle mx+b
        • implicit form – all the terms on one side:
        Ax+By+C\displaystyle Ax+By+C =\displaystyle = 0\displaystyle 0

        To go from the implicit form to the explicit form, get y\displaystyle y on its own:

        2x+3y−6=0⇒3y=−2x+6⇒y=−23x+22x+3y-6=0\quad\Rightarrow\quad 3y=-2x+6\quad\Rightarrow\quad y=-\frac{2}{3}x+2

        The line’s slope is −23\displaystyle -\frac{2}{3}, and it crosses the y\displaystyle y-axis at (0,2)\displaystyle (0,2).

        Exercise 2

        The board shows the line 4x−2y+2=0\displaystyle {4x-2y+2}={0}.
        Write its equation in explicit form.

        4x−2y+2=0\displaystyle 4x-2y+2=0

        A line from its slope and a point

        Through a given point there is only one line of each slope: two lines of the same slope are parallel, and through a point outside a line there is only one line parallel to it. So a slope and a point fix one line, and its equation is:

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

        Example: the line of slope 3\displaystyle 3 through (2,−1)\displaystyle (2,-1):

        y−(−1)=3(x−2)⇒y+1=3x−6⇒y=3x−7y-(-1)=3(x-2)\quad\Rightarrow\quad y+1=3x-6\quad\Rightarrow\quad y=3x-7

        A check: 3⋅2−7=−1\displaystyle {3\cdot2-7}={-1}, and the point is on the line.

        Exercise 3

        The line’s slope is −2\displaystyle -2, and it passes through the point P(1,4)\displaystyle P(1,4).
        Write the line’s equation in explicit form.

        P=(1,4)\displaystyle P=(1,4)

        A line from two points

        Through two points there is one and only one line. Its equation comes in two steps: the slope from the two points, then the line from the slope and one of the points.

        Example: the line through A(−1,5)\displaystyle A(-1,5) and B(3,−3)\displaystyle B(3,-3):

        • m=−3−53−(−1)=−84=−2\displaystyle {m}={\frac{-3-5}{3-(-1)}}={\frac{-8}{4}}={-2};
        • through A\displaystyle A: y−5=−2(x+1)\displaystyle {y-5}={-2(x+1)}, so y=−2x+3\displaystyle {y}={-2x+3};
        • a check at B\displaystyle B: −2⋅3+3=−3\displaystyle {-2\cdot3+3}={-3}.
        Exercise 4

        Write the equation of the line through the points A(−2,−1)\displaystyle A(-2,-1) and B(2,7)\displaystyle B(2,7).

        A=(−2,−1)\displaystyle A=(-2,-1)
        B=(2,7)\displaystyle B=(2,7)

        Exercise 5

        Write the equation of the line through the points A(−3,2)\displaystyle A(-3,2) and B(5,−2)\displaystyle B(5,-2).

        A=(−3,2)\displaystyle A=(-3,2)
        B=(5,−2)\displaystyle B=(5,-2)

        A point on a line

        A point is on a line when its coordinates satisfy the line’s equation: substitute its x\displaystyle x, and you get its y\displaystyle y.

        • (2,5)\displaystyle (2,5) is on the line y=3x−1\displaystyle {y}={3x-1}: 3⋅2−1=5\displaystyle {3\cdot2-1}={5};
        • (1,4)\displaystyle (1,4) is not on it: 3⋅1−1=2≠4\displaystyle {3\cdot1-1}={2\neq4}.
        Exercise 6

        The line is y=−2x+5\displaystyle {y}={-2x+5}.

        a

        Is the point (3,−1)\displaystyle (3,-1) on the line?
        And the point (−1,3)\displaystyle (-1,3)?
        Explain.

        b

        The point (a,−7)\displaystyle (a,-7) is on the line.
        Find a\displaystyle a.