import matplotlib.pyplot as plt

In this post, we’ll look at some textbook applications of linear functions. Although these are contrived problems taken from a book, they shed some light on how to think about using linear functions to solve real business problems.

Highway tolls

Since heavier vehicles are responsible for more of the wear and tear on highways, drivers should pay tolls in direct proportion to the weight of their vehicles. Suppose a Toyota Camry weighing 3,350 lb was charged with $2.70 for traveling an 80-mile stretch of highway.

  1. Find an equation of variation that expresses the amount of the toll \(T\) as a function of the vehicle’s weight \(w\).
  2. What would the tool be if a 3,700-lb Jeep Cherokee drove the same stretch of highway?

The equation of variation is \(T = mw\), where \(m\) is the constant of variation, the rate at which the toll increases as the weight increases. To answer the second question, we need to find the value for \(m\), which can be done using the prior information for the Toyota. Head over to Symbolab to see the steps.

def toll(weight):
  m = 0.00080
  return m * weight
  
toll(3700)
## 2.96

Profit-and-loss analysis

Boxowitz, Inc., a computer firm, is planning to sell a new graphing calculator. For the first year, the fixed costs for setting up the new production line are $100,000. The variable costs for producing each calculator are estimated at $20. The sales department projects that 150,000 calculators can be sold during the first year for $45 each.

  1. Find a graph \(C(x)\), the total cost of producing \(x\) calculators.
  2. Using the same axes as in part (a), find a graph \(R(x)\), the total revenue from the sale of \(x\) calculators.
  3. Using the same axes as in part (a), find a graph \(P(x)\), the total profit from the production and sale of \(x\) calculators.
  4. What profit or loss will the firm realize if the expected sale of 150,000 calculators occurs?
  5. How many calculators must the firm sell to break even?

The cost of producing the calculators is \(C(x) = px + F\), where \(p\) is the variable price of each calculator and \(F\) is the fixed cost of production.

def cost(p, x, f):
  return (p * x) + f
  
costs = [cost(20, x, 100000) for x in range(1, 150001)]

The total revenue is \(R(x) = px\), where \(p\), in this case, is the sale price.

def revenue(p, x):
  return p * x
  
revenues = [revenue(45, x) for x in range(1, 150001)]

The total profit is \(P(x) = R(x) - C(x)\).

profits = [revenue(45, x) - cost(20, x, 100000) for x in range(1, 150001)]

If the firm realizes its sales goal of 150,000 calculators, it will make a profit of $3,650,000.

profits[-1]
## 3650000

The break even will happen at the point where \(C(x) = R(x)\), that is where \(P(x) = 0\).

profits.index(0)
## 3999

The graphical representation of this problem is the following.

plt.plot(costs, label = "costs")
plt.plot(revenues, label = "revenues")
plt.plot(profits, label = "profits")
plt.legend(frameon=False)

Straight-line depreciation

Quick Copy buys an office machine for $5,200 on January 1st of a given year. The machine is expected to last for eight years, at the end of which time its salvage value will be $1,100. If the company figures the decline in value to be the same each year, then the book value, \(V(t)\), after \(t\) years, \(0 \leq t \leq 8\), is given by

\[V(t) = C - t\Bigg(\frac{C - S}{N}\Bigg)\]

where \(C\) is the original cost of the item, \(N\) is the number of years of expected life, and \(S\) is the salvage value.

  1. Find the linear function for the straight-line depreciation of the office machine.
  2. Find the book value for each year.

To find the linear function, we can find the slope and use the point-slope equation of a line.

def slope(x1, x2, y1, y2):
  return (y2 - y1) / (x2 - x1)
  
slope(0, 8, 5200, 1100)
## -512.5

We only need the first point for the point-slope equation, so we get

\[y - 5200 = -512.5(x - 0)\]

which, with some algebraic manipulation to leads to the slope-intercept form

\[y = -512.5x + 5200\]

def book_value(x):
  return -512.5 * x + 5200
  
depreciation = [book_value(x) for x in range(0, 10)]
depreciation
## [5200.0, 4687.5, 4175.0, 3662.5, 3150.0, 2637.5, 2125.0, 1612.5, 1100.0, 587.5]
plt.plot(depreciation, label="straight-line depreciation")
plt.legend(frameon=False)