# 3.11 Find the Equation of a Line

## Learning Objectives

By the end of this section, you will be able to:

• Find an equation of the line given the slope and $y$-intercept
• Find an equation of the line given the slope and a point
• Find an equation of the line given two points
• Find an equation of a line parallel to a given line
• Find an equation of a line perpendicular to a given line

### Try It

Before you get started, take this readiness quiz:

1) Solve: $\frac{2}{3}=\frac{x}{5}$
2) Simplify: $-\frac{2}{5}(x-15)$

How do online retailers know that ‘you may also like’ a particular item based on something you just ordered? How can economists know how a rise in the minimum wage will affect the unemployment rate? How do medical researchers create drugs to target cancer cells? How can traffic engineers predict the effect on your commuting time of an increase or decrease in gas prices? It’s all mathematics.

You are at an exciting point in your mathematical journey as the mathematics you are studying has interesting applications in the real world.

The physical sciences, social sciences, and the business world are full of situations that can be modelled with linear equations relating two variables. Data is collected and graphed. If the data points appear to form a straight line, an equation of that line can be used to predict the value of one variable based on the value of the other variable.

To create a mathematical model of a linear relation between two variables, we must be able to find the equation of the line. In this section we will look at several ways to write the equation of a line. The specific method we use will be determined by what information we are given.

## Find an Equation of the Line Given the Slope and $y$-Intercept

We can easily determine the slope and intercept of a line if the equation was written in slope–intercept form, $y=mx+b$. Now, we will do the reverse—we will start with the slope and $y$-intercept and use them to find the equation of the line.

### Example 3.11.1

Find an equation of a line with slope $-7$ and $y$-intercept $(0,-1)$.

Solution

Since we are given the slope and $y$-intercept of the line, we can substitute the needed values into the slope–intercept form, $y=mx+b$.

Step 1: Name the slope.

$m=7$

Step 2: Name the $y$-intercept.

$y$-intercept = ${(0,\;}{\color{blue}{-}}{}{\color{blue}{1}}{)}$

Step 3: Substitute the values into $y=mx+b$.

\begin{align*}y&={\color{red}{m}}x+{\color{blue}{b}}\\y&={\color{red}{-}}{\color{red}{7}}x+({\color{blue}{-}}{\color{blue}{1}})\\y&=-7x-1\end{align*}

### Try It

3) Find an equation of a line with slope $\frac{2}{5}$ and $y$-intercept $(0,4)$.

Solution

$y=\frac{2}{5}x+4$

4) Find an equation of a line with slope $-1$ and $y$-intercept $(0,-3)$.

Solution

$y=-x-3$

Sometimes, the slope and intercept need to be determined from the graph.

### Example 3.11.2

Find the equation of the line shown.

Solution

We need to find the slope and $y$-intercept of the line from the graph so we can substitute the needed values into the slope–intercept form, $y=mx+b$.

To find the slope, we choose two points on the graph.

The $y$-intercept is $(0,-4)$ and the graph passes through $(3,-2)$.

Step 1: Find the slope by counting the rise and run.

\begin{align*}m&=\frac{rise}{run}\\m&={\color{red}{\frac23}}\end{align*}

Step 2: Find the $y$-intercept.

$\text{y-intercept}=(0,{\color{red}{-}}{\color{red}{4}})$

Step 3: Substitute the values into $y=mx+b$.

\begin{align*}y&={\color{red}{m}}x+{\color{blue}{b}}\\y&={\color{red}{\frac23}}x{\color{blue}{-}}{\color{blue}{\;}}{\color{blue}{4}}\end{align*}

### Try It

5) Find the equation of the line shown in the graph.

Solution

$y=\frac{3}{5}x+1$

6) Find the equation of the line shown in the graph.

Solution

$y=\frac{4}{3}x-5$

## Find an Equation of the Line Given the Slope and a Point

Finding an equation of a line using the slope–intercept form of the equation works well when you are given the slope and $y$-intercept or when you read them off a graph. But what happens when you have another point instead of the $y$-intercept?

