Marginal analysis is the study of the additional benefitsof an activity compared to the additional costs incurred for pursuing said activity. Marginal analysis relies on derivatives and is oftentimes used in microeconomics and business settings to optimize decision-making.

Let $$C(x)$$, $$R(x)$$, $$P(x)$$ represent, respectively, the total cost, revenue, and profit from the production and sale of $$x$$ items; there are two ways to mathematically define the marginals of these quantities.

The marginal cost at $$x$$, given by $$C^\prime(x)$$, is the approximate cost of the $$(x + 1)$$st item.

$C^\prime(x + 1) \approx C(x) + C^\prime(x)$

$C^\prime(x) \approx C(x + 1) - C(x)$

The marginal revenue at $$x$$, given by $$R^\prime(x)$$, is the approximate revenue of the $$(x + 1)$$st item.

$R^\prime(x + 1) \approx R(x) + R^\prime(x)$ $R^\prime(x) \approx R(x + 1) - R(x)$

The marginal profit at $$x$$, given by $$P^\prime(x)$$, is the approximate profit of the $$(x + 1)$$st item.

$P^\prime(x + 1) \approx P(x) + P^\prime(x)$

$P^\prime(x) \approx P(x + 1) - P(x)$

Marginal Analysis Example

Let’s look at an example. Given a cost function $$C(x) = 62x^2 + 27500$$ and a revenue function $$R(x) = x^3 - 12x^2 + 40x + 10$$, (a) find the total profit, $$P(x)$$ (b) find the total cost, revenue, and profit from the production and sale of 50 units of the product (c) find the marginal cost, revenue, and profit when 50 units are produced and sold.

from sympy import *

x = symbols("x")

cost = 62 * x**2 + 27500
revenue = x**3 - 12 * x**2 + 40 * x + 10

profit = simplify(revenue - cost)
profit
## x**3 - 74*x**2 + 40*x - 27490
total_cost = cost.evalf(subs={x:50})
total_cost
## 182500.000000000
total_revenue = revenue.evalf(subs={x:50})
total_revenue
## 97010.0000000000
total_profit = profit.evalf(subs={x:50})
total_profit
## -85490.0000000000
marginal_cost = diff(cost, x)
marginal_cost
## 124*x
marginal_cost.evalf(subs={x:50})
## 6200.00000000000
marginal_revenue = diff(revenue, x)
marginal_revenue
## 3*x**2 - 24*x + 40
marginal_revenue.evalf(subs={x:50})
## 6340.00000000000
marginal_profit = diff(profit, x)
marginal_profit
## 3*x**2 - 148*x + 40
marginal_profit.evalf(subs={x:50})
## 140.000000000000

Often, in business, exact formulas for costs, revenue, and profit are not known, but information may exist about them. That’s the tricky part that requires some inventiveness.

Differentials and Delta Notation

In calculus, the differential refers to the change in a function. In our context, just as the marginal cost at a given value $$C^\prime(x_0)$$ can be used to estimate the cost of the next unit $$C(x_0 + 1)$$, the value fo the derivative of any continuous function $$f(x)$$ can be used to estimate values of the function for values near $$x_o$$. Recall the difference quotient

$\frac{f(x + h) - f(x)}{h}$

The number $$h$$ is considered to be a change in $$x$$. Another notation for such a change is $$\Delta x$$ and called delta notation, thus $$\Delta x = (x + h) - x = h$$.

If we have a function given by $$y = f(x)$$, a change in $$x$$ from $$x$$ to $$x + \Delta x$$ yields a change in $$y$$ from $$f(x)$$ to $$f(x + \Delta x)$$. The change in $$y$$ is given by $$\Delta y = f(x + \Delta x) - f(x)$$.

As a quick example, for $$y = x^2$$, $$x = 4$$, and $$\Delta x = 0.1$$, we can find $$\Delta y$$ with $$\Delta y = (4 + 0.01)^2 - 4^2$$.

dx = 0.1
f = (x + dx)**2 - x**2
f.evalf(subs={x:4})
## 0.810000000000000

The generalization of this idea leads to the conclusion that for $$f$$, a continuous, differentiable function, and small $$\Delta x$$,

$f^\prime(x) \approx \frac{\Delta y}{\Delta x}$ and therefore

$\Delta y \approx f^\prime(x) \cdot \Delta x$ More formally, for $$y = f(x)$$, we define $$dx$$, called the differential of $$x$$, by $$dx = \Delta x$$ and $$dy$$ called the differential of $$y$$, by $$dy = f^\prime(x) dx$$.

Differential Analysis Example

For $$y = x(4 - x)^3$$ (a) find $$dy$$ (b) find $$dy$$ when $$x = 5$$ and $$dx = 0.01$$ (c) compare $$dy$$ to $$\Delta y$$.

dx = symbols("dx")
y = x * (4 - x)**3
dy = simplify(diff(y, x)) * dx
dy
## 4*dx*(1 - x)*(x - 4)**2
dy.evalf(subs={x:5, dx:0.01})
## -0.160000000000000

$$dy$$ is the approximate change in $$y$$ between $$x_1 = 5$$ and $$x_2 = 5.01$$. The actual change in $$y$$ can be found by evaluating the function for $$x_1$$ and $$x_2$$.

x2 = y.evalf(subs={x:5.01})
x1 = y.evalf(subs={x:5})
x2 - x1
## -0.161808009999996

Cost and Tolerance Example.

In preparation for laying new tile, Michelle measures the floor of a large conference room and finds it to be square, measuring 100 ft by 100 ft. Suppose here measurements are accurate to $$\pm$$ 6 inches (the tolerance). (a) use a differential to estimate the difference in are ($$dA$$) due to the tolerance. (b) Compare the result from part a with the actual difference in are ($$\Delta A$$). (c) If each tile covers 1 $$\text{ft}^2$$ and a box of 12 tiles costs 24 dollars, how much extra cost should Michelle allot for the potential overage in floor area?

dx = 0.5 # +/- 0.5 ft
area = x ** 2
area
## x**2
dA = simplify(diff(area, x)) * dx
dA.evalf(subs={x:100}) # +/- 100
## 100.000000000000

If Michelle is off by half a foot, the total area can differ by approximately $$\pm$$ 100 ft.

x2 = area.evalf(subs={x:99.5})
x1 = area.evalf(subs={x:100})
DeltaA = x2 - x1
DeltaA
## -99.7500000000000
def n_boxes(area):
return area / 12

n_boxes(10000) 
## 833.3333333333334
n_boxes(10100)
## 841.6666666666666
(n_boxes(10100) - n_boxes(10000)) * 24
## 199.99999999999818

Michelle should account for an extra cost of 192 dollars, in case she’s off by +100 ft.