## Writing and Interpreting an Equation for a Linear Function

The equation of a linear function is different than that of the linear equations we solved in Unit 1 because it contains two variables. The two variables typically used in a linear function are $f(x)$ and $x$. The $x$ values in the equation represent the inputs to the function, and the $f(x)$ values represent the outputs. In addition to the variables $x$ and $f(x)$, the linear function contains a slope and a constant called the y-intercept.

Recall from Equations and Inequalities that we wrote equations in both the slope-intercept form and the point-slope form. Now we can choose which method to use to write equations for linear functions based on the information we are given. That information may be provided in the form of a graph, a point and a slope, two points, and so on. Look at the graph of the function $f$ in Figure 7.

Figure 7

We are not given the slope of the line, but we can choose any two points on the line to find the slope. Let's choose $(0,7)$ and $(4,4)$.

\begin{aligned} m &=\dfrac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ &=\dfrac{4-7}{4-0} \\ &=-\dfrac{3}{4} \end{aligned}

Now we can substitute the slope and the coordinates of one of the points into the point-slope form.

$\begin{array}{r} y-y_{1}=m\left(x-x_{1}\right) \\ y-4=-\dfrac{3}{4}(x-4) \end{array}$

If we want to rewrite the equation in the slope-intercept form, we would find

\begin{aligned} y-4 &=-\dfrac{3}{4}(x-4) \\ y-4 &=-\dfrac{3}{4} x+3 \\ y &=-\dfrac{3}{4} x+7 \end{aligned}

If we want to find the slope-intercept form without first writing the point-slope form, we could have recognized that the line crosses the $y$-axis when the output value is 7. Therefore, $b=7$. We now have the initial value $b$ and the slope $m$ so we can substitute $m$ and $b$ into the slope-intercept form of a line.

So the function is $f(x)=-\dfrac{3}{4} x+7$, and the linear equation would be $y=-\dfrac{3}{4} x+7$.

#### HOW TO

##### Given the graph of a linear function, write an equation to represent the function.

1. Identify two points on the line.
2. Use the two points to calculate the slope.
3. Determine where the line crosses the $y$-axis to identify the $y$-intercept by visual inspection.
4. Substitute the slope and $y$-intercept into the slope-intercept form of a line equation.

#### EXAMPLE 5

##### Writing an Equation for a Linear Function

Write an equation for a linear function given a graph of $f$ shown in Figure 8.

Figure 8

##### Solution

Identify two points on the line, such as $(0,2)$ and $(-2,-4)$. Use the points to calculate the slope.

\begin{aligned} m &=\dfrac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ &=\dfrac{-4-2}{-2-0} \\ &=\dfrac{-6}{-2} \\ &=3 \end{aligned}

Substitute the slope and the coordinates of one of the points into the point-slope form.

\begin{aligned} y-y_{1} &=m\left(x-x_{1}\right) \\ y-(-4) &=3(x-(-2)) \\ y+4 &=3(x+2) \end{aligned}

We can use algebra to rewrite the equation in the slope-intercept form.

\begin{aligned} y+4 &=3(x+2) \\ y+4 &=3 x+6 \\ y &=3 x+2 \end{aligned}

##### Analysis

This makes sense because we can see from Figure 9 that the line crosses the $y$-axis at the point $(0,2)$, which is the $y$-intercept, so $b=2$.

Figure 9

#### EXAMPLE 6

##### Writing an Equation for a Linear Cost Function

Suppose Ben starts a company in which he incurs a fixed cost of $\ 1,250$ per month for the overhead, which includes his office rent. His production costs are $\ 37.50$ per item. Write a linear function $C$ where $C(x)$ is the cost for $x$ items produced in a given month.

##### Solution

The fixed cost is present every month, $\ 1,250$. The costs that can vary include the cost to produce each item, which is $\ 37.50$. The variable cost, called the marginal cost, is represented by $37.5$. The cost Ben incurs is the sum of these two costs, represented by $C(x)=1250+37.5 x$.

##### Analysis

If Ben produces 100 items in a month, his monthly cost is found by substituting 100 for $x$.

\begin{aligned} C(100) &=1250+37.5(100) \\ &=5000 \end{aligned}

So his monthly cost would be $\ 5,000$.

#### EXAMPLE 7

##### Writing an Equation for a Linear Function Given Two Points

If $f$ is a linear function, with $f(3)=-2$, and $f(8)=1$, find an equation for the function in slopeintercept form.

##### Solution

We can write the given points using coordinates.

\begin{aligned} &f(3)=-2 \rightarrow(3,-2) \\ &f(8)=1 \rightarrow(8,1) \end{aligned}

We can then use the points to calculate the slope.

\begin{aligned} m &=\dfrac{y_{2}-y_{1}}{x_{2}-x_{1}} \\ &=\dfrac{1-(-2)}{8-3} \\ &=\dfrac{3}{5} \end{aligned}

Substitute the slope and the coordinates of one of the points into the point-slope form.

\begin{aligned} y-y_{1} &=m\left(x-x_{1}\right) \\ y-(-2) &=\dfrac{3}{5}(x-3) \end{aligned}

We can use algebra to rewrite the equation in the slope-intercept form.

\begin{aligned} y+2 &=\dfrac{3}{5}(x-3) \\ y+2 &=\dfrac{3}{5} x-\dfrac{9}{5} \\ y &=\dfrac{3}{5} x-\dfrac{19}{5} \end{aligned}

#### TRY IT #3

If $f(x)$ is a linear function, with $f(2)=-11$, and $f(4)=-25$, write an equation for the function in slope-intercept form.

Source: Rice University, https://openstax.org/books/college-algebra/pages/4-1-linear-functions