Back to Writing
NOTESgame-mathlogarithmsbig-oalgorithmscomputer-science

Game Math - What Is a Logarithm?

April 5, 2020Updated Feb 17, 2026

![](

Nud2OjJVPgqhbB3vMsg.HrJpWbZVoGbcU-bl_sDA7wq0mvLjeORnTuaCt8ket7Ug.PNG.cdw0424/image.png?type=w966)

"I don't understand what a logarithm even is."

Or

"I can solve math problems involving logs, but I still don't understand what a logarithm actually is."

If either of these describes you, this article should help.

If you already understand logarithms better than most, feel free to skip this and move on.

What Is a Logarithm?

Simply put, a logarithm is a tool for making calculations with large numbers easier.

Before computers existed, people had to perform large calculations by hand, and logarithms were developed to make these calculations more manageable.

A logarithm is a tool for easily computing large numbers.

Core Concept:

How many times do you need to raise the base to get that number?

That's what a logarithm asks.

For example:

  • What power of 2 equals 8? Answer: 3 (because 2^3 = 8)
  • What power of 10 equals 1000? Answer: 3 (because 10^3 = 1000)

Basic Formula:

log_b(x) = y means b^y = x

Where:

  • b = base
  • x = the number
  • y = the power (the answer we're looking for)

Modern Relevance:

In the modern era, computers handle large calculations for us, so the role of logarithms might seem unclear. However, the fundamental property of logshow many times must you divide a number by the base to reach 1? — remains useful for expressing various stages or states.

For example:

![](

qsHog.w77sINl02AFxpBt5reHrnH4v3vJHs2AcvPANSqJ6QlQg.JPEG.cdw0424/photo-1517694712202-14dd9538aa97.jpg?type=w966)

In computer science, there's a way to express algorithm time complexity called Big O notation. Among these, O(log n) is a classic example that uses logarithms to describe steps.

The base of O(log n) is implicitly 2, since it represents binary search.

In simple terms: How many steps does it take to find the desired result by repeatedly halving (dividing by 2) the search space?

Logarithms and Exponents:

Logarithms and exponents are inverse operations of each other.

  • Exponent: 2^x (2 raised to the power of x)
  • Logarithm: log2(x) (log base 2 of x)

They cancel each other out:

  • If 2^3 = 8, then log2(8) = 3

Practical Applications in Game Development:

  1. Difficulty scaling: Using logs to adjust difficulty based on player level
  2. Resource calculation: Computing exponential resource growth over time
  3. Distance calculation: Using logs for perception range calculations
  4. Inventory systems: Managing exponential growth of item quantities

Common Logarithm Bases:

  • log2: Binary logarithm (used in computer science)
  • log10: Common logarithm (base 10)
  • ln: Natural logarithm (base e)

Why Logarithms Matter:

Logarithms help us:

  • Understand exponential growth and decay
  • Compress wide ranges into manageable scales
  • Analyze algorithm efficiency
  • Model real-world phenomena

Additional Notes:

Why can multiplication and division be converted to addition and subtraction through logarithms? The proof is beyond the scope of this article, which focuses on understanding logs. Honestly, I'm curious about this too, but the resources I've found online only give the tautological answer "because of the laws of exponents." If I get the chance, I'd love to ask a mathematician directly.

Etymology:

The full name of log — "Logarithm" — comes from the Greek words "Logos" (meaning ratio) and "arithmos" (meaning number). It's a word meaning "a number that calculates ratios."

One theory about why this name was chosen traces back to the era when maritime navigation was advancing and astronomy was crucial. When calculating ship speed, knots were tied at regular intervals on a rope, the rope was released from the ship, and logarithmic calculations were used to interpret the ratio between knot spacing and total rope length.

The naming may have been influenced by the relationship between the rope's ratio and the number of knots, though this can't be confirmed with certainty.

Understanding logarithms opens up a world of mathematical thinking. Start simple and gradually explore deeper concepts!