# 8.2 Linear Functions

As you hop into a taxicab in Allentown, the meter will immediately read $3.30; this is the “drop” charge made when the taximeter is activated. After that initial fee, the taximeter will add$2.40 for each kilometer the taxi drives. In this scenario, the total taxi fare depends upon the number of kilometers ridden in the taxi, and we can ask whether it is possible to model this type of scenario with a function. Using descriptive variables, we choose $d$ for distance in kilometers and $C$ for cost in dollars as a function of kilometers: $C(d)$.

We know for certain that $C(0)=3.30$, since the $3.30 drop charge is assessed regardless of how many kilometers are driven. Since$2.40 is added for each kilometer driven, we could write that if $d$ kilometers are driven, $C(d)=3.30+2.40d$ because we start with a $3.30 drop fee and then for each kilometer increase we add$2.40.

It is good to verify that the units make sense in this equation. The $3.30 drop charge is measured in dollars; the$2.40 charge is measured in dollars per kilometer. So

$C(d)=3.30\text{ dollars}+\left(2.40\frac{\text{dollars}}{\text{kilometers}}\right) (d\text{ kilometers})$

When dollars per kilometer are multiplied by a number of kilometers, the result is a number of dollars, matching the units on the 3.30, and matching the desired units for the $C$ function.

Notice this equation $C(d)=3.30+2.40d$ consisted of two fixed quantities. The first is the fixed $3.30 charge which does not change based on the value of the input. The second is the$2.40 dollars per kilometer value, which is a rate of change in cost with respect to distance driven. In the equation this rate of change is multiplied by the input value.

