Logarithm
For any positive numbers and positive base :
A logarithm tells us what exponent we need to raise the base to get a number:
If then
Written as or for natural log (base )
The domain of is
Higher base means more “compressed” representation (smaller log values for same )
Basic Properties
(change of basis)
Logarithm turns multiplication into addition
The logarithm is an isomorphism between and :
It transforms multiplication into addition:
This satisfies all isomorphism requirements:
- Homomorphism: Preserves group operation (multiplication → addition)
- Bijective: One-to-one correspondence via as inverse
- Identity preservation:
- Inverse preservation:
Why we want additive instead of multiplicative
Linear algebra works:
Once in log-space, we can use all the tools of linear algebra. Exponential relationships become linear , so we can use linear regression to find best-fit parameters, generally, matrix operations work on log-transformed data.Averaging becomes meaningful: Arithmetic mean of log-values gives the geometric mean - the “typical” multiplicative factor. For growth rates: average and growth isn’t (arithmetic) but (geometric: ).
Domain expansion: Multiplicative operations are trapped in - can’t represent “negative growth” or pass through zero. Log maps this to where we can freely add/subtract without worrying about sign constraints or division by zero.
Numerical stability: Multiplying probabilities like gives (underflows to 0 in float64). In log-space: , perfectly representable. Similarly, overflows, but doesn’t.
Probability & Information:
Independent events have probabilities that multiply:
In log-space they add:
→ We can sum evidence from multiple sources. Log-likelihood ratios add up. Maximum likelihood becomes a sum to maximize, not a product.
This additivity defines information: bits. Rare events (small ) have large positive information.
Entropy becomes extensive: entropy of two independent systems equals sum of individual entropies.Signal processing:
Each amplifier/attenuator multiplies signal:
In decibels they add: dB
→ Can quickly calculate total system gain by adding component gains. A amplifier followed by attenuator? That’s 60 dB + (-40 dB) = 20 dB = total gain.
Also compresses huge dynamic range: microvolts to kilovolts ( range) becomes manageable -180 to +60 dBV.Chemistry: Hydrogen ion concentration spans to mol/L (100 trillion-fold range!)
pH scale makes this linear: pH 0-14, where each unit = concentration change
Reaction energies add because converts multiplicative equilibrium constant to additive free energyGrowth processes: Exponential growth becomes linear in log:
Now it’s a straight line with slope - can estimate growth rate from any two points
Can use linear regression to fit exponential models, detect deviations from exponential growth
Log isn't just more compact notation, but literally saves memory and compute if we have numbers that have lots of zeros.