How to Find the Slope of a Line

In this tutorial, we’ll look at the concept of slope (in analytical geometry). We will cover what slope means and how to find the slope of a line under different scenarios.

It’s a crucial topic – you’ll be working with it all the time in the study of analytical geometry and even calculus.

So let’s dive in.

Slope of a Line – Meaning and Formula

The slope of a line is a measure of its steepness and direction. It is the ratio of the rise (change in y-coordinate) to the run (change in x-coordinate) as we move from one point to another on the line.

The slope of a line is usually represented by ‘m\hspace{0.2em} m \hspace{0.2em}’.

How to find the slope of a line - a graph showing rise and run

So, here’s the formula for the slope of a line (consider the black line in the image above).

slope=riserunm=y2y1x2x1\begin{align*} \text{slope} &= \frac{ {\color{Teal} \text{rise}} }{ {\color{Red} \text{run}} } \\[1.3em] m &= \frac{ {\color{Teal} y_2 - y_1} }{ {\color{Red} x_2 - x_1} } \end{align*}

Positive and Negative Slope

Based on the orientation of the concerned line, the slope of a line can be positive, negative, or zero.

For the slope to be positive, both the numerator and denominator on the right side (in the formula above) must have the same sign. That means both the x and y coordinates increase or decrease together.

Positive slope – towards top-right

So as we move rightwards on the line, we must be moving upward. And as we move leftwards, we must be moving downwards. In other words, the line must slope uphill ↗.

On the other hand, for the slope to be negative, the numerator and the denominator must have opposite signs. So the line must slope downhill ↘.

Negative slope – towards bottom-right

How to Find the Slope of a Line

Alright, for a better understanding of how to find the slope of a line in different cases, let’s solve a few example problems now.

Slope of a Line From Two Points

Example

Find the slope of the line that passes through (14,0)\hspace{0.2em} (\frac{1}{4}, 0) \hspace{0.2em} and (3,2)\hspace{0.2em} (3, 2) \hspace{0.2em}.

Solution

We’ll start with the formula for the slope.

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1}

Next, from the question, let’s list the coordinates we need for the formula.

(x1,y1)=(14,0)(x2,y2)=(3,2)\begin{align*} (x_1, y_1) &= \left ( \frac{1}{4}, 0 \right ) \\[1.3em] (x_2, y_2) &= (3, 2) \end{align*}

Note – It doesn’t matter which point you take as P1 (x1, y1) and which as P2 (x2, y2).

Finally, we just need to substitute the coordinates into the formula and simplify.

m=20314=811\begin{align*} m &= \frac{2 - 0}{3 - \frac{1}{4}} \\[1.3em] &= \frac{8}{11} \end{align*}

That’s it. The slope of the line is 811\hspace{0.2em} \frac{8}{11} \hspace{0.2em}.

Slope of a Line From the Graph

Example

Find the slope of the line in the figure.

Solution

This is pretty much the same as the last example, except that here we are given the graph.

So, first, here are the coordinates from the figure.

(x1,y1)=(4,3)(x2,y2)=(1,1)\begin{align*} (x_1, y_1) &= (-4, 3) \\[1.3em] (x_2, y_2) &= (-1, -1) \end{align*}

Plugging these coordinates into our formula and simplifying, we have –

m=y2y1x2x1=1(3)1(4)=23\begin{align*} m &= \frac{y_2 - y_1}{x_2 - x_1} \\[1.3em] &= \frac{-1-(-3)}{-1-(-4)}\, = \, \frac{2}{3} \end{align*}

Slope of a Line From the Line’s Equation

How to find the slope of a line when you have the line’s equation but not the coordinates of two points on it?

Well, the most preferred approach is to transform the equation into slope-intercept form and then extract the slope from it.

To give you a quick summary of the equation of a line in slope-intercept form – we have y on one side (with 1 as its coefficient) and x and the constant term on the other side. The x-coefficient gives the slope of the line.

y=mx+by = {\color{Red} m} x + b

Slope-intercept form

Example

Find the slope of each line from its equation.

(i)y=12+4(ii)3x+5y=1(iii)xy=2\begin{align*} &(\text{i}) \hspace{1.08em} y = -\frac{1}{2} + 4 \\[1.3em] &(\text{ii}) \hspace{0.9em} 3x + 5y = 1 \\[1.3em] &(\text{iii}) \hspace{0.75em} x - y = 2 \end{align*}

Solution (i\hspace{0.2em} \text{i} \hspace{0.2em})

Here, the equation given to us is already in its slope-intercept form, so let’s compare it with the standard equation.

y=mx+by=12x+b\begin{align*} y &= {\color{Red} m} x + b \\[1.3em] y &= {\color{Red} -\frac{1}{2}} x + b \end{align*}

Clearly, the slope is –

m=12 {\color{Red} m} = {\color{Red} -\frac{1}{2}}