Looking at this same problem in table format we can also see the cost changes by $2.40 for every 1 kilometer increase:  $d$ 0 1 2 4 $C(d)$ 3.3 5.7 8.1 10.5 It is important here to note that in this equation, the rate of change is constant; over any equal distance intervals, the change in cost is the same. When graphing this function, the distance will be on the horizontal axis and the cost will be on the vertical because distance is the independent and cost is the dependent variable. When we graph the function we will see that the shape of $C(d)=3.30+2.40d$ is a line, which is how these types of functions get their name: linear functions. When the number of kilometers is zero, the cost is$3.30, giving the point (0, 3.30) on the graph. This is the vertical, or $C$-, intercept. The graph is increasing in a straight line from left to right because for each kilometer the cost goes up by $2.40; this rate remains constant. Also note that, in this particular case, the line does not extend indefinitely on both sides. If we consider the domain of this function, i.e., the possible input values, we can see that although $C(d)$ can be (mathematically) calculated for any value of $d$, within the context of what $d$ and $C(d)$ represent, the value of $d$ cannot be negative. ## Linear Function A linear function is a function whose values change at a constant rate. The graph of a linear function produces a straight line. ### Slope-Intercept Form of a Line Linear functions can always be written in the form $f(x)=mx+b$ or $f(x)=b+mx$ where $b$ is the initial or starting value of the function (with input $x = 0$), and $m$ is the constant rate of change of the function. This form of a line equation is called slope-intercept form of a line. Note that we conventionally use parameter names $m$ and $b$ in a general equation of a linear function, however they could be represented by any other name, as long as their meaning is defined in the context of the function. For example, the labour charge applied by a mechanic may be represented by $C(t)=rt+I$ where $C$ is the labour charge applied for work performed over $t$ hours at the rate of $r$ dollars per hour and with an initial charge of $I$ dollars. #### Concept Check Linear or not? Mathmatize: Linear or not? ### Slope and Increasing vs. Decreasing Given a line $f(x)=mx+b$, the number $m$ represents the constant rate of change of the function (called slope in the context of the graph of the function). The slope determines if the function is an increasing function or a decreasing function. • $f(x)=mx+b$ is an increasing function if $m\gt 0$. • $f(x)=mx+b$ is a decreasing function if $m\lt 0$. If $m=0$, the rate of change is 0, and the function $f(x)=0x+b=b$ is just a horizontal line passing through the point (0, b), neither increasing nor decreasing. #### Visual demonstration Follow the link below to see the effect on the graph of a linear function $f(x)=mx+b$ while changing the value of rate of change parameter $m$ and the initial value $b$. Graphs of linear functions #### Example 1 Marcus currently owns 200 songs in his iTunes collection. Every month, he adds 15 new songs. Write a formula for the number of songs, $N$, in his iTunes collection as a function of the number of months, $m$. How many songs will he own in a year? Answer: The initial value for this function is 200, since he currently owns 200 songs, so $N(0)=200$. The number of songs increases by 15 songs per month, so the rate of change is 15 songs per month. With this information, we can write the formula $N(m)=15m+200$ Using the formula for $N(m)$, we can predict how many songs he will have in 1 year (12 months): $N(12)=200+15(12)=200+180=380$ Therefore, Marcus will have 380 songs in one year. #### Concept Check MathMatize: Reading and interpreting linear functions ### Calculating Rate of Change Because the rate of change in a linear function is constant, it is determined using the general relationship $m=\dfrac{\text{change in output}}{\text{change in input}}$ To calculate the change in output given the change in input, we need a pair of input and output values of the function. So if $f(x)=mx+b$ for some $m$ and $b$, then for any two distinct values for the input, $x_1$ and $x_2$, we get that $m=\dfrac{\text{change in output}}{\text{change in input}}=\dfrac{\Delta f}{\Delta x}=\dfrac{f(x_2)-f(x_1)}{x_2-x_1}$ Note that the symbol $\Delta$, read “delta”, is the upper case Greek letter for d, representing difference, or change. #### Example 2 The population of a city increased from 23,400 to 27,800 between 2002 and 2006. Assuming that the population grew at a constant rate, find the rate of change of the population during this time span and interpret the result. Answer: In this relationship, the output is the size of the population and the input is the year. The rate of change will relate the change in output to the change in input, i.e., change in population to the change in time. The population increased by 27800-23400=4400 people over the 4 year time interval. To find the rate of change, or the change in the number of people per year: $\dfrac{\text{change in output}}{\text{change in input}}=\dfrac{27800-23400}{2006-2002}=\dfrac{4400}{4}=1100 \text{ people per year}$ This means that the population was increasing by 1100 people per year between 2002 and 2006. (Note that we knew the population was increasing, so we would expect our value for the rate of change to be positive. This is a quick way to check to see if your value for the rate of change is reasonable.) #### Example 3 The pressure $P$ (in pounds per square inch, or PSI) on a diver depends upon their depth below the water surface $d$ (in feet) following the equation $P(d)=14.696+0.43d$. Interpret the components of this function. Answer: In this relationship, the output is the pressure $P$ and the input is the depth $d$, and so $P(d)$ represents pressure at depth $d$.The rate of change, or slope, 0.434 represents the change in output in relation to the change in input, so the change in pressure in relation to the change in depth. Since the rate of change is positive, this tells us the pressure on the diver increases by 0.434 PSI for each foot their depth increases. The initial value, 14.696, represents the value of $P(0)$, i.e., the pressure at 0 depth, so this tells us that at a depth of 0 feet, the pressure on the diver will be 14.696 PSI. We can now find the rate of change given two input-output pairs, and could write an equation for a linear function if we had the rate of change and initial value. If we have two input-output pairs and they do not include the initial value of the function, then we will have to solve for it. #### Example 4 Determine the equation for the linear function graphed below. Answer: Looking at the graph, we can see that the input is $x$ and the output is $f(x)$ and that the line passes through the points (0, 7) and (4, 4). From the first point, we know that $f(0)=7$ and so the initial value of the function is $b = 7$. In addition, the rate of change can be calculated as follows: $m=\dfrac{\Delta\text{output}}{\Delta\text{input}}=\dfrac{4-7}{4-0}=\dfrac{-3}{4}=-\dfrac{3}{4}$ This allows us to write the equation for $f(x)$: $f(x)=-\frac{3}{4}x+7$ #### Example 5 If $f(x)$ is a linear function, $f(3)=-2$, and $f(8)=1$, find the equation for the function. Answer: The task is to determine the equation for $f(x)$. The input is $x$ and the output is $f(x)$. Since $f(x)$ is a linear function, it can be written as $f(x)$ for some values $m$ and $b$. We are given two input-output pairs: (3,-2) and (8,1). Thus, the rate of change will be $m=\dfrac{\Delta\text{output}}{\Delta\text{input}}=\dfrac{f(8)-f(3)}{8-3}=\dfrac{1-(-2)}{8-3}=\frac{3}{5}$ Using the rate of change, we know the equation will have the form $f(x)=\frac{3}{5}x+b$. In this case, we do not know the initial value $f(0)$, so we will have to solve for it. Since we know the value of the function when $x = 3$, we can evaluate the function at 3: $f(3)=b+\frac{3}{5}(3)$. Since we know that $f(3)=-2$, we can substitute on the left side: $-2=b+\frac{3}{5}(3)$. This leaves us with an equation we can solve for the initial value: $b=-2-\frac{9}{5}=-\frac{19}{5}$ Combining this with the value for the rate of change, we can now write a formula for this function: $f(x)=\frac{3}{5}x-\frac{19}{5}$ #### Example 5: Alternative solution (using math symbols) Same problem as above. Compare step by step the text solution above with the solution below that uses primarily math symbols. Answer: Task: $f(x)=?$ $x$ input, $f$ output, linear function $\Rightarrow f(x)=mx+b$ for some $m$ and $b$. $m=?$ $f(3)=-2$, $f(8)=1$ $\Rightarrow m=\frac{\Delta\text{output}}{\Delta\text{input}}=\dfrac{f(8)-f(3)}{8-3}=\dfrac{1-(-2)}{8-3}=\dfrac{3}{5}$ $\Rightarrow f(x)=\dfrac{3}{5}x+b$ $b=?$ $f(3)=-2$ $\Rightarrow \dfrac{3}{5}(3)+b=-2$ $\Rightarrow b=-2-\frac{9}{5}=-\frac{19}{5}$ $\Rightarrow f(x)=\dfrac{3}{5}x-\dfrac{19}{5}$ As an alternative to the approach used above to find the initial value, $b$, we can use the point-slope form of a line instead. ### Point-Slope Equation of a Line An equation for the line passing through the point $(x_1, y_1)$ with slope $m$ can be written as $y-y_1=m(x-x_1)$ This is called the point-slope form of a line. This formula is useful if you know a point on the line and the slope. By re-arranging it to solve for $y$ you can rewrite it into slope-intercept form. #### Example 6 Working as an insurance salesperson, Ilya earns a base salary and a fixed rate for each new policy, so Ilya’s weekly income, $I$, depends on the number of new policies, $n$, he sells during the week. Last week he sold 3 new policies and earned$760 for the week. The week before, he sold 5 new policies and earned $920. Find the equation for $I(n)$ and interpret the meaning of the components of the equation. Answer: The task is to find $I(n)$ and so the weekly income $I$ is the output and the number of policies $n$ is the input. Since the income is based on a fixed rate applied for each new policy, this represents a linear relationship so we can write $I(n)=mn+b$ for some $m$ and $b$. The given information gives us two input-output pairs: (3,760) and (5,920). We start by finding the rate of change: $m=\dfrac{I(5)-I(3)}{5-3}=\dfrac{920-760}{5-3}=\dfrac{160}{2}=80$ This means that the income increases by$80 per policy, i.e., Ilya earns at the rate of 80 for each policy sold during the week. We can now write the equation using the point-slope form of the line, using the slope we just found and the point (3,760): $I-760= 80(n-3)$ To find the equation for $I$ in terms of $n$, we need to rewrite the above equation into that form: \begin{align*} I-760 & = 80(n-3)\\ I-760 & = 80n-240\\ I & = 80n+520 \end{align*} Therefore, $I(n)=80n+520$. This tells us that $I(0)=520$ so Ilya’s earns the base salary, before selling any policies, in the amount of520.