We are going to use the slope formula to derive another form of an equation of the line. Suppose we have a line that has slope $m$ and that contains some specific point $(x_1,y_1)$ and some other point, which we will just call $(x,y)$. We can write the slope of this line and then change it to a different form.

$m=\frac{y-y_1}{x-x_1}$

{\small\begin{align*} &\text{Step 1: Multiply both sides of the equation by}(x-x_1).\;&m(x-x_1)&=(\frac{y-y_1}{x-x_1})(x-x_1)\\ &\text{Step 2: Simplify.}\;&m(x-x_1)&={y-y_1}\\ &\text{Step 3: Rewrite the equation with the y terms on the left.}&(y-y_1)&=m(x-x_1) \end{align*}}

This format is called the point–slope form of an equation of a line.

### Point–slope Form of an Equation of a Line

The point–slope form of an equation of a line with slope $m$ and containing the point $(x_1,y_1)$ is

${y\;-\;}{\color{blue}{y}}_{\color{blue}{1}}={\color{red}{m}}(x-{\color{blue}{x}}_{\color{blue}{1}}{)}$.

We can use the point–slope form of an equation to find an equation of a line when we are given the slope and one point. Then we will rewrite the equation in slope–intercept form. Most applications of linear equations use the the slope–intercept form.

### Example 3.11.3

Find an equation of a line with slope $m=\frac{2}{5}$ that contains the point $(10,3)$. Write the equation in slope–intercept form.

Solution

Step 1: Identify the slope.
The slope is given.

${\color{blue}{m}}{=\frac25}$

Step 2: Identify the point.
The point is given.

$\begin{pmatrix}{\color{red}{x_1}}&{\color{red}{y_1}}\\10,&3\end{pmatrix}$

Step 3: Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.

\begin{align*} &\;&y-{\color{red}{y}}_{\color{red}{1}}&={\color{blue}{m}}(x-{\color{red}{x}}_{\color{red}{1}})\\ &\;&y-{\color{red}{3}}&={\color{blue}{\frac25}}(x-{\color{red}{10}})\\ &\text{Simplify.}&y-3&=\frac25x-4 \end{align*}

Step 4: Write the equation in slope-intercept form.

$y=\frac25x-1$

### Try It

7) Find an equation of a line with slope $m=\frac{5}{6}$ and containing the point left $(6,3)$.

Solution

$y=\frac{5}{6}x-2$

8) Find an equation of a line with slope $m=\frac{2}{3}$ and containing the point $(9,2)$.

Solution

$y=\frac{2}{3}x-4$

### HOW TO

#### Find an equation of a line given the slope and a point.

1. Identify the slope.
2. Identify the point.
3. Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
4. Write the equation in slope–intercept form.

### Example 3.11.4

Find an equation of a line with slope $m=-\frac{1}{3}$ that contains the point $(6,-4)$. Write the equation in slope–intercept form.

Solution

Since we are given a point and the slope of the line, we can substitute the needed values into the point–slope form, $y-y_1$

Step 1: Identify the slope.

${m\;=\;}{\color{red}{-}}{}{\color{red}{\frac13}}{}$

Step 2: Identify the point.

$\left(\overset{{\color{blue}{x}}_{\color{blue}{1}}}6,\;\overset{{\color{blue}{y}}_{\color{blue}{1}}}-4\right)$

Step 3: Substitute the values into $y-y_1=m(x-x_1)$

\begin{align*}y-{\color{blue}{y}}_{\color{blue}{1}}&={\color{red}{m}}(x-{\color{blue}{x}}_{\color{blue}{1}})\\y-({\color{blue}{-}}{\color{blue}{4}})&={\color{red}{-}}{\color{red}{\frac13}}(x-{\color{blue}{6}})\end{align*}

Step 4: Simplify.

${y\;-\;4\;=\;}{\color{black}{-}}{\color{black}{\frac13}}{x\;-\;6}$

Step 5: Write in slope–intercept form.

${y\;=\;}{\color{black}{-}}{\color{black}{\frac13}}{x\;-\;2}$

### Try It

9) Find an equation of a line with slope $m=-\frac{2}{5}$ and containing the point $(10,-5)$.