Solution (ii\hspace{0.2em} \text{ii} \hspace{0.2em})

3x+5y=13x + 5y = 1

This time, our equation is not in the slope-intercept form, so we’ll need to transform it.

First, let’s make sure we have only the y-term on the left side.

5y=3x+15y = -3x + 1

Next, we divide the whole equation by the y-coefficient (5) so that the y-coefficient becomes one.

5y=35x+355y = -\frac{3}{5}x + \frac{3}{5}

Great! Now our equation is in the desired form and so, the x-coefficient is the slope of the line.

m=35m = -\frac{3}{5}

Solution (iii\hspace{0.2em} \text{iii} \hspace{0.2em})

Again, we will start by transforming the equation to the slope-intercept form.

xy=2y=x2\begin{align*} x - y = 2 \\[1em] y = x -2 \end{align*}

And looking at the x-coefficient, we have,

m=1m = 1

Remember, if the coefficient is not explicitly mentioned, it’s 1.

Slope of Horizontal and Vertical Lines

In the context of analytical geometry, when say horizontal or vertical, we generally mean in reference to the x-axis. So a horizontal line is one parallel to the x-axis and a vertical line is one perpendicular to it.

Horizontal Line

For a horizontal line, the y-coordinate remains constant for all points. This is why its equation is of the y = a, where a is a constant.

Now if we calculate the slope of a horizontal line –

m=y2y1x2x1=aax2x1=0\begin{align*} m &= \frac{y_2 - y_1}{x_2 - x_1} \\[1.3em] &= \frac{a - a}{x_2 - x_1} \\[1.3em] &= 0 \end{align*}

The slope of a horizontal line is 0.

Vertical Line

For a vertical line, the x-coordinate remains constant for all points. Which is why its equation is of the x = a, where a is a constant.

Similar to the previous case, here, the denominator (bottom part) in our slope formula becomes 0. But division by zero is not defined.

The slope of a horizontal line is undefined.

Parallel and Perpendicular Lines

In this last section, we’ll look at how to find the slope of a line that is parallel or perpendicular to a line whose slope is known.

For the most part, the idea is very simple.

Parallel Lines
Perpendicular Lines

If two lines are parallel, their slopes would be equal. If they are perpendicular, the product of their slopes would be 1\hspace{0.2em} -1 \hspace{0.2em}.

Example

Line l1\hspace{0.2em} l_1 \hspace{0.2em} passes through the points (0,1)\hspace{0.2em} (0, 1) \hspace{0.2em} and (2,0)\hspace{0.2em} (2, 0) \hspace{0.2em}. Find the slope of a line parallel to l1\hspace{0.2em} l_1 \hspace{0.2em}.

Solution

Before we can find the slope of any line parallel to l1\hspace{0.2em} l_1 \hspace{0.2em}, we need to find the slope of l1\hspace{0.2em} l_1 \hspace{0.2em} itself (let’s call it m\hspace{0.2em} m' \hspace{0.2em}).

So, just like we did for the first two examples, we’ll use the slope formula.

m=y2y1x2x1=0120=12\begin{align*} m' &= \frac{y_2 - y_1}{x_2 - x_1} \\[1.3em] &= \frac{0 - 1}{2 - 0} \\[1.3em] &= - \frac{1}{2} \end{align*}

Now, we know that slopes of parallel lines are equal. So if the slope of a line parallel l1\hspace{0.2em} l_1 \hspace{0.2em} is m\hspace{0.2em} m \hspace{0.2em},

Done.

Example

If line l1\hspace{0.2em} l_1 \hspace{0.2em} is perpendicular to l2\hspace{0.2em} l_2 \hspace{0.2em}, find the slope of l2\hspace{0.2em} l_2 \hspace{0.2em}.

Solution

Again, first, we find the slope of the line l1\hspace{0.2em} l_1 \hspace{0.2em} (say m\hspace{0.2em} m' \hspace{0.2em}).

m=y2y1x2x1=7121=63=2\begin{align*} m' &= \frac{y_2 - y_1}{x_2 - x_1} \\[1.3em] &= \frac{7 - 1}{-2 - 1} \\[1.3em] &= \frac{6}{-3} \, = \, -2 \end{align*}

Next, let the slope of a line perpendicular to l1\hspace{0.2em} l_1 \hspace{0.2em} be m. And since the product of slopes of perpendicular lines is 1\hspace{0.2em} -1 \hspace{0.2em}, we have

mm=1m \cdot m' = -1

Substituting the value of m’ gives us

m(2)=1m=12=12\begin{align*} m \cdot (-2) &= -1 \\[1.3em] m &= \frac{-1}{-2} \, = \, \frac{1}{2} \end{align*}

So the required slope is 12\hspace{0.2em} \frac{1}{2} \hspace{0.2em}.


And with that, we come to the end of this tutorial on how to find the slope of a line. Until next time.