AI Glossary / Data science and analytics / Intermediate

Logarithm

Definition

A logarithm gives the exponent needed to raise a specified base to a positive number. If b raised to y equals x, then log base b of x equals y. For real-valued logarithms, x must be positive, and the base b must be positive and different from one. Logarithms reverse exponentiation and are useful for expressing multiplicative changes on an additive scale.

What it means

The question log base 10 of 1,000 asks what power of 10 produces 1,000. The answer is 3. Similarly, log base 2 of 8 is 3 because 2 cubed is 8. Common logarithms use base 10, natural logarithms use the number e, and base-2 logarithms appear frequently in computing and information theory. A result should identify its base when the context does not make it clear.

How it works

For positive inputs and a valid common base, the logarithm of a product is the sum of the logarithms, and the logarithm of a quotient is their difference. A power can be brought outside as a multiplier. These identities follow from the rules of exponents and help simplify calculations. In data analysis, a log transformation changes the scale of a positive variable. Equal distances on that transformed scale correspond to equal ratios on the original scale, rather than equal absolute differences.

Three practical examples

  • Visualization: a logarithmic axis can display positive values spanning several orders of magnitude without compressing all smaller values into one narrow region.
  • Statistical modeling: analysts may log-transform a positive variable when a multiplicative relationship better describes the question, then evaluate the resulting model's assumptions.
  • Probability computation: products of many small positive probabilities can be represented as sums of logarithms, helping numerical calculations avoid some underflow problems.

Think of it this way

Think of a ruler that marks repeated multiplications instead of repeated additions. On a base-10 log ruler, 10, 100, and 1,000 are equally spaced because each is ten times the previous value. The analogy does not mean the original differences are equal: they are 90 and 900.

Worked example

Suppose three positive measurements are 10, 100, and 1,000. Their base-10 logarithms are 1, 2, and 3. The first tenfold increase adds one log unit, and the second tenfold increase adds another. A value of 50 lies at log base 10 of 50, approximately 1.699, rather than halfway between 1 and 2.
The midpoint of 1 and 2 on the log scale is 1.5. Returning to the original scale gives 10 to the power 1.5, approximately 31.62. This is the geometric mean of 10 and 100, not their arithmetic mean of 55. For a separate calculation, a rise from 100 to 120 has natural-log difference ln(120) minus ln(100) = ln(1.2), approximately 0.1823. Multiplying by 100 gives 18.23 log points, whereas the ordinary percentage increase is 20%. Log differences approximate relative changes when those changes are small, but the two are not generally identical.

Illustrative case study

In a fictional analytics dashboard, a team plots response durations on a log axis to make both short and long durations visible. A viewer assumes that equally spaced tick marks represent equal numbers of seconds. The team labels the axis clearly, includes representative original-scale values, and explains that spacing represents ratios. It also investigates zero-duration records rather than silently dropping them. The case illustrates communication and data handling, not a claim that a log axis is always preferable.

Common misconceptions and mistakes

The logarithm of a sum is not generally the sum of the logarithms. Logarithms of zero and negative numbers are not defined as ordinary real values. Adding one before logging creates a different transformation whose effect depends on the measurement scale; it is not an automatic fix for every dataset. Logging a variable does not guarantee normality, linearity, or a better model. Also, exponentiating an average log value produces a geometric mean, so reversing a transformation requires attention to which quantity is being estimated.

Business use

Use logarithms when ratios, multiplicative processes, or very different scales are relevant to the decision. Record the base, any offset, and the original units. Explain transformed coefficients and chart distances in terms users can interpret. Check how zeros, negative values, and measurement limits are handled. When a model predicts on a log scale, define how predictions are returned to the original scale and assess accuracy there if that is where the operational decision is made. Do not let a convenient transformation hide important extreme outcomes.

People also ask

Can a logarithm be negative?

Yes. For a base greater than one, positive inputs below one have negative logarithms.

Is log(1) zero?

Yes, for every valid base, because the base raised to zero equals one.

Are log and ln always interchangeable?

No. Ln specifically means the natural logarithm; log may use another base depending on the context.

Check your understanding

Why is the midpoint between 10 and 100 on a base-10 logarithmic axis approximately 31.62 rather than 55?

Answer: The midpoint is halfway between their logarithms, 1 and 2. Exponentiating 1.5 gives approximately 31.62, reflecting equal ratios rather than equal differences.

Related terms

  • Log likelihood
  • Exponent
  • natural logarithm
  • log transformation
  • logarithmic scale
  • geometric mean
  • numerical underflow
  • percentage change

Learn next

Convert several exponential equations into logarithmic form and back. Compare arithmetic and geometric means for positive values. Then inspect a chart with a logarithmic axis and translate its tick spacing into ratios before using a log-transformed model.

More in Data science and analytics

  • Line chart - A line chart displays values as points connected in an ordered sequence, commonly to show change over time.
  • List - A list is an ordered collection of elements. In programming, the exact operations and implementation depend on the language.
  • Local outlier factor - Local outlier factor, or LOF, is a method that scores how unusual an observation is relative to the density around its neighbors.
  • Long Short-Term Memory - Long Short-Term Memory, usually abbreviated LSTM, is a type of recurrent neural network designed to learn relationships across sequences.
  • Loops - Loops are programming structures that repeat a block of instructions. A loop may visit each item in a collection or continue while a condition remains true.
  • Market basket analysis - Market basket analysis examines transaction data to identify items or item groups that occur together.

Sources

OpenStax, logarithmic-function definitions and bases: https://openstax.org/books/algebra-and-trigonometry-2e/pages/6-3-logarithmic-functions OpenStax, logarithmic properties: https://openstax.org/books/intermediate-algebra-2e/pages/10-4-use-the-properties-of-logarithms OpenStax, exponential and logarithmic functions: https://openstax.org/books/calculus-volume-1/pages/1-5-exponential-and-logarithmic-functions

Previous: Log trigger Next: Logarithmic transformation

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer