Skip to content

The slope and the equation of a line

The slope and the equation of a line

The slope of a line

The slope of a line is the change in y\displaystyle y for each step of 1\displaystyle 1 in x\displaystyle x. Between any two points of the line it is the change in y\displaystyle y divided by the change in x\displaystyle x:

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=23x+1\displaystyle y=\frac{2}{3}x+1
A=(0,1)\displaystyle A=(0,1)
B=(6,5)\displaystyle B=(6,5)
  • From A(0,1)\displaystyle A(0,1) to B(6,5)\displaystyle B(6,5): 6\displaystyle 6 to the right and 4\displaystyle 4 up, so m=46=23\displaystyle {m}={\frac{4}{6}}={\frac{2}{3}}.
  • Any two points of a line give the same slope: the triangles of the steps are similar.
  • m>0\displaystyle m>0 – the line rises from left to right; m<0\displaystyle m<0 – it falls; m=0\displaystyle {m}={0} – it is parallel to the x\displaystyle x-axis.
Exercise 1

Find the slope of the line through A(−1,4)\displaystyle A(-1,4) and B(3,−4)\displaystyle B(3,-4).

    / – 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

    A line by its slope and a point

    A point (x,y)\displaystyle (x,y) is on the line of slope m\displaystyle m through (x1,y1)\displaystyle (x_1,y_1) exactly when the slope between the two points is m\displaystyle m: y−y1x−x1=m\displaystyle {\frac{y-y_1}{x-x_1}}={m}. Multiplied out, this is the equation of the line:

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

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

    • y−1=−2(x−3)\displaystyle {y-1}={-2(x-3)};
    • y−1=−2x+6\displaystyle {y-1}={-2x+6};
    • y=−2x+7\displaystyle {y}={-2x+7}.

    A line through two points: first the slope between them, then the equation by the slope and one of the points.

    Exercise 2

    Write the equation of the line of slope 3\displaystyle 3 through the point P(2,−1)\displaystyle P(2,-1).

    P=(2,−1)\displaystyle P=(2,-1)

    Exercise 3

    Write the equation of the line through A(1,5)\displaystyle A(1,5) and B(4,−1)\displaystyle B(4,-1).

    A=(1,5)\displaystyle A=(1,5)
    B=(4,−1)\displaystyle B=(4,-1)

    The explicit and the general equation

    The same line can be written in two forms:

    • explicit – y=mx+b\displaystyle {y}={mx+b}: the slope m\displaystyle m and the point (0,b)\displaystyle (0,b) on the y\displaystyle y-axis can be read at once, and for each x\displaystyle x the equation gives y\displaystyle y;
    • general – Ax+By+C=0\displaystyle {Ax+By+C}={0}: every line has one, a line parallel to the y\displaystyle y-axis too; to read its slope, isolate y\displaystyle y.

    Example: 2x+3y−6=0\displaystyle {2x+3y-6}={0}.

    • 3y=−2x+6\displaystyle {3y}={-2x+6}, so y=−23x+2\displaystyle {y}={-\frac{2}{3}x+2};
    • the slope is −23\displaystyle -\frac{2}{3}, and the line crosses the y\displaystyle y-axis at (0,2)\displaystyle (0,2).

    The general form is not unique: 4x+6y−12=0\displaystyle {4x+6y-12}={0} is the same line – the equation times 2\displaystyle 2.

    A line parallel to the y-axis

    All the points of a line parallel to the y\displaystyle y-axis have the same x\displaystyle x, so its equation is x=k\displaystyle {x}={k}.

    x=3\displaystyle x=3
    y=2\displaystyle y=2
    • x=3\displaystyle {x}={3} has no slope: between two of its points the change in x\displaystyle x is 0\displaystyle 0, and you cannot divide by 0\displaystyle 0.
    • It is not the graph of a function: a function gives one y\displaystyle y for each x\displaystyle x, and here x=3\displaystyle {x}={3} has every y\displaystyle y.
    • In the general form it is x−3=0\displaystyle {x-3}={0}: B=0\displaystyle {B}={0}.
    • The dashed line y=2\displaystyle {y}={2} is parallel to the x\displaystyle x-axis: its slope is 0\displaystyle 0, and it is the graph of a function – the same y\displaystyle y for every x\displaystyle x.
    Exercise 4

    The general equation of a line is 5x−2y+4=0\displaystyle {5x-2y+4}={0}.
    Write its explicit equation.

    Exercise 5

    Write the equation of each line.
    Which of the lines are graphs of functions?

    1. The line through (3,1)\displaystyle (3,1) and (3,5)\displaystyle (3,5).
    2. The line through (−2,4)\displaystyle (-2,4) and (6,4)\displaystyle (6,4).
    3. The line through the origin and (2,−6)\displaystyle (2,-6).
    A line with a parameter

    An equation with a letter besides x\displaystyle x and y\displaystyle y – a parameter – is a whole family of lines, one for each value of the parameter. A condition on the line is an equation in the parameter.

    Example: (k−1)x+2y=k\displaystyle {(k-1)x+2y}={k}. For which k\displaystyle k does the line pass through (3,1)\displaystyle (3,1)?

    • Substitute the point: 3(k−1)+2⋅1=k\displaystyle {3(k-1)+2\cdot1}={k};
    • 3k−1=k\displaystyle {3k-1}={k}, so k=12\displaystyle {k}={\frac{1}{2}};
    • the line: −12x+2y=12\displaystyle {-\frac{1}{2}x+2y}={\frac{1}{2}}, or y=14x+14\displaystyle {y}={\frac{1}{4}x+\frac{1}{4}}.
    Exercise 6

    The line: kx+(k+2)y=12\displaystyle {kx+(k+2)y}={12}.

    a
    For which k\displaystyle k does the line pass through the point (1,2)\displaystyle (1,2)?
      b

      For which k\displaystyle k is the line parallel to the y\displaystyle y-axis?
      For which k\displaystyle k is it parallel to the x\displaystyle x-axis?
      Write the line’s equation in each case.