The argument I showed is not very complete, but gives a rough idea to understand the shortcut.
The chain rule is as follows: Let \(F(t)=f(g(t))\) be a composition of \(f\) with \(g\). If \(g^\prime(t)\) is well-defined and \(f^\prime(g(t))\) is well-defined, then \[F^\prime(t) = f^\prime(g(t))g^\prime(t)\]
The composition of \(f\) with \(g\) is in general different from the composition of \(g\) with \(f\).
Examples for the chain rule
\(F(t)=(t^2+4)^{-1}\)
\(h(x)=(x^3+x^2)^{50}\)
\(f(x)=\sqrt{\dfrac{x-1}{x+3}}\)
\(g(x)=\sqrt{3x+\sqrt{x}}\)
\(h(t)=e^{\sqrt{t}}\)
\(f(z)=\left(3e^{z^3}-z^3\right)^{1/3}\)
Taking stock
So far, we have a lot of shortcuts and they become the building blocks which enable you to calculate derivatives.
Of course, SymPy is available to you for verification.
But the “meatier” part of the approach so far was to build the rules you are going to use. From there, you can build even further, as you will see in subsequent applications.
We now move on to an alternative interpretation of derivatives, beyond being slopes of curves.
Rates of change
We already dipped our toes into the average rate of change interpretation of the Newton quotient.
When \(h\to 0\) in the Newton quotient, we now have the instantaneous rate of change.
Therefore, \(f^\prime(a)\) is the instantaneous rate of change at \(a\).
The relative rate of change at \(a\) is \(\dfrac{f^\prime(a)}{f(a)}\).
Concepts in economics framed in terms of derivatives
Capital stock as a function of time: \(K(t)\)
Change in the level or investment: \(K(t+h)-K(t)\)
Average rate of change: \(\dfrac{K(t+h)-K(t)}{h}\)
Investment rate: \(K^\prime(t)\)
Growth rate in capital stock: \(\dfrac{K^\prime(t)}{K(t)}\)
Costs as a function of units produced: \(C(q)\)
Change in the costs: \(C(q+h)-C(q)\)
Average rate of change: \(\dfrac{C(q+h)-C(q)}{h}\)
Marginal cost: \(C^\prime(q)\)
Growth rate in costs: \(\dfrac{C^\prime(q)}{C(q)}\)
Revenues as a function of units produced: \(R(q)\)
Change in the revenues: \(R(q+h)-R(q)\)
Average rate of change: \(\dfrac{R(q+h)-R(q)}{h}\)
Marginal revenue: \(R^\prime(q)\)
Growth rate in revenues: \(\dfrac{R^\prime(q)}{R(q)}\)
There are many other similar framings which you will encounter if you study economics further.
The study of certain types of ratios is of interest in economics. For example, the real wage \(w(t)\) as a function of time is the ratio of nominal wages \(W(t)\) to the price index \(P(t)\).
The growth rate of real wages over time is \[\frac{w^\prime(t)}{w(t)}=\frac{W^\prime(t)}{W(t)}-\frac{P^\prime(t)}{P(t)}\] The last term is called the inflation rate.
Another type of ratio of interest in economics involve ratios of relative changes or elasticities.
A very important elasticity used in economics is the price elasticity of demand. This is the ratio of the relative change in quantity demanded and the relative change in price.
To make things more concrete, let \(q(p)\) be the quantity demanded as a function of price \(p\).
Suppose prices change from \(p\) to \(p+h\). The relative change in price is \[\frac{(p+h)-p}{p}=\dfrac{h}{p}\]
The relative change in quantity demanded as a result of a change in price is \[\frac{q(p+h)-q(p)}{q(p)}\]
By definition, the price elasticity of demand is the ratio of the relative change in quantity demanded and the relative change in price:
Notice the presence of a Newton quotient! Let \(h\to 0\). Then, the price elasticity of demand could be expressed in terms of derivatives and relative rates of change: \[q^\prime(p)\frac{p}{q(p)}=p\frac{q^\prime(p)}{q(p)}\]
In more general terms, the elasticity of \(f\) with respect to \(x\) is given by \[\mathsf{el}_x f(x)= x\frac{f^\prime (x)}{f(x)}\]
Moving on
Many concepts in economics could be framed in terms of derivatives.
We will have a chance to explore the implications of using these derivatives:
How are revenues affected by demand conditions?
When should a firm increase or decrease production of a good?
How does a monopoly charge for a good?
But we need to dig deeper.
Application 01: An algorithm to solve difficult equations by hand or through a spreadsheet
You may find it easy to solve for \(x\) for the following equations:
\(3x+2=0\)
\(4x^2-3x-1=0\)
But what if you are asked to solve for \(x\) in \[x^6 +3x^2-2x-1=0?\] How do you even start?
For now, let \(f(x)=x^6 +3x^2-2x-1\).
Don’t aim for getting an answer right away. Instead, start with a guess first (whether good or bad).
We are going to cheat a bit to have a guess, but this is more for you to see how to develop an algorithm.
Sketch the graph of \(f\) first.
Let us start with \(x=-0.5\). Draw the line tangent to \(f\) at \(x=-0.5\).
Let us zoom in closer.
Notice that we now have a better guess than when we started at \(x=-0.5\).
The better guess is the intersection of the orange line and the horizontal axis crossing the origin.
How do we get this new guess? Call the old guess \(x_0\). All we did was to get the equation of the line tangent to \(f\) at \(x=x_0\):
\[P_1(x)=f(x_0)+f^\prime(x_0)(x-x_0)\]
The horizontal line crossing the origin is really \(P_1(x)=0\), so the corresponding value of \(x\) when the orange line crosses \(P_1(x)=0\) is \[\begin{eqnarray*}0 &=& f(x_0)+f^\prime(x_0)(x-x_0) \\ -f(x_0) &=& f^\prime(x_0)(x-x_0) \\ -\frac{f(x_0)}{f^\prime(x_0)} &=& x-x_0 \\ x_0-\frac{f(x_0)}{f^\prime(x_0)} &=& x\end{eqnarray*}\]
We now have a new guess! Visually it looks like a good guess. Specifically, we have a new guess equal to \[x=x_0-\frac{f(x_0)}{f^\prime(x_0)}\]
Repeat the process. Draw the line tangent to \(f\) at your new guess.
Zoom in closer.
Zoom in even closer.
Seems like we are getting very near an \(x\) which will solve \(x^6+3x^2-2x-1=0\).
We could repeat finding the process of getting another new guess, but it would seem that we are near enough.
Congratulations! We have developed an algorithm which enables us to solve for \(x\) in difficult equations. This algorithm is called Newton’s method.
SymPy can look for solutions in the following way:
from sympy import*x = symbols('x', real =True)nsolve(x**6+3*x**2-2*x-1, x, (-0.4, -0.2))
\(\displaystyle -0.332992409726606\)
Algorithm for Newton’s method
Use case: Solving for \(x\) in \(f(x)=0\) in some specified interval \([a,b]\).
Start with an initial guess \(x_0\in[a,b]\). Start with \(i=1\).
Get the next guess \(x_i\) as \[x_i=x_{i-1}-\frac{f(x_{i-1})}{f^\prime(x_{i-1})}\]
Increase \(i\) by 1 and repeat step 2.
Have a rule as to when to stop.
Application 02: Implicit functions
All the functions you have encountered so far are of the form \(y=f(x)\) where \(y\) is written explicitly as a function of \(x\).
What happens if this is not the case?
Consider the case \(x=e^y\), where \(y=f(x)\). What is \(f^\prime(x)\)?
One approach is to solve for \(y\) in terms of \(x\), then calculate \(f^\prime(x)\) directly.
Another approach is to indirectly recover \(f^\prime(x)\) from \(x=e^y\).
We use the second approach. Start with \(x=e^y\).
Take derivatives of both sides of the equation with respect to \(x\).
We get \(1 = e^y f^\prime(x)\). How did we get this?
Solve for \(f^\prime(x)\) and write everything in terms of \(x\) if possible:
Comments about the chain rule