Solution

$y=-\frac{2}{5}x-1$

10) Find an equation of a line with slope $m=-\frac{3}{4}$, and containing the point $(4,-7)$.

Solution

$y=-\frac{3}{4}x-4$

### Example 3.11.5

Find an equation of a horizontal line that contains the point $(-1,2)$. Write the equation in slope–intercept form.

Solution

Every horizontal line has slope $0$. We can substitute the slope and points into the point–slope form, $y-y_1=m(x-x_1)$.

Step 1: Identify the slope.

${m\;=\;}{\color{red}{0}}$

Step 2: Identify the point.

$\left(\overset{{\color{blue}{x}}_{\color{blue}{1}}}{-1},\;\overset{{\color{blue}{y}}_{\color{blue}{1}}}2\right)$

Step 3: Substitute the values into $y-y_1=m(x-x_1)$.

\begin{align*} &\;&y-{\color{blue}{y}}_{\color{blue}{1}}&={\color{red}{m}}(x-{\color{blue}{x}}_{\color{blue}{1}})\\ &\;&y-{\color{blue}{2}}&={\color{red}{0}}(x-({\color{blue}{-}}{\color{blue}{1}}))\\ &\text{Simplify.}&y-2&=(x+1)\\ &\;&y-2&=0\\ &\;&y&=2 \end{align*}

Step 4: Write in slope–intercept form.

It is in $y$-form, but could be written $y=0x+2$.

Did we end up with the form of a horizontal line, $y=a$?

### Try It

11) Find an equation of a horizontal line containing the point $(-3,8)$.

Solution

$y=8$

12) Find an equation of a horizontal line containing the point $(-1,4)$.

Solution

$y=4$

## Find an Equation of the Line Given Two Points

When real-world data is collected, a linear model can be created from two data points. In the next example we’ll see how to find an equation of a line when just two points are given.

We have two options so far for finding an equation of a line: slope–intercept or point–slope. Since we will know two points, it will make more sense to use the point–slope form.

But then we need the slope. Can we find the slope with just two points? Yes. Then, once we have the slope, we can use it and one of the given points to find the equation.

### Example 3.11.6

Find an equation of a line that contains the points $(5,4)$ and $(3,6)$. Write the equation in slope–intercept form.

Solution

Step 1: Find the slope using the given points.
Find the slope of the line through (5,4) and (3,6)

\begin{align*} m&=\frac{y_2-y_1}{x_2-x_1}\\ m&=\frac{6-4}{3-5}\\ m&=\frac{2}{-2}\\ m&=-1 \end{align*}

Step 2: Choose one point.
Chose either point.

$\begin{pmatrix}{\color{red}{x_1}}&{\color{red}{y_1}}\\5,&4\end{pmatrix}$

Step 3: Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.

\begin{align*} y-y_1&=m(x-x_1)\\ y-4&=-1(x-5)\\ y-4&=-1x+5\\ y&=-1x+9 \end{align*}

Step 4: Write the equation in slope-intercept form.

$y=-1x+9$

Use the point $(3,6)$ and see that you get the same equation.

### Try It

13) Find an equation of a line containing the points $(3,1)$ and $(5,6)$.

Solution

$y=\frac{5}{2}x-\frac{13}{2}$

14) Find an equation of a line containing the points $(1,4)$ and $(6,2)$.

Solution

$y=-\frac{2}{5}x+\frac{22}{5}$

### HOW TO

#### Find an equation of a line given two points.

1. Find the slope using the given points.
2. Choose one point.
3. Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
4. Write the equation in slope–intercept form.

### Example 3.11.7

Find an equation of a line that contains the points $(-3,-1)$ and $(2,-2)$. Write the equation in slope–intercept form.

Solution

Since we have two points, we will find an equation of the line using the point–slope form. The first step will be to find the slope.

Step 1: Find the slope of the line through $(−3, −1)$ and $(2, −2)$.

\begin{align*} m&=\frac{y_2-y_1}{x_2-x_1}\\ m&=\frac{-2-(-1)}{2-(-3)}\\ m&=\frac{-1}5\\ {\color{red}{m}}&={\color{blue}{\frac{-1}5}} \end{align*}