Hence, Ilya’s base weekly salary is $520 per week and he earns an additional$80 for each policy sold each week.

#### Example 6: Alternative solution (using math symbols)

Same problem as above. Compare step by step the text solution above with the solution below that uses primarily math symbols.

Task: $I(n)=?$ Interpret.

$n$ input, $I$ output, fixed income rate per policy sold so linear function

$\Rightarrow I(n)=mn+b$ for some $m$ and $b$.

$m=?$

$I(3)=760$, $I(5)=920$

$\Rightarrow m=\frac{\Delta\text{output}}{\Delta\text{input}}=\dfrac{I(5)-I(3)}{5-3}=\dfrac{920-760}{5-3}=80$

$\Rightarrow I(n)=80n+b$

$b=?$

point $(3,760)$, slope $m=80$, using point-slope equation

$\Rightarrow I-760 = 80(n-3)$

$\Rightarrow I-760 = 80n-240$

$\Rightarrow I = 80n+520$

$\Rightarrow I (n) = 80n+520$

Interpretation: Ilya earns $520 in basic weekly salary and an additional$80 for each new policy sold each week.

### Graphs of Linear Functions

Graphically, in the function $f(x)=mx+b$,

• $b$ is the vertical intercept of the graph and tells us that one point on the line is $(0, b)$
• $m$ is the slope of the line and tells us how far to rise and run to get to another point on the line.

Once we have at least two points, we can extend the graph of the line to the left and right, within the domain of the function.

#### Example 7

Graph $f(x)=5-\frac{2}{3}x$ using the vertical intercept and slope.

In this function, $x$ is the input so it will be on the horizontal axis and $f(x)$ is the output so it will be on the vertical axis.

Since $f(0)=5$, the vertical intercept of the line is (0, 5).

In addition, the slope is $-\frac{2}{3}=\frac{-2}{3}=\frac{\Delta\text{output}}{\Delta\text{input}}$. This tells us that for every increase by 3 units in input $x$, the output $f$ will decrease by 2 units.

In graphing, we can use this information by first plotting our vertical intercept on the graph, then using the slope to find a second point. From the initial value (0, 5) the slope tells us that if we move to the right 3, we will move down 2, moving us to the point (3, 3). We can continue this again to find a third point at (6, 1). Finally, extend the line to the left and right, containing these points.

### Graphing Using Transformations

Another option for graphing is to use transformations of the identity function $f(x)=x$.

In the equation $f(x)=mx$, the $m$ is acting as the vertical stretch of the identity function. When $m$ is negative, there is also a vertical reflection of the graph. Looking at some examples will also help show the effect of slope on the shape of the graph:

In $f(x)=mx+b$, the $b$ acts as the vertical shift, moving the graph up and down without affecting the slope of the line. Some examples:

#### Example 8

Match each equation with one of the lines in the graph below

\begin{align*} f(x) & = 2x+3\\ g(x) & = 2x-3\\ h(x) & = -2x+3\\ j(x) & = \frac{1}{2}x+3 \end{align*}

Only one graph has a vertical intercept of -3, so we can immediately match that graph with $g(x)$. For the three graphs with a vertical intercept at 3, only one has a negative slope, so we can match that line with $h(x)$. Of the other two, the steeper line would have a larger slope, so we can match that graph with equation $f(x)$, and the flatter line with the equation $j(x)$.

In addition to understanding the basic behavior of a linear function (increasing or decreasing, recognizing the slope and vertical intercept), it is often helpful to know the horizontal intercept of the function – where it crosses the horizontal axis.

#### Finding Horizontal Intercept

The horizontal intercept of the function is where the graph crosses the horizontal axis. If a function has a horizontal intercept, you can always find it by solving $f(x)=0$.

#### Example 9

