1 Natural Logarithm and Exponential

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).

We use log for log utility in our household maximization problems, and we use exponential functions with other bases for production functions.

See also: Exponential and Infinitely Compounding Interest Rate.

1.1 Log and Exponential

If the natural log of \(x\) is \(y\) (in economics we generally just write ln and log interchangeably, becareful though, google thinks function log means log with base 10, matlab thinks function log means base e, you will get different numbers typing in log(10) in google and matlab).

  • \(\displaystyle \ln (x)=y\)

then

  • \(\displaystyle e^y =x\)

where e is Euler’s number. Intuitively, \(ln(x)\) is asking what exponent \(y\) of base \(e\) is needed for \(e^y\) to be equal to \(x\). When \(x\) is consumption, the log utility of consumption is in some sense the number of \(e\) terms needed to be multiplied together to equal to \(c\).

We can also write:

  • \(e^x =\exp (x)\), writing \(\exp (x)\) is a little easier to read, means just \(e\) to the power of \(x\)

because of this:

  • since \(e^0 =1\), \(\log (1)=0\)

  • since \(e^1 \approx 2.71828\), \(\log (2.71828)\approx 1\)

The natural log is just the inverse of the exponential function. We use log to linearize exponential functions, which allows us to do regressions afterwards for example.

1.2 Log Rules

Suppose we have: \(\log \left(\frac{\exp (A+\epsilon )\cdot a^{\alpha } \cdot b^{\beta } }{c^{\theta } \cdot d^{\phi } }\right)\)

This looks complicated, but because there is log, we can take the equation apart:

\[\log \left(\frac{\exp (A+\epsilon )\cdot a^{\alpha } \cdot b^{\beta } }{c^{\theta } \cdot d^{\phi } }\right)=(A+\epsilon )+\alpha \cdot \log (a)+\beta \cdot \log (b)-\theta \cdot \log (c)-\phi \cdot \log (d)\]

Generally (:

  • \(\displaystyle \log (\exp (A))=A\)

  • \(\displaystyle \log (x^{\alpha } )=\alpha \cdot \log (x)\)

  • \(\displaystyle \log (x\cdot y)=\log (x)+\log (y)\)

  • \(\displaystyle \log (\frac{x}{y})=\log (x)-\log (y)\)

1.3 Why does \(\log (x\cdot y)=\log (x)+\log (y)\)?

Why is the log of the product of two numbers the same as the sum of the log of each of the two numbers? Intuitively, because we can write \(x\cdot y\) as the exponential of a sum: when \(e^a \cdot e^b\), even though it’s multiplication, it is also just \(e^{a+b}\), the exponential of a sum.

  • Rule: \(\log (x\cdot y)=\log (x)+\log (y)\)

We can write separately what each term equals to as:

  1. \(\displaystyle \log (x\cdot y)=z\)

  2. \(\displaystyle \log (x)=z_x\)

  3. \(\displaystyle \log (y)=z_y\)

By definition, for each of the three terms above:

  1. \(\displaystyle x\cdot y=\exp (z)\)

  2. \(\displaystyle x=\exp (z_x )\)

  3. \(\displaystyle y=\exp (z_y )\)

So:

  • \(\displaystyle \log (x\cdot y)=\log (\exp (z_x )\cdot \exp (z_y ))\)

Given that: \(e^a \cdot e^b =e^{a+b}\), and \(\log (\exp (x))=x\):

  • \(\displaystyle \log (x\cdot y)=\log (\exp (z_x )\cdot \exp (z_y ))=\log (\exp (z_x +z_y ))=(z_x +z_y )\)

Hence:

  • \(\displaystyle \log (x\cdot y)=z=(z_x +z_y )=\log (x)+\log (y)\)

1.4 Why does \(\log (x^a )=a\cdot \log (x)\)?

Why is the log of an exponential term equal to the power times the log of the base of the exponential?

We start with:

  • \(\displaystyle \log (x^a )=z\)

Proceed:

  1. \(\displaystyle \log (x^a )=z\)

  2. \(\displaystyle x^a =e^z\)

  3. \(\displaystyle x=e^{\frac{z}{a}}\)

  4. \(\displaystyle \log (x)=\frac{z}{a}\)

  5. \(\displaystyle a\cdot \log (x)=z\)

1.5 For Variables that Grow, Log difference is close to rate of change

Suppose that growth rate is \(x\) percent per year, after 5 years, the gdp will be:

  • \(\displaystyle Y_{1995} =Y_{1990} \cdot (1+x)^5\)

We can take log on both sides:

  • \(\displaystyle \ln (Y_{1995} )=\ln (Y_{1990} )+5\cdot \ln (1+x)\)

Which says that the difference in GDP between these two years divided by 5 is equal to the log of \(1\) plus the growth rate.

Approximately, for \(x\) small:

  • \(\displaystyle \frac{\ln (Y_{1995} )-\ln (Y_{1990} )}{5}=\ln (1+x)\approx x\)

For example:

xVec = linspace(0,0.10,10);
log(1+ xVec)

ans = 1x10    
         0    0.0110    0.0220    0.0328    0.0435    0.0541    0.0645    0.0749    0.0852    0.0953

xVec

xVec = 1x10    
         0    0.0111    0.0222    0.0333    0.0444    0.0556    0.0667    0.0778    0.0889    0.1000

Note: This is a bad approximation if \(x\) is large. For example, we know that \(\ln (2.718)=\ln (1+1.718)\approx 1\) is almost exact. But the approximation here would have said \(\ln (1+1.718)\approx 1.718\), which is very incorrect.