Step 2: Choose either point.

$\left(\overset{{\color{blue}{x}}_{\color{blue}{1}}}2,\;-\overset{{\color{blue}{y}}_{\color{blue}{1}}}2\right)$

Step 3: Substitute the values into $y-y_1=m(x-x_1)$.

\begin{align*}y-{\color{blue}{y}}_{\color{blue}{1}}&={\color{red}{m}}(x-{\color{blue}{x}}_{\color{blue}{1}})\\y-{\color{blue}{(}}{\color{blue}{-}}{\color{blue}{2}}{\color{blue}{)}}&={\color{red}{-}}{\color{red}{\frac15}}(x-{\color{blue}{2}})\\y+2&=-\frac15x+\frac25\end{align*}

Step 4: Write in slope–intercept form.

$y\;=\;-\frac15x\;-\;\frac85$

### Try It

15) Find an equation of a line containing the points $(-2,-4)$ and $(1,-3)$.

Solution

$y=\frac{1}{3}x-\frac{10}{3}$

16) Find an equation of a line containing the points $(-4,-3)$ and $(1,-5)$.

Solution

$y=-\frac{2}{5}x-\frac{23}{5}$

### Example 3.11.8

Find an equation of a line that contains the points $(-2,4)$ and $(-2,-3)$. Write the equation in slope–intercept form.

Solution

Again, the first step will be to find the slope.

Find the slope of the line through $(-2,4)$ and $(-2,-3)$

\begin{align*} m&=\frac{y_2-y_1}{x_2-x_1}\\ m&=\frac{-3-4}{-2-(-2)}\\ m&=\frac{-7}{0} \end{align*}

The slope is undefined.

This tells us it is a vertical line. Both of our points have an $x$-coordinate of $-2$. So our equation of the line is $x=-2$. Since there is no $y$, we cannot write it in slope–intercept form.

You may want to sketch a graph using the two given points. Does the graph agree with our conclusion that this is a vertical line?

### Try It

17) Find an equation of a line containing the points $(5,1)$ and $(5,-4)$.

Solution

$x=5$

18) Find an equation of a line containing the points $(-4,4)$ and $(-4,3)$.

Solution

$x=-4$

We have seen that we can use either the slope–intercept form or the point–slope form to find an equation of a line. Which form we use will depend on the information we are given. This is summarized in the table below.

To Write an Equation of a Line
If given: Use: Form:
Slope and $y$-intercept slope–intercept $y = mx + b$
Slope and a point point–slope $y-y_1=m(x-x_1)$
Two points point–slope $y-y_1=m(x-x_1)$

## Find an Equation of a Line Parallel to a Given Line

Suppose we need to find an equation of a line that passes through a specific point and is parallel to a given line. We can use the fact that parallel lines have the same slope. So we will have a point and the slope—just what we need to use the point–slope equation.

First let’s look at this graphically.

The graph shows the graph of $y=2x-3$. We want to graph a line parallel to this line and passing through the point $(-2,1)$.

We know that parallel lines have the same slope. So the second line will have the same slope as $y=2x-3$. That slope is $m_\parallel=2$. We’ll use the notation $m$ to represent the slope of a line parallel to a line with slope $m$. (Notice that the subscript || looks like two parallel lines.)

The second line will pass through $(-2,1)$ and have $m=2$. To graph the line, we start at $(-2,1)$ and count out the rise and run. With $m=2$ (or $m=\frac{2}{1}$), we count out the rise $2$ and the run $1$. We draw the line.

Do the lines appear parallel? Does the second line pass through $(-2,1)$?

Now, let’s see how to do this algebraically.

We can use either the slope–intercept form or the point–slope form to find an equation of a line. Here we know one point and can find the slope. So we will use the point–slope form.

### Example 3.11.9

Find an equation of a line parallel to $y=2x-3$ that contains the point $(-2,1)$. Write the equation in slope–intercept form.

Solution

Step 1: Find the slope of the given line.
The line is in slope-intercept form, $y=2x-3$.

$m=2$

