Exponentials#

An exponential, generally speaking, is an expression of the form \(c^x\) for some constant \(c\), and should be read as “\(c\) to the \(x\)th power”. Note that this is different from powers \(x^n\), in that exponentials keep the base \(c\) fixed and vary \(x\), while powers do the opposite.

Example

\(2^x \neq x^2\).

Comparison of a quadratic curve and an exponential curve.

Fig. 1 A quadratic curve \(y=x^2\) and an exponential curve \(y=2^x\) behave differently.#

Often, when we refer to an exponential, we really mean a specific base \(e = 2.71828\dots\), known alternately as “Euler’s number”, or “the base of the natural logarithm”.

Rules for working with exponentials#

The following rules (properties) are useful when manipulating expressions involving exponentials. All of these rules work for any base \(c \neq 0\), including the special case \(c=e\).

Property 1

Any \(c\) raised to the 0 power is 1, and specifically:

\[ c^0 = 1 \]

Property 2 (Exponentials turn negatives into inverses:)

\[ c^{-a} = \frac{1}{c^a} \]

Property 3 (Exponentials turn sums into products:)

\[ c^{a}\cdot c^{b} = c^{a+b} \]

Property 4 (Exponentials turn products into powers:)

\[ c^{a\cdot b} = {\left(c^a\right)}^b = {\left(c^b\right)}^a \]

The exponential function#

While it is convenient to regard \(e\) as the number \(2.71828\dots\), there is an alternative (and more general) definition for \(e\) given by the following infinite summation

(1)#\[e := \sum_{n=0}^\infty \frac{1}{n!}\]

where

\[n! := 1\cdot 2 \cdot 3 \cdot \dots \cdot n\]

is the factorial function: the product of numbers 1 through \(n\). (We define the special case \(0! = 1\).)

The exponential function \(e^x\), sometimes also written \(\exp(x)\), is equivalent to the number \(e\) raised to the \(x\)th power.

Plot of the exponential function

Fig. 2 The exponential function \(e^x\).#

Note that summation in (1) depends on infinitely many terms, and is not something you could explicitly compute. While this could be a problem in some cases, it’s okay here because the terms diminish quite rapidly:

\[\begin{align*} e = \sum_{n=0}^\infty \frac{1}{n!} &= \frac{1}{0!} + \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \frac{1}{4!} + \frac{1}{5!} + \dots\\ &= \frac{1}{1} + \frac{1}{1} + \frac{1}{2} + \frac{1}{6} + \frac{1}{24} + \frac{1}{120} + \dots \end{align*}\]

and the summation converges to Euler’s number. Proving this sort of thing is out of scope for us here, but we can simulate it computationally by printing out the first few partial sums with a bit of python code.

import numpy as np
from scipy.special import factorial

# Initialize the partial sum
e_partial = 0.0

for n in range(15):
    # Add in 1/n!
    e_partial += 1.0/factorial(n)
    print('First {:2d} term(s): {:0.12f}'.format(n+1, e_partial))
    
# Print the actual constant to 12 decimals
print('---')
print("Euler's constant: {:0.12f}".format(np.e))
First  1 term(s): 1.000000000000
First  2 term(s): 2.000000000000
First  3 term(s): 2.500000000000
First  4 term(s): 2.666666666667
First  5 term(s): 2.708333333333
First  6 term(s): 2.716666666667
First  7 term(s): 2.718055555556
First  8 term(s): 2.718253968254
First  9 term(s): 2.718278769841
First 10 term(s): 2.718281525573
First 11 term(s): 2.718281801146
First 12 term(s): 2.718281826198
First 13 term(s): 2.718281828286
First 14 term(s): 2.718281828447
First 15 term(s): 2.718281828458
---
Euler's constant: 2.718281828459

After only 15 terms of the summation, we already have a quite good approximation to \(e\) (accurate to 11 decimal places).

This definition of \(e\) as an infinite summation can be generalized to depend on an arbitrary exponent \(x\):

\[ e^x := \sum_{n=0}^{\infty} \frac{x^n}{n!}, \]

where the first definition can be recovered by setting \(x=1\) in the second equation.

While we rarely work with this form directly, it is useful because it provides a way to generalize the exponential to support complex exponents \(e^z\) for \(z\in\mathbb{C}\).

Logarithms#

Logarithms are the inverse of exponentials, similar to how square-root is the inverse of squaring. In general, logarithms have a “base” \(b > 0\), and define the following relationship for input \(x > 0\):

\[\log_b x = y \quad\quad \Leftrightarrow \quad\quad x = b^y.\]

Intuitively, \(\log_b x\) measures the power \(y\) we would need to raise \(b\) to produce \(x\).

When \(x = 0\), there is no finite number \(y\) such that \(b^y = 0\), and we say \(\log_b x = -\infty\).

The base can be any positive number, but among all logarithms, the natural logarithm (denoted \(\ln\)) uses \(e\) as the base:

\[\ln x = y \quad\quad \Leftrightarrow \quad\quad x = e^y.\]

Other common choices for the base are \(b=2\) and \(b=10\). In these cases, \(\log_2 x\) and \(\log_{10} x\) can be roughly thought of as measuring the “number” of bits (for \(b=2\)) or digits (for \(b=10\)) needed to represent a number \(x\).

Plot of logarithms with different bases (2, e, 10)

Fig. 3 A comparison of the base-2, natural (base-\(e\)), and base-10 logarithms of \(x\).#

Properties of logarithms#

Property 5

For any base \(b > 0\), \(\log_b 1 = 0\).

This is just another way of writing \(b^0 = 1\).

Property 6

For any base \(b>0\), \(\log_b b = 1\).

This is another way of saying that \(b^1 = b\).

Property 7

\(\log_b x = \frac{\ln x}{\ln b}\)

This rule lets us convert between different logarithm bases.

Property 8

For any \(x\) and \(y\), \(\log_b(x\cdot y) = \log_b(x) + \log_b(y)\).

This rule allows us to turn products into sums, which can often be computed more easily and with greater precision.

As a corollary, we also get the analogous rule for ratios: \(\log_b(x/y) = \log_b(x) - \log_b(y)\).

Property 9

For any \(k\), \(\log_b(x^k) = k \cdot \log_b x\).

This is just a slight generalization of rule 4, allowing us to turn powers into products. Note that \(k\) need not be an integer, or positive: it works for any real number!

In particular, we have \(\log_b \frac{1}{x} = \log_b \left(x^{-1}\right) = -\log_b x\).

Property 10

\(b^{\log_b x} = x\).

This is just notation that says \(b^x\) and \(\log_b x\) are mutual inverses.