// learn.shawon.ch / math-for-ai / logarithms STUDY GUIDE
← Mathematics for AI

Mathematics · Foundations

Logarithms are the name for a question you can already answer

Try this first

Solve it in your head: 2ˣ = 32. What is x?

You almost certainly got 5, because 2 multiplied by itself five times is 32. Hold onto how that felt, because you just performed a logarithm. You didn't need the word, and that's the whole point: a logarithm is not a new kind of math, it's a name for the question you just answered.

The question was: "2 raised to what power gives 32?" The name for that question is log₂(32), and the answer is 5. Read it out loud as "log base 2 of 32," but hear it as "2 to the what makes 32."

The one idea

log₃(y) = x means exactly the same thing as bˣ = y. A logarithm just asks for the exponent.

Start from what you know: powers of two

You already carry this table in your head. The logarithm is simply reading it from right to left.

Powers of 2
Exponent (x)So log₂ of that is…
121
242
383
4164
5325

Going right (exponent → result) is exponentiation. Going left (result → exponent) is the logarithm. They are the same staircase walked in opposite directions, which is why a log is called the inverse of an exponential.

See the inverse

Because they undo each other, their graphs are mirror images across the diagonal line y = x. The exponential rockets upward; the logarithm is that same curve flipped, rising fast and then flattening.

0 4 8 4 8 y = 2ˣ y = log₂x y = x
2ˣ and log₂x reflected across y = x. Each is the other, undone.

Work one, then finish one

Worked: log₂(8) asks "2 to the what makes 8?" Since 2³ = 8, the answer is 3.

Your turn: log₁₀(1000) asks "10 to the what makes 1000?" Fill the blank: 10 to the ___ is 1000. (Answer: 3, because 10³ = 1000. Notice base 10 is just a different staircase.)

Why this earns a place in your toolkit

Logs turn multiplication into addition and compress huge ranges into readable ones, which is why they run quietly underneath the things you care about. Decibels, earthquake magnitudes, and pH are all log scales. In machine learning specifically, log-loss and log-likelihood are everywhere, precisely because logs convert products of probabilities into sums that a computer can add without underflowing to zero. When you meet those terms later, they are this same idea wearing a work uniform.

Recall check · no peeking

  1. What is log₂(16)?
  2. Rewrite log₂(64) = 6 as an exponential equation.
  3. Without computing, is log₂(1000) closer to 10 or to 100? Why?

Explain it back

In one sentence, with no jargon, tell a friend why log₂(32) = 5. If you can't say it cleanly, reread the hook.

Learn · Shawon Chowdhury · a study guide, kept rough on purpose