Step 2: Find the slope of the parallel line.
Parallel lines have the same slope.

$m_2=2$

Step 3: Identify the point.
The given point is, (-2,1).

$\begin{pmatrix}x_1&y_1\\-2,&1\end{pmatrix}$

Step 4: Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
Simplify.

\begin{align*} y-y_1&=m(x-x_1)\\ y-1&=2(x-(-2))\\ y-1&=2(x+2)\\ y-1&=2x+4 \end{align*}

Step 5: Write the equation in slope-intercept form.

$y=2x+5$

Does this equation make sense? What is the $y$-intercept of the line? What is the slope?

### Try It

19) Find an equation of a line parallel to the line $y=3x+1$ that contains the point $(4,2)$. Write the equation in slope–intercept form.

Solution

$y=3x-10$

20) Find an equation of a line parallel to the line $y=\frac{1}{2}x-3$ that contains the point $(6,4)$.

Solution

$y=\frac{1}{2}x+1$

### HOW TO

#### Find an equation of a line parallel to a given line.

1. Find the slope of the given line.
2. Find the slope of the parallel line.
3. Identify the point.
4. Substitute the values into the point–slope form, $y-y_1=m(x-x_1)$.
5. Write the equation in slope–intercept form.

## Find an Equation of a Line Perpendicular to a Given Line

Now, let’s consider perpendicular lines. Suppose we need to find a line passing through a specific point and which is perpendicular to a given line. We can use the fact that perpendicular lines have slopes that are negative reciprocals. We will again use the point–slope equation, like we did with parallel lines.

The graph shows the graph of $y=2x-3$. Now, we want to graph a line perpendicular to this line and passing through $(-2,1)$.

We know that perpendicular lines have slopes that are negative reciprocals. We’ll use the notation $m_\perp$ to represent the slope of a line perpendicular to a line with slope m. (Notice that the subscript $\perp$ looks like the right angles made by two perpendicular lines.)

$y=2x-3$         perpendicular line

$m=2$                  $m-\perp=\frac{1}{2}$

We now know the perpendicular line will pass through $(-2,1)$ with $m_\perp=-\frac{1}{2}$

To graph the line, we will start at $(-2,1)$ and count out the rise $-1$ and the run $2$. Then we draw the line.

Do the lines appear perpendicular? Does the second line pass through $(-2,1)$?

Now, let’s see how to do this algebraically. We can use either the slope–intercept form or the point–slope form to find an equation of a line. In this example we know one point, and can find the slope, so we will use the point–slope form.

### Example 3.11.10

Find an equation of a line perpendicular to $y=2x-3$ that contains the point $(-2,1)$. Write the equation in slope–intercept form.

Solution

Step 1: Find the slope of the given line.
The line is in slope-intercept form, $y=2x-3$.

$m=2$

Step 2: Find the slope of the perpendicular line.
The slopes of perpendicular lines are negative reciprocals.

$m_\perp=-\frac12$

Step 3: Identify the point.
The given point is, (-2,1)

$\begin{pmatrix}x_1&y_1\\-2,&1\end{pmatrix}$

Step 4: Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
Simplify.

\begin{align*} y-y_1&=m(x-x_1)\\ y-1&=-\frac12(x-(-2))\\ y-1&=-\frac12(x+2)\\ y-1&=-\frac12x-1 \end{align*}

Step 5: Write in slope-intercept form.

$y=-\frac12x$

### Try It

21) Find an equation of a line perpendicular to the line $y=3x+1$ that contains the point $(4,2)$. Write the equation in slope–intercept form.

Solution

$y=-\frac{1}{3}x+\frac{10}{3}$

22) Find an equation of a line perpendicular to the line $y=\frac{1}{2}x-3$ that contains the point $(6,4)$.

Solution

$y=-2x+16$

### HOW TO

#### Find an equation of a line perpendicular to a given line.

1. Find the slope of the given line.
2. Find the slope of the perpendicular line.
3. Identify the point.
4. Substitute the values into the point–slope form, $y-y_1=m(x-x_1)$.
5. Write the equation in slope–intercept form.

### Example 3.11.11

