Go to the MLX, M, PDF, or HTML version of this file. Go back to fan’s MEconTools Package, Matlab Code Examples Repository (bookdown site), or Math for Econ with Matlab Repository (bookdown site).
Linear functions have a constant slope, but what is the rate of change for a non-linear function as we shift along its domain?
(SB) Let \((x_0 ,f(x_0 ))\) be a point on te graph of \(y=f(x)\).
The derivative of \(f\) at \(x_0\) is the slope of the tangent line to the graph of \(f\) at \((x_0 ,f(x_0 ))\).
There are some common ways of denoting derivative of funtion \(f\) at \(x_0\):
\(\displaystyle f^{\prime } (x_0 )\)
\(\displaystyle \frac{df}{dx}(x_0 )\)
\(\displaystyle \frac{dy}{dx}(x_0 )\)
\(f_x (x_0 )\): this is popular in economics
We write this analyticaly as:
\[f^{\prime } (x_0 )=\lim_{h\to 0} \frac{f(x_0 +h)-f(x_0 )}{h}\]
If this limit exists, then the function \(f\) is differentiable at \(x_0\).
We will use this formula to derive first order taylor approximation. And this will also appear when we derive the formula for point elasticity.
given constant \(k\),:
\(\displaystyle f(x)=a\cdot x\)
\(\displaystyle f^{\prime } (x_0 )=a\)
syms x a
f(x, a) = a*x
f(x, a) =
1em \(\displaystyle a\,x\)
dfk = diff(f,x)
dfk(x, a) =
1em \(\displaystyle a\)
(SB) For any positive integer \(k\) (or real number \(k\)), the derivative of \(f(x)=x^k\) at \(x_0\) is:
\(\displaystyle f(x)=x^k\)
\(\displaystyle f^{\prime } (x_0 )=k\cdot x_0^{k-1}\)
syms x a k
f(x, a, k) = a*x^k
f(x, a, k) =
1em \(\displaystyle a\,x^k\)
dfk = diff(f,x)
dfk(x, a, k) =
1em \(\displaystyle a\,k\,x^{k-1}\)
\(\displaystyle f(x)=p(q(x))\)
\(\displaystyle f^{\prime } (x_0 )=p^{\prime } (q(x_0 ))\cdot q^{\prime } (x_0 )\)
syms x a k
f(x, a, k) = (a*x)^k
f(x, a, k) =
1em \(\displaystyle {{\left(a\,x\right)}}^k\)
dfk = diff(f,x)
dfk(x, a, k) =
1em \(\displaystyle a\,k\,{{\left(a\,x\right)}}^{k-1}\)
Given functions \(p\) and \(q\) that are differentiable at \(x\), then:
\(\displaystyle f(x)=p(x)+q(x)\)
\(\displaystyle f^{\prime } (x)=p^{\prime } (x)+q^{\prime } (x)\)
syms x a b c d
f(x, a, b, c, d) = a*x^b + c*x^d
f(x, a, b, c, d) =
1em \(\displaystyle a\,x^b +c\,x^d\)
dfk = diff(f,x)
dfk(x, a, b, c, d) =
1em \(\displaystyle a\,b\,x^{b-1} +c\,d\,x^{d-1}\)
Given functions \(p\) and \(q\) that are differentiable at \(x\), then:
\(\displaystyle f(x)=p(x)\cdot q(x)\)
\(\displaystyle f^{\prime } (x)=p^{\prime } (x)\cdot q(x)+p(x)\cdot q^{\prime } (x)\)
syms x a b c d
f(x, a, b, c) = (a*x^b)*(c*x^d)
f(x, a, b, c) =
1em \(\displaystyle a\,c\,x^b \,x^d\)
dfk = diff(f,x)
dfk(x, a, b, c) =
1em \(\displaystyle a\,b\,c\,x^d \,x^{b-1} +a\,c\,d\,x^b \,x^{d-1}\)
Given functions \(p\) and \(q\) that are differentiable at \(x\), then:
\(\displaystyle f(x)=\frac{p(x)}{q(x)}\)
\(\displaystyle f^{\prime } (x)=\frac{p^{\prime } (x)\cdot q(x)-p(x)\cdot q^{\prime } (x)}{(q(x))^2 }\)
Note that the quotient rule is based on the product rule, because:
So you can derive the quotient rule formula based on the product rule where the first term is \(p(x)\) and the second term is \(\frac{1}{q(x)}\).
syms x a b c d
f(x, a, b, c) = (a*x^b)/(c*x^d)
f(x, a, b, c) =
1em \(\displaystyle \frac{a\,x^b }{c\,x^d }\)
dfk = diff(f,x)
dfk(x, a, b, c) =
1em \(\displaystyle \frac{a\,b\,x^{b-1} }{c\,x^d }-\frac{a\,d\,x^b }{c\,x^{d+1} }\)
We use exponential functions in economnics a lot:
\(\displaystyle f(x)=\exp (a\cdot x)\)
\(\displaystyle f^{\prime } (x)=a\cdot \exp (a\cdot x)\)
syms x a
f(x, a) = exp(a*x)
f(x, a) =
1em \(\displaystyle {\mathrm{e}}^{a\,x}\)
dfk = diff(f,x)
dfk(x, a) =
1em \(\displaystyle a\,{\mathrm{e}}^{a\,x}\)
This is a special case of any power function
\(\displaystyle f(x)=c^{a\cdot x}\)
\(\displaystyle f^{\prime } (x)=a\cdot (\log c)\cdot c^{a\cdot x}\)
note that \(log(exp(c))=c\)
syms x a c
f(x, a, c) = c^(a*x)
f(x, a, c) =
1em \(\displaystyle c^{a\,x}\)
dfk = diff(f,x)
dfk(x, a, c) =
1em \(\displaystyle a\,c^{a\,x} \,\log \left(c\right)\)
We use Log functions in economnics a lot:
\(\displaystyle f(x)=\log (a\cdot x)\)
\(\displaystyle f^{\prime } (x)=\frac{1}{x}\)
note that the c cancels out.
syms x a
f(x, a) = log(a*x)
f(x, a) =
1em \(\displaystyle \log \left(a\,x\right)\)
dfk = diff(f,x)
dfk(x, a) =
1em \(\displaystyle \frac{1}{x}\)