# How to find the slope of a line

Practice Problems & examples

The slope of a line characterizes the general direction in which a line points.  To find the slope, you divide the difference of the y-coordinates of a point on a line by the difference of the x-coordinates.

### Formulato find the slope of a line

##### Example One

The slope of a line going through the point (1,2) and the point (4,3) is $$\frac{1}{3}$$.

##### Example 2 of the Slope of A line

The slope of a line through the points (3, 4) and (5, 1) is $$- \frac{3}{2}$$ because every time that the line goes down by 3(the change in y or the rise) the line moves to the right (the run) by 2.

There is only one way to know! Let's try to find the slope of a line through the points (4,3) and (1,2) .First we'll start with one point and then we'll start with the other.

$$slope = \frac{y_{2}-y_{1}}{x_{2}-x_{1}} = \frac{3-2}{4-1} = \frac{1}{3}$$

$$slope = \frac{y_{2}-y_{1}}{x_{2}-x_{1}} = \frac{2-3}{1-4} = \frac{-1}{-3} = \frac{1}{3}$$

Answer: It does not matter which point you put first. You can start with (4,3) or with (1,2) and, either way, you end with the exact same number! $$\frac{1}{3}$$

### Slope of vertical and horizontal lines

#### The slope of a vertical line is undefined

This is because any vertical line has a $$\Delta x$$ or "run" of zero. Whenever zero is the denominator of the fraction in this case of the fraction representing the slope of a line, the fraction is undefined. The picture below shows a vertical line (x=1)

#### The slope of a horizontal line is zero

This is because any horizontal line has a $$\Delta y$$ or "rise" of zero. Therefore, regardless of what the run is (provided its' not also zero!), the fraction representing slope has a zero in its numerator. Therefore, the slope must evaluate to zero. Below is a picture of a horizontal line--you can see that it does not have any 'rise' to it.

#### Do any two points on a line have the same slope?

Answer: Yes, and this is a fundamental point to remember about calculating slope.

Every line has a consistent slope. In other words, the slope of a line never changes. This fundamental idea means that you can choose ANY two points on a line to find the slope. This should intuitively make sense with your own understanding of a straight line. After all, if the slope of a line could change, then it would be a zigzag line and not a straight line, as you can see in the picture below.

### Practice Problems

WARNING! Can you catch the error in the following problem Jennifer was trying to find the slope that goes through the points $$(\color{blue}{1},\color{red}{3})$$ and $$(\color{blue}{2}, \color{red}{6})$$ . She was having a bit of trouble applying the slope formula, tried to calculate slope 3 times, and she came up with 3 different answers. Can you determine the correct answer?

The correct answer is the Second attempt.

The problem with her first attempt was that she did not consistently use the points. What she did, in attempt one, was used

$$\frac{\color{red}{y{\boxed{_2}}-y_{1}}}{\color{blue}{x\boxed{_{1}}-x_{2}}}$$

The problem with her third attempt was that she did switched the rise and run. In other words, she put the x values on the top and the y values on the bottom which, of course, is not how you do slope!

$$\cancel {\frac{\color{blue}{x_{2}-x_{1}}}{\color{red}{y_{2}-y_{1}}}}$$

$$\frac{rise}{run}= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} \\= \frac{9-3}{7-10}= \frac{6}{-3} = -2$$

$$\frac{3-9}{10-7}=\frac{-6}{3} = -2$$

$$\frac{rise}{run}= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ = \frac{-2 - 3}{4- 4} = \frac{-5}{ \color{red}{0}}= \text{undefined}$$

Whenever the run of a line is zero, the slope is undefined. This is because there is a zero in the denominator of the slope! Any the slope of any vertical line is undefined .

$$\frac{rise}{run}= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ \frac{10 - 7}{2 - 8} = \frac{3}{-6} = -\frac{1}{2}$$

Or, you can start with the other point $$\frac{7 - 10}{8-2} = \frac{-3}{6} == -\frac{1}{2}$$

$$\frac{rise}{run}= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ \frac{ 5-3}{8-7} = \frac{2}{1} = 2$$

Or, you can start with the other point $$\frac{ 3-5}{7-8} = \frac{-2}{-1} = 2$$

$$\frac{rise}{run}= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ \frac{ 11 - 5}{12-9}= \frac{6}{3}=2$$

Or, you can start with the other point $$\frac{ 5-11}{9-12}= \frac{-6}{-3}= 2$$

$$\frac{rise}{run}= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ \frac{ 2 - 5}{4-4}= \frac{ -3}{\color{red}{0}}= undefined$$

### Slope Practice Problem Generator

You can practice solving this sort of problem as much as you would like with the slope problem generator below.

It will randomly generate numbers and ask for the slope of the line through those two points. You can chose how large the numbers will be by adjusting the difficulty level.