Find the horizontal intercept of $f(x)=-3+\frac{1}{2}x$

Setting the function equal to zero to find what input will put us on the horizontal axis:

\begin{align*} 0 & = -3+\frac{1}{2}x\\ 3 & = \frac{1}{2}x\\ x & = 6 \end{align*}

Thus the graph crosses the horizontal axis at (6,0).

### Intersections of Lines

The graphs of two lines will intersect if they are not parallel. They will intersect at the point that satisfies both equations. To find this point when the equations are given as functions, we can solve for an input value so that $f(x)=g(x)$. In other words, we can set the formulas for the lines equal, and solve for the input that satisfies the equation.

Economics tells us that in a free market, the price for an item is related to the quantity that producers will supply and the quantity that consumers will demand. Increases in prices will decrease demand, while supply tends to increase with prices. Sometimes supply and demand are modeled with linear functions.

#### Example 10

The supply, in thousands of items, for custom phone cases can be modeled by the equation $s(p)=0.5+1.2p$ while the demand can be modeled by $d(p)=8.7-0.7p$, where $p$ is in dollars. Find the equilibrium price and quantity, the intersection of the supply and demand curves.

Setting $s(p)=d(p)$, we find

\begin{align*} 0.5+1.2p & = 8.7-0.7p\\ 1.9p & = 8.2\\ p & \approx \4.32 \end{align*}

We can find the output value of the intersection point by evaluating either function at this input: $s(4.32)=0.5+1.2(4.32)\approx 5.68$

These lines intersect at the point (4.32, 5.68). If we graph the two functions we can verify that this result seems reasonable:

In business, a very common application of functions is to model cost, revenue, and profit.

### Cost, Revenue, Profit

When a company produces $x$ items, the total cost $C(x)$ is the cost of total cost of producing those items. The total cost includes both fixed costs, which are startup costs, like equipment and buildings, and variable costs, which are costs that depend on the number of items produced, like materials and labor. In the most simple case, Cost = (variable cost rate)\cdot (number of units produced)+(fixed cost):

$C(x)=c_{variable} x+c_{fixed}$

Revenue is the amount of money a company brings in from sales. In the most simple case, Revenue = (number of units sold)\cdot (price per unit):

$R(x)=x\cdot p(x)$

Profit is the amount of money brings in, after expenses, i.e., Profit = Revenue – Cost:

$P(x)=R(x)-C(x)$

In marketing and financial planning, we often talk about the break-even point. This is the level of sales where the revenue equals the cost, or equivalently where profit is zero. This is typically the minimum level of sales necessary for the company to make a profit. The break-even point will occur when $R(x)=C(x)$ or, equivalently, when $P(x)=0$.

#### Example 11

A tech startup is looking at developing and launching a new mobile app. Initial development of the app will cost $300,000, and they estimate marketing and support for each user will cost$0.50. While the app will be free, they estimate they will be able to bring in $2 per user on average from in-app purchases. How many users will the company need to break even? Answer: We start by modeling the cost, revenue, and profit. Let $x$ = number of users. The fixed (initial) costs are$300,000, and the variable (per-item) costs as $0.50 per user. We can write the total cost equation: $C(x) = 300000 + 0.50x$ The revenue will be$2 per user, so the revenue equation will be:

$R(x) = 2x$

We could find the break-even point by setting the total cost equal to the revenue, which is equivalent to finding the intersection of the lines.

Algebraically: $x=?, R(x)=C(x)$

$R(x)=C(x)\Rightarrow 300000 + 0.50x=2x\Rightarrow 300000=1.5x\Rightarrow x=200000$

Therefore, the break-even point occurs at $x=200000$ users and the sales from in-app purchased in the amount of

$R(200000)=2\cdot 200000=\ 400,000$.

Graphically:

Alternatively, we could go ahead and find a profit equation first:

$P(x) = R(x) - C(x) = 2x - (300,000+0.50x) = 1.5x - 300,000$

The break even point can be found by setting the profit equal to zero:

