What Does Log Do? Math Basics and Real-World Uses

A logarithm (log) tells you the power you need to raise a base number to in order to get another number. If 10² = 100, then log(100) = 2. That’s the core idea: logs reverse exponentiation, turning multiplication into addition and compressing enormous ranges of numbers into manageable scales. This single function quietly underpins everything from how we measure sound and earthquakes to how scientists calculate acidity and drug dosing.

The Basic Math Behind Log

When you see “log,” it typically means base-10 logarithm. So log(1,000) = 3, because 10³ = 1,000. The other common version is the natural log, written as “ln,” which uses a special mathematical constant (roughly 2.718) as its base. Natural logs show up constantly in calculus, physics, and finance because they describe continuous growth and decay with elegant simplicity.

The key property that makes logs so useful: they grow incredibly slowly compared to the numbers they represent. While the input shoots from 10 to 10,000,000, the log output only creeps from 1 to 7. This compression is the reason scientists reach for logarithms whenever they need to work with data that spans wildly different magnitudes, from the energy of earthquakes to the concentration of molecules in a solution.

How Log Scales Work in Real Life

A logarithmic scale replaces equal spacing with equal ratios. On a normal (linear) ruler, the jump from 1 to 2 is the same distance as 2 to 3. On a log scale, the jump from 1 to 10 takes the same space as 10 to 100 or 100 to 1,000. Each step represents a tenfold increase. This lets you plot things like bacterial populations and stock prices, where early changes are tiny and later changes are massive, on a single readable graph.

Measuring Sound: The Decibel Scale

Sound intensity varies by a factor of about a trillion between the quietest thing you can hear and the threshold of pain. Expressing that in raw numbers is impractical, so acoustics uses decibels, which are defined using a logarithmic formula. Every increase of 6 decibels doubles the actual pressure of the sound wave hitting your ear. A conversation at 60 dB isn’t “twice as loud” as a 30 dB whisper; it involves sound pressure roughly 30 times greater. Without the log scale, comparing a library to a rock concert in the same unit system would be like measuring both a paperclip and a skyscraper in millimeters.

Earthquake Magnitude

The Richter scale (and its modern successors) is logarithmic. Each whole number increase represents a tenfold increase in the measured seismic wave amplitude. Even more dramatic: according to the U.S. Geological Survey, each step up releases roughly 32 times more energy. A magnitude 7 earthquake doesn’t release twice the energy of a magnitude 6. It releases about 32 times more. A magnitude 8 releases about 1,000 times more energy than a 6. Logs are the only reason those comparisons fit on a practical scale.

Acidity and the pH Scale

The pH of a solution is defined as the negative log of the hydrogen ion concentration. Pure water has a pH of 7. Lemon juice sits around 2. That five-unit difference sounds modest, but because the scale is logarithmic, each single step represents a tenfold change in acidity. A solution at pH 3 is ten times more acidic than one at pH 4 and a hundred times more acidic than one at pH 5. Coffee at pH 5 and stomach acid at pH 1 differ by four log units, meaning stomach acid is roughly 10,000 times more concentrated in hydrogen ions.

This is why small pH shifts matter so much in biology and environmental science. Ocean acidification of just 0.1 pH units represents a roughly 26% increase in hydrogen ion concentration, enough to stress coral reefs and shellfish.

Bacterial Growth and “Log Phase”

When microbiologists talk about bacteria being in “log phase,” they mean the exponential growth stage where cells divide at a constant, maximal rate. The name comes from the fact that plotting cell count over time on a logarithmic scale produces a straight line during this period. Some bacteria, like certain Salmonella strains, can double their population every 20 minutes during log phase, provided they have enough nutrients, carbon, nitrogen, and trace elements like iron. That kind of doubling means a single bacterium could theoretically become over a billion in about 10 hours. Researchers use log-scale plots to track this growth because the raw numbers escalate too fast for a linear graph to be readable.

Drug Dosing and Dose-Response Curves

Pharmacologists plot drug concentration on a log scale when measuring how a medication affects the body. The result is the classic S-shaped (sigmoid) dose-response curve, a foundational tool in drug development. Plotting dose on a log axis stretches out the low-concentration region where the drug first starts working and compresses the high-concentration region where adding more drug barely changes the effect. This makes it easy to identify the dose that produces half the maximum response, a critical reference point for determining how much of a drug patients actually need. Plotting two curves on the same log-dose axis, one for the desired effect and one for side effects, also reveals the “therapeutic window,” the dosing range where benefits outweigh harm.

Log in Programming and Computing

If you’ve searched “what does log do” with a coding context in mind, the function appears in virtually every programming language. In Python, JavaScript, and most others, a log function returns the logarithm of a number you pass to it. The base varies by language and function name: Python’s math.log(x) returns the natural log by default, while math.log10(x) returns base-10. JavaScript’s Math.log() is also natural log.

Beyond syntax, logarithms are baked into computer science itself. Algorithm efficiency is often described in “log n” terms. Binary search, for example, finds an item in a sorted list of a million entries in about 20 steps because log₂(1,000,000) ≈ 20. Each step cuts the remaining possibilities in half, and the log tells you how many halvings it takes to get down to one.

Why Logs Keep Showing Up Everywhere

The thread connecting all these examples is compression. Human-relevant phenomena, from sound to seismic energy to chemical concentration, often span ranges so vast that working with raw numbers is either impossible or misleading. Logarithms convert multiplicative relationships into additive ones, turning “ten times more” into “one unit more.” That translation matches how we actually perceive many things. Psychophysicists have shown that human hearing and vision respond roughly logarithmically to stimulus intensity: doubling the brightness of a light doesn’t feel twice as bright.

So whether you’re reading a pH strip, comparing earthquake reports, tuning audio levels, or analyzing an algorithm’s speed, the log function is doing the same job: squeezing a huge range of values into a scale your brain can work with.