Chapter 03
Logarithm
A logarithm answers 'how many times we multiply the base to get this number?' It is the inverse of exponentiation and is used with exponentials in loss and probability in deep learning.
Math diagram by chapter
Select a chapter to see its diagram below. View the flow of basic math at a glance.
Logarithm is the inverse of exponent. means . Below are the graphs of and its inverse .
Example: , , , (when , is )
Purple: , Teal:
What is the logarithm?
The logarithm is the inverse of exponentiation. When , we write : " raised to what power gives ?" Here is the base, is the argument, and the log value is the exponent (often written as ).
Example: so . (). When the base is , we write natural log , used often in deep learning and statistics.
Log sum and quotient: (product becomes sum in log space), (quotient becomes difference). In AI, multiplying probabilities uses this form frequently.
In AI, loss functions (e.g. cross-entropy) and probability expressions use so that products become sums, making computation and differentiation easier. Why use log? When probabilities are multiplied many times, numbers get too small; with , products become sums, so computation is stable and gradient descent is easier.
In deep learning, loss functions often use on probabilities to measure 'how wrong' a prediction is. Knowing logarithms helps you see why appears there.
When probabilities are multiplied many times, numbers get very small. Log turns products into sums, so computation is stable and gradient descent is easier to work with.
In AI, log is used to put probabilities or scores on a log scale. Cross-entropy loss uses the negative log probability of the correct class so that as the model gets it right, loss goes to zero. The log-sum form appears often in loss and probability expressions.
| Example | Value |
|---|---|
| 3 () | |
| 2 | |
| 2 |
The log is an integer only when the argument is a power of the base.
Operations frequently used with logarithms (often in AI loss and probability):
| Operation | Formula | Note |
|---|---|---|
| Log sum | product → sum | |
| Log difference | quotient → difference | |
| Power | exponent out front |
| Example | Calculation |
|---|---|
| Log sum | |
| Log difference |
In the problems below, find log values, arguments, log sums, or log differences.