Exponential Functions
An exponential function multiplies its value by the same factor for every unit step in . This lesson defines carefully for irrational , collects the exponent laws, shows why exponentials eventually beat every power, and introduces the number as the one base whose graph has slope exactly 1 where it crosses the -axis.
For a first look, see Exponential and Logarithmic Functions and, for the arithmetic of exponents, Exponent Laws.
Defining for every real
Fix a base . The meaning of is built up in stages:
| Exponent | Definition | Example with |
|---|---|---|
| positive integer | ( factors) | |
| zero | ||
| negative integer | ||
| rational , | ||
| irrational | the limit of over rationals |
Each stage is forced by wanting the law to keep holding. The last stage needs a fact that is proved in real analysis: for the rational powers fit together into exactly one continuous, monotone function on . You can watch the limit being approached:
from fractions import Fraction
import math
b = 8
for digits in [1, 2, 3, 4, 6, 8]:
r = Fraction(round(math.sqrt(2) * 10**digits), 10**digits) # rational approximation of √2
print(f"r = {str(r):>20} 8^r = {b ** float(r):.10f}")
print(f"{'8^√2 (library)':>24} = {b ** math.sqrt(2):.10f}")r = 7/5 8^r = 18.3791736800
r = 141/100 8^r = 18.7653591877
r = 707/500 8^r = 18.9220960039
r = 7071/5000 8^r = 18.9299671190
r = 707107/500000 8^r = 18.9305182197
r = 35355339/25000000 8^r = 18.9305008992
8^√2 (library) = 18.9305009926
Better rational exponents give values that settle down to , and each extra correct digit in the exponent buys roughly one more correct digit in the power.
Properties
For , , the function has domain and range : it is never zero or negative. It is increasing if and decreasing if , every graph passes through , and the -axis is a horizontal asymptote on one side. For and all real :
The defining feature: for every . Linear functions add a constant amount per step; exponentials multiply by a constant factor. That is why data that grows by "3 % per month" or "doubles every 18 months" is exponential.
Exponentials beat powers
Every exponential with eventually exceeds every power function, however large the exponent. The crossover can come late, though:
from scipy.optimize import brentq
import math
for n in [2, 5, 10, 50]:
# the last crossing of 2^x and x^n, where x ln 2 = n ln x
g = lambda x: x * math.log(2) - n * math.log(x)
x_star = brentq(g, n + 1, 1000)
print(f"x^{n:<3} is overtaken by 2^x for good at x ≈ {x_star:.3f}")x^2 is overtaken by 2^x for good at x ≈ 4.000
x^5 is overtaken by 2^x for good at x ≈ 22.440
x^10 is overtaken by 2^x for good at x ≈ 58.770
x^50 is overtaken by 2^x for good at x ≈ 438.885
In chapter 4 we will prove the limit statement behind this, as , with l'Hospital's rule (Indeterminate Forms).
The number e
Look at the slope of where it crosses the -axis. The secant slope from to is , and its limit as depends on :
- for the slope is about 0.693, for it is about 1.099;
- some base in between gives slope exactly 1. That base is called .
def slope_at_zero(b, h=1e-8):
return (b**h - 1) / h
for b in [2, 2.5, 2.7, 2.8, 3]:
print(f"b = {b}: slope at 0 ≈ {slope_at_zero(b):.5f}")
lo, hi = 2.0, 3.0 # bisection: find b with slope exactly 1
for _ in range(40):
mid = (lo + hi) / 2
lo, hi = (mid, hi) if slope_at_zero(mid) < 1 else (lo, mid)
print(f"base with slope 1 ≈ {lo:.6f}")b = 2: slope at 0 ≈ 0.69315
b = 2.5: slope at 0 ≈ 0.91629
b = 2.7: slope at 0 ≈ 0.99325
b = 2.8: slope at 0 ≈ 1.02962
b = 3: slope at 0 ≈ 1.09861
base with slope 1 ≈ 2.718282
So , and the defining property is
This limit is the reason the derivative of is itself (Derivatives of Polynomials and Exponential Functions). The slopes printed above for other bases are in fact , which the next lesson explains. The function is often called the exponential function and written .
In software
Exponentials are everywhere in code: retry back-off (wait ms), compound interest, learning-rate decay, the softmax function in every classifier and LLM, exponential moving averages, radioactive and cache-eviction decay models, and the cost of brute-force search over subsets (Growth Rates and Big-O). Floating-point limits matter: math.exp(710) overflows a double, which is why softmax implementations subtract the maximum score first.
Exercises
Exercise 1: Equal bases
Solve .
Answer
Solution
Write both sides as powers of 2 and compare exponents ( is one-to-one):
Exercise 2: Fit an exponential through two points
Find with and .
Answer
Solution
Exercise 3: Simplify with the laws
Simplify .
Answer
, a constant.
Solution
Exercise 4: Decay below a threshold
A ranking score is multiplied by 0.9 every hour. After how many whole hours is it below half its starting value? Find the answer with a loop, then check it with logarithms.
Answer
After 7 hours (, ).
Solution
We need , that is , so .
import math
score, hours = 1.0, 0
while score >= 0.5:
score *= 0.9
hours += 1
print(hours, round(score, 4), round(math.log(0.5) / math.log(0.9), 2))7 0.4783 6.58
Exercise 5: Estimate a slope at zero
Estimate the slope of at using with . Compare with 1 to decide whether 10 is bigger or smaller than .
Answer
About 2.302588; it is greater than 1, consistent with .
Solution
h = 1e-6
print(round((10**h - 1) / h, 6))2.302588
The slope at 0 grows with the base, and the base with slope 1 is . A slope above 1 means the base is larger than . (The exact value is ; the small difference is the error of using .)
Test yourself
What is the range of ?
- All real numbers
Which property defines the number ?
- The slope of at is exactly 1
- is never negative
- is the largest base with an inverse
A quantity grows by 5 % per step. Which model fits?