Find an equation of a line perpendicular to $x=5$ that contains the point $(3,-2)$. Write the equation in slope–intercept form.

Solution

Again, since we know one point, the point–slope option seems more promising than the slope–intercept option. We need the slope to use this form, and we know the new line will be perpendicular to $x=5$. This line is vertical, so its perpendicular will be horizontal. This tells us the $m_\perp=0$.

Step 1: Identify the point.

$(3,-2)$

Step 2: Identify the slope of the perpendicular line.

$m_\perp=0$

Step 3: Substitute the values into $y-y_1=m(x-x_1)$.

\begin{align*} y-y_1&=m(x-x_1)\\ y-(-2)&=0(x-3)\\ y+2&=0\\ y&=-2 \end{align*}

Step 4: Simplify.

$y=-2$

Sketch the graph of both lines. Do they appear to be perpendicular?

### Try It

23) Find an equation of a line that is perpendicular to the line $x=4$ that contains the point $(4,-5)$. Write the equation in slope–intercept form.

Solution

$y=-5$

24) Find an equation of a line that is perpendicular to the line $x=2$ that contains the point $(2,-1)$. Write the equation in slope–intercept form.

Solution

$y=-1$

In Example 3.11.11, we used the point–slope form to find the equation. We could have looked at this in a different way.

We want to find a line that is perpendicular to $x=5$ that contains the point $(3,-2)$. The graph shows us the line $x=5$ and the point $(3,-2)$.

We know every line perpendicular to a vertical line is horizontal, so we will sketch the horizontal line through $(3,-2)$.

Do the lines appear perpendicular?

If we look at a few points on this horizontal line, we notice they all have $y$-coordinates of $-2$. So, the equation of the line perpendicular to the vertical line $x=5$ is $y=-2$.

### Example 3.11.12

Find an equation of a line that is perpendicular to $y=-4$ that contains the point $(-4,2)$. Write the equation in slope–intercept form.

Solution

The line $y=-4$ is a horizontal line. Any line perpendicular to it must be vertical, in the form $x=a$. Since the perpendicular line is vertical and passes through $(-4,2)$, every point on it has an $x$-coordinate of $-4$. The equation of the perpendicular line is $x=-4$. You may want to sketch the lines. Do they appear perpendicular?

### Try It

25) Find an equation of a line that is perpendicular to the line $y=1$ that contains the point $(-5,1)$. Write the equation in slope–intercept form.

Solution

$x=-5$

26) Find an equation of a line that is perpendicular to the line $y=-5$ that contains the point $(-4,-5)$.

Solution

$x=-4$

Access this online resource for additional instruction and practice with finding the equation of a line.

## Key Concepts

• To Find an Equation of a Line Given the Slope and a Point
1. Identify the slope.
2. Identify the point.
3. Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
4. Write the equation in slope-intercept form.
• To Find an Equation of a Line Given Two Points
1. Find the slope using the given points.
2. Choose one point.
3. Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
4. Write the equation in slope-intercept form.
• To Write and Equation of a Line
• If given slope and $y$-intercept, use slope–intercept form $y=mx+b$.
• If given slope and a point, use point–slope form $y-y_1=m(x-x_1)$.
• If given two points, use point–slope form $y-y_1=m(x-x_1)$.
• To Find an Equation of a Line Parallel to a Given Line
1. Find the slope of the given line.
2. Find the slope of the parallel line.
3. Identify the point.
4. Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
5. Write the equation in slope-intercept form.
• To Find an Equation of a Line Perpendicular to a Given Line
• Find the slope of the given line.
• Find the slope of the perpendicular line.
• Identify the point.
• Substitute the values into the point-slope form, $y-y_1=m(x-x_1)$.
• Write the equation in slope-intercept form.

### Self Check

After completing the exercises, use this checklist to evaluate your mastery of the objectives of this section.

On a scale of 1-10, how would you rate your mastery of this section in light of your responses on the checklist? How can you improve this?

### Glossary

point–slope form
The point–slope form of an equation of a line with slope $m$ and containing the point $(x_1,y_1)$ is $y-y_1=m(x-x_1)$.
definition