Slope of a Line – Formula and Examples

The slope of a line defines the inclination of the line with respect to the x-axis. The slope can be calculated by obtaining the ratio of the difference in the change in y over the change in x. Here, we will learn about the formula that we can use to calculate the slope of a line.

We will learn about the slope of common lines and we will solve some practice problems.

GEOMETRY
formula for the slope of a line

Relevant for

Learning to determine the slope of a line with examples.

See examples

GEOMETRY
formula for the slope of a line

Relevant for

Learning to determine the slope of a line with examples.

See examples

Formula for the slope of a line

The formula for the slope of a line is derived using the coordinates of two points that lie on the line. Therefore, we find the slope of a line by forming a fraction, where the numerator is equal to the difference of the y-coordinates and the denominator is equal to the difference of the x-coordinates. That is, if we have the points A = (x_{1}, y_{1}) and B = (x_{2}, y_{2}), the slope formula is:

Formula for the slope

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

Slope of a horizontal line

The slope of a horizontal line can be found by applying the slope formula taking into account that the y-coordinates of all points that lie on a horizontal line are the same. Therefore, we have:

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

=\frac{0}{x_{2}-x_{1}}

m=0

This means that the slope of all horizontal lines is equal to 0.


Slope of a vertical line

Vertical lines have no slope since we cannot define the slope of vertical lines numerically. This is because the x-coordinates of all points on a vertical line are the same. Therefore, when we apply the slope formula with vertical lines, we have:

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

=\frac{y_{2}-y_{1}}{0}

We know that division by 0 is undefined.


Slope of parallel lines

Consider the following two parallel lines, l_{1} and l_{2}, which have slopes α and β. For the lines to be parallel, the slopes must be the same. This means that we have α = β.

diagram of parallel lines

Therefore, two parallel lines always have the same slope. Therefore, if we want to determine if two or more lines are parallel, we have to make sure that their slopes are the same.


Slope of perpendicular lines

In the following diagram, we have the lines l_{1} and l_{2}, which have the slopes α and β:

diagram of perpendicular lines

If these lines are perpendicular, we can say that β = α+90°. Also, we can write the slopes as follows:

m_{1}=\tan(\alpha +90^{\circ}) y m_{2}=\tan(\alpha)

⇒  m_{1}=-\cot(\alpha)=m_{1}=-\frac{1}{\tan(\alpha)}=-\frac{1}{m_{2}}

⇒  m_{1}=-\frac{1}{m_{2}}

⇒  m_{1}\times {m_{2}}=-1

Therefore, for two lines to be perpendicular, the product of their slopes must equal -1. Alternatively, we can think of two perpendicular lines as having slopes that are the negative reciprocal of each other.


Slope of a line – Examples with answers

The following examples are solved using the formula for the slope of a line. Try solving the problems first before looking at the solution.

EXAMPLE 1

The points (1, 1) and (3, 5) are part of a line. What is the slope of the line?

The points given are:

  • (x_{1}, y_{1})=(1, 1)
  • (x_{2}, y_{2})=(3, 5)

Using the coordinates of the points given in the slope formula, we have:

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

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

m=\frac{4}{2}

m=2

The slope of the line is 2.

EXAMPLE 2

A line contains the points (2, 3) and (6, 5). What is its slope?

We have the following points:

  • (x_{1}, y_{1})=(2, 3)
  • (x_{2}, y_{2})=(6, 5)

Applying the slope formula with these points, we have:

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

m=\frac{5-3}{6-2}

m=\frac{2}{4}

m=\frac{1}{2}

The slope of the line is \frac{1}{2}.

EXAMPLE 3

The points (-3, 2) and (3, 4) are part of a line. What is its slope?

We have the following coordinates:

  • (x_{1}, y_{1})=(-3, 2)
  • (x_{2}, y_{2})=(3, 4)

Applying the slope formula with these coordinates, we have:

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

m=\frac{4-2}{3-(-3)}

m=\frac{2}{6}

m=\frac{1}{3}

The slope of the line is \frac{1}{3}.

EXAMPLE 4

Determine the slope of a line that contains the points (-3, -2) and (2, -7).

We have the points:

  • (x_{1}, y_{1})=(-3, -2)
  • (x_{2}, y_{2})=(2, -7)

Now, we use these coordinates in the slope formula:

m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}

m=\frac{-7-(-2)}{2-(-3)}

m=\frac{-5}{5}

m=-1

The slope of the line is -1.


Slope of a line – Practice problems

Use the formula for the slope of a line to solve the following problems. If you need help with this, you can look at the solved examples above.

Determine the slope of a line that passes through the points (1, 2) and (4, 8).

Choose an answer






What is the slope of the line that passes through the points (-2, 1) and (4, 4)?

Choose an answer






A line contains the points (-1, -2) and (3, -5). What is its slope?

Choose an answer






Find the slope of a line that contains the points (-4, -2) and (4, -4).

Choose an answer







See also

Interested in learning more about distance, midpoint, and slope on the plane? Take a look at these pages:

Learn mathematics with our additional resources in different topics

LEARN MORE