Skip to main content

Section 7.2 Equation of a Line

In this section, we will talk about the entire equation for a linear function.

In this class, we will only write our linear functions like this:

\begin{equation} f(x)=mx+b\label{eqtn-linearfn}\tag{1} \end{equation}

where \(m\) represents the slope and \(b\) represents the \(y\)-value of the \(y\)-intercept. You might also see it written as \(y=mx+b\text{.}\) If you have seen other ways of writing equations of lines (like \((y-y_1)=m(x-x_1)\)), you are welcome to use them in the middle of a problem if you find it helpful. However, we won't talk about these other forms, and our final answers will always be written as in equation (1).

Example 7.8.

Suppose we have the function

\begin{equation*} f(x)=-7x+2 \end{equation*}

Then we know that the slope of this line is \(-7\) and the \(y\)-intercept is \((0,2)\text{.}\)

Note that if you forget that \(b\) is the \(y\)-value of the \(y\)-intercept, you can still find the \(y\)-intercept using the same strategy you learned in Section 1.1. Using that strategy, the above example would look like this:

To find the \(y\)-intercept, we are looking for where the graph would cross the \(y\)-axis, which is where \(x=0\text{.}\) So we solve:

\begin{align*} y\amp=-7(0)+2\\ y\amp=2 \end{align*}

Don't forget to write the intercept as an ordered pair: \((0,2)\text{.}\)

Checkpoint 7.9.

Find the slope and \(y\)-intercept of \(f(x)=3-2x\text{.}\)

Answer.
  • The slope is \(-2\)

  • The \(y\)-intercept is \((0,3)\text{.}\)

Solution.

Remembering that the slope is the number that is multiplied by \(x\text{,}\) we have that the slope is \(-2\text{.}\) We know that the number that is not attached to \(x\) is the \(y\)-value of the \(y\)-intercept. Writing the answer as an orderd pair, we have that the \(y\)-intercept is \((0,3)\text{.}\)

Subsection 7.2.1 Writing the Equation when Given Slope

When we are given the slope and the \(y\)-intercept of a line, we can just plug them into our format from equation (1).

Example 7.10.

Suppose we know that the slope of a line is 4 and the \(y\)-intercept is at \((0,-5)\text{.}\) Then we use the format \(f(x)=mx+b\) and plug in our slope for \(m\) and the intercept into \(b\text{:}\)

\begin{equation*} f(x)=4x-5 \end{equation*}

Checkpoint 7.11.

Write the equation of the linear function with slope -10 and \(y\)-intercept \((0,6)\text{.}\)

Answer.

\(f(x)=-10x+6\)

Solution.

Since we know the slope and the \(y\)-intercept, we use the format \(f(x)=mx+b\) and plug in our slope for \(m\) and the intercept into \(b\text{:}\)

\begin{equation*} f(x)=-10x+6 \end{equation*}

Sometimes, we are given the slope but not the \(y\)-intercept. In that case, we'll be given some other point on the graph. This situation will come up often: we have most of the equation we need, but we're missing one number and we have a point on the graph. Whenever this happens, we just plug in the values for \(x\) and \(y\) and solve for what we're missing.

Example 7.12.

Suppose we're trying to find the equation of the line with slope \(2\) and goes through the point \((3,2)\text{.}\) Since we know the slope, we can plug that into our formula: \(f(x)=2x+b\text{.}\) However, we don't have the \(y\)-intercept. We do have a point on the graph, so we can plug in those values to solve for \(b\text{:}\)

\begin{align*} 2 \amp= 2(3)+b\\ 2 \amp= 6 + b\\ -4 \amp b \end{align*}

Therefore, our final answer is \(f(x)=2x-4\text{.}\)

Checkpoint 7.13.

Write the equation of the linear function with slope \(-3\) and goes through the point \((1,7)\text{.}\)

Answer.

\(f(x)=-3x+10\)

Solution.

Since we know the slope, we can plug that into our formula: \(f(x)=-3x+b\text{.}\) However, we don't have the \(y\)-intercept. We do have a point on the graph, so we can plug in those values to solve for \(b\text{:}\)

