Slope of a line

The slope of a line is the ratio of the change in $y$ to the change in $x$ — that is, rise over run.

$slope =\dfrac{change \:in\: y}{change\: in\: x}=\dfrac{rise}{run}$

To find the slope of a line, we need two points on it. If a line passes through the points $(x_1,y_1)$ and $(x_2,y_2)$, then the slope of the line, $m$, is

$m=\dfrac{y_2-y_1}{x_2-x_1}$

A line through two points showing rise over run for the slope

Positive, negative, zero, and undefined slope

The slope of a line can be positive, negative, zero, or undefined.

Positive slope ($m>0$): the line rises from left to right.

xy

Negative slope ($m<0$): the line falls from left to right.

xy

Zero slope ($m=0$): the line is horizontal.

xy

Undefined slope: the line is vertical.

xy

Example 1: Find the slope of the line in the graph.

xy(-2, 2)(3, -5)

Solution: The line passes through $(-2,2)$ and $(3,-5)$. Take $(x_1,y_1)=(-2,2)$ and $(x_2,y_2)=(3,-5)$.

$\begin{align*}m&=\dfrac{y_2-y_1}{x_2-x_1}\\&=\dfrac{-5-2}{3-(-2)}\\&=\dfrac{-7}{5}=-\dfrac{7}{5}\end{align*}$

Since the slope is negative, the line falls from left to right.

Example 2: Find the slopes of the lines passing through the points.

(a) $(0,-3)$ and $(5,-3)$    (b) $(-4,4)$ and $(-4,1)$

Solution:

(a) $m=\dfrac{-3-(-3)}{5-0}=\dfrac{0}{5}=0$   The slope is $0$, so the line is horizontal.

(b) $m=\dfrac{1-4}{-4-(-4)}=\dfrac{-3}{0}$, which is undefined. So the line is vertical.

Finding the slope of a line from its equation

When an equation of a line is written in slope-intercept form $y=mx+b$, the coefficient of $x$ is the slope $m$, and $b$ gives the $y$-intercept $(0,b)$.

For example, in $y=2x-6$ the slope is $2$ and the $y$-intercept is $(0,-6)$.

Example: Find the slope of each line.

(a) $y=-5x+8$   (b) $2x-5y=-7$   (c) $-6x-y=9$

Solution: To read off the slope, the equation must be in slope-intercept form.

(a) $y=-5x+8$ is already in slope-intercept form, so the slope $=-5$.

(b) Solve $2x-5y=-7$ for $y$:

$\begin{align*}-5y&=-2x-7\\y&=\dfrac{-2x-7}{-5}\\y&=\dfrac{2}{5}x+\dfrac{7}{5}\end{align*}$

So the slope $=\dfrac{2}{5}$.

(c) Solve $-6x-y=9$ for $y$:

$\begin{align*}-y&=6x+9\\y&=-6x-9\end{align*}$

So the slope $=-6$.

Parallel and perpendicular lines

If two lines in a plane do not intersect, they are parallel lines.

Two parallel lines with equal slopes

The slopes of parallel lines are the same. That is, if $m_1$ and $m_2$ are the slopes of two parallel lines, then

$m_1=m_2$

If two lines intersect at a right angle, they are perpendicular lines.

Two perpendicular lines intersecting at a right angle

If $m_1$ and $m_2$ are the slopes of two perpendicular lines, then

$m_1 \,m_2=-1$

or

$m_1=-\dfrac{1}{m_2}$

Example: Determine whether the lines $y=5x+8$ and $x+5y=-7$ are parallel, perpendicular, or neither.

Solution:

Line 1, $y=5x+8$, is in slope-intercept form, so $m_1=5$.

Line 2 is not in slope-intercept form. Solve $x+5y=-7$ for $y$:

$\begin{align*}5y&=-x-7\\y&=-\dfrac{1}{5}x-\dfrac{7}{5}\end{align*}$

So $m_2=-\dfrac{1}{5}$.

The slopes are not equal, so the lines are not parallel. Check the product of the slopes:

$m_1\cdot m_2=5\cdot\left(-\dfrac{1}{5}\right)=-1$

Since the product is $-1$, the lines are perpendicular.

Graphing a line from its slope and $y$-intercept

To graph a line written in slope-intercept form $y=mx+b$, first plot the $y$-intercept $(0,b)$. Then use the slope $m=\dfrac{\text{rise}}{\text{run}}$ to locate a second point, and draw the line through the two points.

Example 1: Graph the line $y=\dfrac{2}{5}x+3$.

Solution: This is in slope-intercept form. The slope is $\dfrac{2}{5}=\dfrac{\text{rise}}{\text{run}}$ and the $y$-intercept is $(0,3)$.

Plot $(0,3)$, then go up $2$ and right $5$ to a second point; draw the line.

xy(0, 3)

Example 2: Graph the line $4x+3y=15$.

Solution: Write the equation in slope-intercept form:

$\begin{align*}3y&=-4x+15\\y&=-\dfrac{4}{3}x+5\end{align*}$

The slope is $-\dfrac{4}{3}=\dfrac{-4}{3}$ (down $4$, right $3$) and the $y$-intercept is $(0,5)$.

Plot $(0,5)$, then go down $4$ and right $3$; draw the line.

xy(0, 5)

Example 3: Graph the line $-3x+y=6$.

Solution: Write the equation in slope-intercept form:

$y=3x+6$

The slope is $3=\dfrac{3}{1}$ (up $3$, right $1$) and the $y$-intercept is $(0,6)$.

Plot $(0,6)$, then go up $3$ and right $1$; draw the line.

xy(0, 6)