Home/Learn/Math for AI/Exponents, Logarithms & Summation Notation

Exponents, Logarithms & Summation Notation

Beginner
High-School Refresher

Exponentials grow explosively, logarithms tame that growth back down, and the Σ (sigma) symbol is just a for-loop — three notations you will meet on every page of AI math.

Overview

Three pieces of notation appear constantly in AI and scare people needlessly. Exponentials (e^x) show up in the sigmoid, softmax, and anywhere probabilities are formed. Logarithms (log x) are their inverse and appear in every loss function that involves probabilities (log-likelihood, cross-entropy) because they turn tiny multiplied probabilities into manageable added numbers and punish confident-but-wrong predictions hard. Summation notation, the big Σ, is nothing more than "add these up in a loop" — once you read Σ as `for` and `+=`, dense-looking formulas become code you already know how to write. Nail these three and most ML formulas stop looking like hieroglyphics.

e^x and log: inverses that undo each other

The exponential e^x turns any number into a positive one and grows fast; log undoes it. In ML we take log of probabilities because multiplying many small probabilities underflows to zero, but adding their logs is numerically safe.

log turns "multiply many small numbers" into "add"
import numpy as np

p = np.array([0.9, 0.2, 0.01])   # three probabilities
print(np.log(p))                 # [-0.105 -1.609 -4.605]  (more negative = more surprising)

# multiplying probabilities vs adding their logs (same ranking, safe math):
print(np.prod(p))                # 0.0018
print(np.exp(np.sum(np.log(p)))) # 0.0018  -> log-sum then exp recovers it

Σ (sigma) is a for-loop

Whenever you see Σ over i from 1 to n, read it as "loop i and accumulate". The scary formula for a mean, Σx_i / n, is one NumPy call. Recognising Σ as iteration is the single biggest unlock for reading papers.

Σ x_i == a loop that accumulates
import numpy as np

x = np.array([4.0, 8.0, 6.0, 2.0])

# The formula (1/n) * Σ x_i  is literally:
total = 0.0
for xi in x:            # the Σ
    total += xi
mean = total / len(x)

print(mean)             # 5.0
print(np.mean(x))       # 5.0  -> NumPy writes the loop for you

Key Points to Remember

  • 1e^x grows fast and stays positive; log is its inverse and compresses scale
  • 2ML uses log-probabilities to avoid underflow and to shape loss functions
  • 3Σ (sigma) means "iterate and add" — a for-loop in disguise
  • 4log turns products into sums, which is why log-likelihood is everywhere

Interview Questions

Sign in to ask Aria
1

Why do loss functions use the log of probabilities instead of the raw probabilities?

MediumAmazon
2

Read the summation Σ (from i=1 to n) x_i and describe what it computes.

EasyTCS
3

What is the relationship between e^x and log(x)?

EasyInfosys

Ask Aria about Exponents, Logarithms & Summation Notation

Your personal AI tutor — ask anything about this concept

Revision Status

Personal Notes

Sign in to save personal notes for this topic.

Discussion

Sign in to join the discussion.

Loading discussion…