\begin{align*} 7 \amp= -3(1)+b\\ 7 \amp= -3 + b\\ 10 \amp b \end{align*}

Therefore, our final answer is \(f(x)=-3x+10\text{.}\)

Subsection 7.2.2 Writing the Equation when Not Given Slope

We do always need to know the slope in order to write the equation of a line, but we aren't always given the slope. Luckily, we know from Section 7.1 how to find the slope!

Example 7.14.

Suppose we want to find the equation of the line that goes through the points \((-1,-5)\) and \((2, 7)\text{.}\) We don't know the slope, but we can use what we learned in Section 7.1 to compute the slope:

\begin{equation*} \dfrac{7-(-5)}{2-(-1)}=\dfrac{7+5}{2+1} = \dfrac{12}{3}=4 \end{equation*}

So we can plug the slope into our formula: \(f(x)=4x+b\text{.}\) We can use what we learned from the examples above to find \(b\text{.}\) In this case, we have two points we could plug in. You can pick either one, they'll both give you the same answer.

\begin{align*} -5 \amp= 4(-1)+b\\ -5 \amp= -4 + b\\ -1 \amp=b \end{align*}

So we have our final answer: \(f(x)=4x-1\text{.}\)

Since you could plug in either point and it will give you the same value for \(b\text{,}\) that's a great way to check your work during an exam: plug in both points. If they give you the same number, your answer is probably the right one. If they give you different numbers, you know you made a mistake somewhere, and you can go check your work.

Checkpoint 7.15.

Write the equation of the line that goes through the points \((-3,2)\) and \((1, -18)\text{.}\)

Answer.

\(f(x)=-5x-13\)

Solution.

We don't know the slope, but we can use what we learned in Section 7.1 to compute the slope:

\begin{equation*} \dfrac{-18-(2)}{1-(-3)}=\dfrac{-20}{4} = -5 \end{equation*}

So we can plug the slope into our formula: \(f(x)=-5x+b\text{.}\) In this case, we have two points we could plug in to find \(b\text{.}\) We can pick either one, they'll both give us the same answer. Let's try using \((-3,2)\text{.}\)

\begin{align*} 2 \amp= -5(-3)+b\\ 2 \amp= 15 + b\\ -13 \amp=b \end{align*}

Let's check our answer by plugging in the other point:

\begin{align*} -18 \amp= -5(1)+b\\ -18 \amp= -5 + b\\ -13 \amp=b \end{align*}

We got the answer for \(b\text{,}\) which is what should happen! So we have our final answer: \(f(x)=-5x-13\text{.}\)

Subsection 7.2.3 Special Cases: Vertical and Horizontal Lines

Example 7.17.

Suppose we want to write the equation of the horizontal line through the point \((-3,8)\text{.}\) We know that the equation of a horizonal line is always \(y=\) something. Since we want it to go through the point \((-3,8)\text{,}\) we need the \(y\)-value to be \(8\text{.}\) Therefore, the equation is \(y=8\text{.}\)

Example 7.19.

Suppose we want to write the equation of the vertical line through the point \((-3,8)\text{.}\) We know that the equation of a vertical line is always \(x=\) something. Since we want it to go through the point \((-3,8)\text{,}\) we need the \(x\)-value to be \(-3\text{.}\) Therefore, the equation is \(x=-3\text{.}\)

Checkpoint 7.20.

  1. Write the equation of the horizontal line through the point \((5,-2)\text{.}\)

  2. Write the equation of the vertical line through the point \((9,0)\text{.}\)

Answer.
  1. \(\displaystyle y=-2\)

  2. \(\displaystyle x=9\)

Solution.
  1. We know that the equation of a horizonal line is always \(y=\) something. Since we want it to go through the point \((5,-2)\text{,}\) we need the \(y\)-value to be \(-2\text{.}\) Therefore, the equation is \(y=-2\text{.}\)

  2. We know that the equation of a vertical line is always \(x=\) something. Since we want it to go through the point \((9,0)\text{,}\) we need the \(x\)-value to be \(9\text{.}\) Therefore, the equation is \(x=9\text{.}\)