\begin{align*} 0&=P(x)\\ &\Rightarrow 0 = 1.5x - 300,000\\ &\Rightarrow x = 200,000 \end{align*}

The company will have to acquire 200,000 users to break-even.

### Supply and Demand

In economics, there is a model for how prices are determined in a free market which states that supply and demand for a product is related to the price. The demand relationship shows the quantity of a certain product that consumers are willing to buy at a certain price. Typically the quantity demanded will decrease for an item if the price increases. The supply relationship shows the quantity of a product that suppliers are willing to produce at a certain sales price. Typically the supply demanded will increase if the price increases. Economic theory says that supply and demand will interact, and the intersection will be the equilibrium price, or market price, where the quantity supplied and demanded will be equal.

Thus, we can think of the supply quantity and the demand quantity as functions of price.

If $p$ is the price of a product, then

$x_D(p)$ represents the quantity of the product that is demanded by the consumers at a given price $p$.

$x_S(p)$ represents the quantity of the product that is supplied by the producers at a given price $p$.

Since the demand for a product typically decreases as the price charged increases, the demand curve is typically a decreasing function.

Since the supply of a product typically increases as the price paid increases, the supply curve is typically an increasing function.

The intersection of the demand and the supply curves is the equilibrium price and quantity, also called the market price and quantity. This point is often denoted as $(\bar{p},\bar{x})$.

Later in the course you will explore supply and demand curves that are non-linear, but in this section we will focus on linear supply and demand functions.

In most economic books you will see the supply and demand curve written with price as the input and quantity as the output, like $x(p)$. However, supply and demand graphs are drawn with price on the vertical axis and quantity on the horizontal, in other words as a function $p(x)$. Algebraically, we can write the equation in whichever way is more most appropriate for the context.

#### Example 12

At a price of $2.50 per gallon, there is a demand in a certain town for 42.5 thousand gallons of gas and a supply of 20 thousand gallons. At a price of$3.50, there is demand for 25.5 thousand gallons and a supply of 28 thousand gallons. Assuming supply and demand are linear, find the equilibrium price and quantity.

We start by finding a linear equation for both supply and demand. We will use price, $p$ in dollars, as the output and quantity, $x$ in thousands of gallons, as the input.

For supply, we have the points (20, 2.50) and (28, 3.50).

Finding the slope: $m = \dfrac{3.50-2.50}{28-20} = \frac{1}{8}$

We know the equation will look like $p = \frac{1}{8}x+b$, so substituting in (20, 2.50)

\begin{align*} 2.5 & = \frac{1}{8}(20) +b \\ 2.5 & = 2.5 +b \\ b & = 0 \end{align*}

The supply equation is: $p(x) = \frac{1}{8}x$\$

For demand, we have the points $(42.5, 2.50)$ and $(25.5, 3.50)$.

Using a similar approach, we can find the demand equation is: $p(x) = -\frac{1}{17}x+5$. (Verify.)

To find the equilibrium, we set the supply price equal to the demand price:

$\frac{1}{8}x = -\frac{1}{17}x+5$

Multiplying through by 8(17) = 136 to clear the fractions,

$136\left(\frac{1}{8}x\right) = 136\left(-\frac{1}{17}x+5\right)$

$17x = -8x+680$

Now we solve for $x$.

$25x = 680$

$x = 27.2$, which is the equilibrium quantity.

To find the equilibrium price, we can substitute the equilibrium quantity back into either equation:

$p = \frac{1}{8}(27.2) = 3.4$

The equilibrium will be achieved at $\bar{x}=27.2$ thousand gallons of gas at a price of $\bar{p}=\3.40$.

Graphically:

#### Concept in Action – Modeling Using Data

Complete the following set of exercises that will put into practice many of the concepts discussed in this section.

Mathmatize: Price, supply and demand investigation

## Exercises

Work on the following exercises. Discuss your solutions with your peers and/or course instructor.

Section 8.2 Exercises – Linear Functions