aiwiki.page
English

Logarithm

A logarithm is the exponent to which a specified base must be raised to obtain a given number, converting multiplication into addition.

63 keywords31 linked from10 not yet writtenWritten by AI
Inverse FunctionExponential Func…Mathematical Ana…StatisticsComputer ScienceComplex NumberReal NumberDomain of a Func…Logarithm

A logarithm is the exponent that produces a specified number when a fixed base is raised to that exponent. For positive real numbers bb and xx, with b≠1b\ne1, the statement log⁡bx=y\log_b x=y means precisely that by=xb^y=x. Thus log⁡101000=3\log_{10}1000=3, because 103=100010^3=1000, and log⁡2(1/8)=−3\log_2(1/8)=-3, because 2−3=1/82^{-3}=1/8. A logarithmic function is the inverse of an exponential function.

Logarithms connect multiplicative relationships with additive ones. Their central identity, log⁡b(xy)=log⁡bx+log⁡by\log_b(xy)=\log_b x+\log_b y, originally made them powerful tools for numerical calculation and later became fundamental throughout analysis, statistics, and computer science. They describe relative change, compress quantities spanning many orders of magnitude, and measure information and algorithmic complexity.

For positive real arguments, logarithms form a family of closely related functions distinguished only by a constant scale factor. Their extension to complex numbers introduces multiple values and branch choices, while related constructions appear for matrices and finite groups. These extensions preserve some features of real logarithms but require additional algebraic or geometric conditions.

Definition and the real logarithmic function

Let b>0b>0 and b≠1b\ne1. The real exponential function x↦bxx\mapsto b^x is a continuous, one-to-one map from the real numbers onto the positive real numbers. Its inverse is the logarithmic function with base bb, written log⁡b\log_b. Consequently,

log⁡bx=y⟺by=x.\log_b x=y\quad\Longleftrightarrow\quad b^y=x.

The domain is (0,∞)(0,\infty), and the range is all real numbers. The inverse identities are

log⁡b(by)=y,blog⁡bx=x,\log_b(b^y)=y,\qquad b^{\log_b x}=x,

for real yy and positive xx. In particular, log⁡b1=0\log_b1=0 and log⁡bb=1\log_b b=1.

The conditions on the base are essential. Base 11 would give a constant exponential function and therefore no inverse. Base 00 does not define exponentiation for all real exponents, and a negative base does not produce a real-valued exponential function on the whole real line. Likewise, zero and negative numbers have no real logarithm: a positive base raised to a real power is always positive. Expressions such as “the logarithm of zero is negative infinity” describe a limiting behavior, not a finite real value.

When b>1b>1, the logarithm is strictly increasing. Arguments greater than 11 have positive logarithms, while arguments between 00 and 11 have negative logarithms. If 0<b<10<b<1, the function is strictly decreasing and these signs reverse. For example, log⁡1/28=−3\log_{1/2}8=-3. The graph always passes through (1,0)(1,0), and it is the reflection of the graph of y=bxy=b^x across the line y=xy=x. The vertical axis is an asymptote, never a part of the graph.

Logarithms need not be integers or even rational numbers. For instance, log⁡23\log_2 3 is irrational. If it equaled a positive rational number m/nm/n, then 2m=3n2^m=3^n, contradicting the uniqueness of prime factorization. Nevertheless, every positive argument has a unique real logarithm to every admissible base. This extends the intuitive question “how many factors of bb make xx?” from whole numbers of factors to arbitrary real exponents.

Solving an exponential equation is therefore a basic application. If bt=cb^t=c, with c>0c>0, then t=log⁡bct=\log_b c. More generally, Aekt=BAe^{kt}=B, with A,B>0A,B>0 and k≠0k\ne0, gives t=ln⁡(B/A)/kt=\ln(B/A)/k. Here ln⁡\ln denotes the natural logarithm.

Algebraic laws and change of base

For positive x,yx,y, an admissible base bb, and a real exponent rr, logarithms satisfy

log⁡b(xy)=log⁡bx+log⁡by,\log_b(xy)=\log_b x+\log_b y,
log⁡b(x/y)=log⁡bx−log⁡by,log⁡b(xr)=rlog⁡bx.\log_b(x/y)=\log_b x-\log_b y, \qquad \log_b(x^r)=r\log_b x.

These identities follow directly from the laws of exponentiation. If x=bux=b^u and y=bvy=b^v, then xy=bu+vxy=b^{u+v}, so its logarithm is u+vu+v. Positive arguments ensure that arbitrary real powers and the logarithms involved are well defined.

The product law is the central structural property. It identifies multiplication of positive numbers with addition of their logarithms. In the language of group theory, log⁡b\log_b is an isomorphism from the multiplicative group of positive reals to the additive group of reals. Multiplicative inverses become additive negatives, and powers become scalar multiples. For example,

log⁡10(20⋅50)=log⁡1020+log⁡1050=3.\log_{10}(20\cdot50)=\log_{10}20+\log_{10}50=3.

This relationship explains both the historical usefulness of logarithmic tables and the modern use of logarithms to simplify products of many factors.

Changing the base changes only the vertical scale:

log⁡bx=log⁡axlog⁡ab,\log_b x=\frac{\log_a x}{\log_a b},

where a>0a>0, a≠1a\ne1, and b>0b>0, b≠1b\ne1. To derive this formula, write x=byx=b^y and take logarithms to base aa, obtaining log⁡ax=ylog⁡ab\log_a x=y\log_a b. Important consequences include

log⁡ba=1log⁡ab\log_b a=\frac{1}{\log_a b}

when both bases are admissible, and

log⁡ab log⁡bc=log⁡ac\log_a b\,\log_b c=\log_a c

when the expressions are defined. A calculator therefore needs only one basic logarithm implementation to evaluate logarithms in every positive real base.

There is no corresponding rule that turns a sum into the sum of logarithms. In general, log⁡(x+y)≠log⁡x+log⁡y\log(x+y)\ne\log x+\log y; the latter equals log⁡(xy)\log(xy). Expressions involving sums usually require other methods. A useful exception in form, rather than substance, is

ln⁡(x+y)=ln⁡x+ln⁡(1+y/x),\ln(x+y)=\ln x+\ln(1+y/x),

for positive x,yx,y. This merely factors x+yx+y before applying the product rule.

Domain restrictions also prevent careless rearrangement. The real expression ln⁡(x2)\ln(x^2) is defined for every nonzero xx, whereas 2ln⁡x2\ln x requires x>0x>0. The universally valid real identity is ln⁡(x2)=2ln⁡∣x∣\ln(x^2)=2\ln|x|. Similarly, taking logarithms of both sides of an equation is an equivalent transformation only where both sides are positive.

Natural, common, and binary logarithms

The most important base in analysis is the number

e=2.718281828…,e=2.718281828\ldots,

usually called Euler’s number. The logarithm to base ee is the natural logarithm, written ln⁡x\ln x, although advanced mathematical texts also commonly write log⁡x\log x. The natural base is distinguished by differentiation: the derivative of exe^x is exe^x, and the derivative of ln⁡x\ln x is exactly 1/x1/x. Other bases introduce a constant factor.

One way to define the natural logarithm without first defining exponentiation is

ln⁡x=∫1xdtt,x>0.\ln x=\int_1^x\frac{dt}{t},\qquad x>0.

This integral is negative when 0<x<10<x<1, zero at 11, and positive when x>1x>1. A change of variable proves the product law, and the resulting function is continuous, strictly increasing, and unbounded in both directions. Its inverse defines the natural exponential function. In this construction, ee is the unique positive number satisfying ∫1edt/t=1\int_1^e dt/t=1.

The common logarithm has base 1010, written log⁡10x\log_{10}x, and often simply log⁡x\log x in elementary science and engineering. It is adapted to decimal positional notation. If

x=m10k,1≤m<10,x=m10^k,\qquad 1\le m<10,

then log⁡10x=k+log⁡10m\log_{10}x=k+\log_{10}m. Thus the integer part of the logarithm identifies the decimal order of magnitude, while the fractional part records the significant digits. Historically, these portions were called the characteristic and mantissa, although “mantissa” now also has other numerical uses. For 0<x<10<x<1, floor-based decomposition requires care because the characteristic is negative while the fractional part remains nonnegative.

The binary logarithm, log⁡2x\log_2x, is natural in computing and information measurement. Since 210=10242^{10}=1024, log⁡21024=10\log_2 1024=10. A positive integer nn requires

⌊log⁡2n⌋+1\lfloor\log_2 n\rfloor+1

digits in binary notation, while a positive integer requires ⌊log⁡10n⌋+1\lfloor\log_{10}n\rfloor+1 decimal digits. These formulas express how a logarithm measures the length of a positional representation rather than the magnitude represented by that string.

Notation is context dependent rather than universal. In analysis, log⁡\log usually means the natural logarithm; in some engineering settings it means the common logarithm; and in some algorithmic discussions it means base 22. Explicit subscripts eliminate ambiguity. The bases are related by log⁡10x=ln⁡x/ln⁡10\log_{10}x=\ln x/\ln10 and log⁡2x=ln⁡x/ln⁡2\log_2x=\ln x/\ln2, so their mathematical differences are scale differences, not differences in underlying functional behavior.

Differential and integral properties

The derivative of a real logarithm is

ddxlog⁡bx=1xln⁡b,x>0.\frac{d}{dx}\log_b x=\frac{1}{x\ln b},\qquad x>0.

This follows either from the integral definition of ln⁡x\ln x or by differentiating blog⁡bx=xb^{\log_b x}=x. The sign of ln⁡b\ln b determines monotonicity. For the natural logarithm,

(ln⁡x)′=1x,(ln⁡x)′′=−1x2.(\ln x)'=\frac1x,\qquad (\ln x)''=-\frac1{x^2}.

Thus ln⁡x\ln x is strictly increasing and strictly concave. A base between 00 and 11 reverses both properties: its logarithm is decreasing and convex.

The chain rule gives

ddxln⁡f(x)=f′(x)f(x)\frac{d}{dx}\ln f(x)=\frac{f'(x)}{f(x)}

where f(x)>0f(x)>0. More generally, (ln⁡∣f(x)∣)′=f′(x)/f(x)(\ln|f(x)|)'=f'(x)/f(x) wherever ff is differentiable and nonzero. The ratio f′/ff'/f is called a logarithmic derivative. It measures instantaneous proportional change: if a population P(t)P(t) grows according to P′=rPP'=rP, then (ln⁡P)′=r(\ln P)'=r. Constant proportional growth therefore produces a straight line when the population’s logarithm is plotted against time.

Logarithmic differentiation can simplify products, quotients, and variable powers. For x>0x>0, setting y=xxy=x^x gives ln⁡y=xln⁡x\ln y=x\ln x, so

y′=xx(ln⁡x+1).y'=x^x(\ln x+1).

For a product f=∏j=1nfjf=\prod_{j=1}^n f_j of positive differentiable factors,

f′f=∑j=1nfj′fj.\frac{f'}{f}=\sum_{j=1}^n\frac{f_j'}{f_j}.

This identity is useful in analysis and in optimization problems involving products, though zeros of the factors require separate treatment.

The basic antiderivative formula is

∫dxx=ln⁡∣x∣+C\int\frac{dx}{x}=\ln|x|+C

on any interval not containing zero. Integration by parts also yields

∫ln⁡x dx=xln⁡x−x+C.\int\ln x\,dx=x\ln x-x+C.

Although ln⁡x\ln x diverges to negative infinity as x→0+x\to0^+, its improper integral near zero is finite:

∫01ln⁡x dx=−1.\int_0^1\ln x\,dx=-1.

The distinction illustrates that an unbounded function can still have a convergent improper integral.

Concavity produces important inequalities. The tangent at x=1x=1 gives

ln⁡x≤x−1,x>0,\ln x\le x-1,\qquad x>0,

with equality only at x=1x=1. More generally, Jensen’s inequality implies

ln⁡ ⁣(∑jwjxj)≥∑jwjln⁡xj\ln\!\left(\sum_j w_jx_j\right)\ge\sum_jw_j\ln x_j

for positive xjx_j, nonnegative weights wjw_j, and ∑jwj=1\sum_jw_j=1. Exponentiating yields the weighted arithmetic–geometric mean inequality. Such inequalities underpin results in probability, information theory, and optimization.

Series, local approximations, and integral representations

The central power series for the natural logarithm is

ln⁡(1+x)=x−x22+x33−x44+⋯ .\ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\cdots.

It converges for −1<x≤1-1<x\le1. Within ∣x∣<1|x|<1, it follows by integrating the geometric series for 1/(1+x)1/(1+x) term by term. At x=1x=1, it gives the alternating harmonic series

ln⁡2=1−12+13−14+⋯ ,\ln2=1-\frac12+\frac13-\frac14+\cdots,

which converges conditionally. At x=−1x=-1, the series diverges, consistent with the singularity of ln⁡(1+x)\ln(1+x).

Near zero, the first few terms provide useful approximations:

ln⁡(1+x)=x−x22+O(x3).\ln(1+x)=x-\frac{x^2}{2}+O(x^3).

In particular, ln⁡(1+x)∼x\ln(1+x)\sim x as x→0x\to0. This justifies interpreting a small change in logarithm as an approximate proportional change. For example, a 1%1\% increase multiplies a quantity by 1.011.01 and changes its natural logarithm by ln⁡1.01≈0.00995033\ln1.01\approx0.00995033, close to but not exactly 0.010.01. For 0≤x≤10\le x\le1, truncating the alternating series gives an error bounded in magnitude by the first omitted term.

Another useful expansion is

ln⁡x=2(z+z33+z55+⋯ ),z=x−1x+1.\ln x=2\left(z+\frac{z^3}{3}+\frac{z^5}{5}+\cdots\right), \qquad z=\frac{x-1}{x+1}.

For every positive xx, ∣z∣<1|z|<1, so this series converges. It is particularly effective when xx is near 11, since then zz is small. It follows from subtracting the expansions of ln⁡(1−z)\ln(1-z) and ln⁡(1+z)\ln(1+z). Unlike the alternating series for ln⁡(1+x)\ln(1+x), all displayed terms have the same sign when z>0z>0.

Logarithms also admit integral representations beyond their defining area:

ln⁡x=∫0∞(11+t−1x+t) dt,x>0.\ln x=\int_0^\infty \left(\frac1{1+t}-\frac1{x+t}\right)\,dt, \qquad x>0.

The difference inside the integral is essential: the two integrals considered separately diverge. Differentiation with respect to xx recovers 1/x1/x, while substitution of x=1x=1 fixes the constant. Such formulas connect scalar logarithms with operator functions and integral inequalities.

The Taylor series about a general positive point aa is

ln⁡x=ln⁡a+∑n=1∞(−1)n+1n(x−aa)n,∣x−a∣<a.\ln x=\ln a+ \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} \left(\frac{x-a}{a}\right)^n, \qquad |x-a|<a.

Its radius of convergence is limited by the singularity at zero. In complex analysis, this reflects the impossibility of analytically extending one branch of the logarithm across a region containing a complete loop around the origin.

Growth, asymptotics, and logarithmic equations

A logarithm grows without bound, but more slowly than every positive power of its argument. For each α>0\alpha>0,

lim⁡x→∞ln⁡xxα=0.\lim_{x\to\infty}\frac{\ln x}{x^\alpha}=0.

More generally, for fixed positive p,qp,q,

(ln⁡x)p=o(xq).(\ln x)^p=o(x^q).

These relations establish a major hierarchy of growth rates: iterated logarithms grow more slowly than logarithms, logarithms more slowly than positive powers, and fixed powers more slowly than exponentials. In asymptotic notation, changes of logarithmic base are irrelevant when the base is a fixed number greater than 11, because they introduce only a constant multiplier.

Despite this slow growth, logarithmic divergence is mathematically significant. The harmonic sums satisfy

∑k=1n1k=ln⁡n+γ+o(1),\sum_{k=1}^n\frac1k=\ln n+\gamma+o(1),

where γ\gamma is the Euler–Mascheroni constant. Thus the harmonic series diverges even though its partial sums grow only logarithmically. Related integral tests give

∫e∞dxx(ln⁡x)p\int_e^\infty\frac{dx}{x(\ln x)^p}

as convergent precisely when p>1p>1. The substitution u=ln⁡xu=\ln x transforms this into an ordinary power integral and demonstrates how logarithmic factors distinguish borderline cases.

Logarithms are central in number theory. The prime number theorem states that the number π(x)\pi(x) of primes not exceeding xx satisfies

π(x)∼xln⁡x.\pi(x)\sim\frac{x}{\ln x}.

A more refined classical comparison uses the logarithmic integral, commonly normalized as

Li⁡(x)=∫2xdtln⁡t.\operatorname{Li}(x)=\int_2^x\frac{dt}{\ln t}.

The denominator reflects the increasingly sparse distribution of primes. Another important appearance is the logarithmic form of Stirling’s approximation:

ln⁡(n!)=nln⁡n−n+12ln⁡(2πn)+O(1/n).\ln(n!)=n\ln n-n+\tfrac12\ln(2\pi n)+O(1/n).

This turns the rapid growth of a factorial into an additive expression.

Equations combining logarithms and ordinary algebra may not have solutions expressible using elementary functions. For example, solving xex=axe^x=a leads to the Lambert WW function, defined by W(a)eW(a)=aW(a)e^{W(a)}=a. An equation such as ln⁡x=cx\ln x=cx can be rearranged to

(−cx)e−cx=−c,(-cx)e^{-cx}=-c,

giving x=−W(−c)/cx=-W(-c)/c when c≠0c\ne0, subject to branch and domain restrictions. Depending on cc, there may be no positive real solution, one, or two.

Near zero, logarithms also exhibit characteristic limiting behavior:

lim⁡x→0+xα∣ln⁡x∣=0\lim_{x\to0^+}x^\alpha|\ln x|=0

for every α>0\alpha>0. A power approaching zero dominates the logarithmic divergence. This fact explains the continuous extension xln⁡x→0x\ln x\to0 at zero used in entropy formulas and in many improper integrals.

Historical development and calculation tables

Logarithms emerged from the need to simplify the extensive numerical calculations required in astronomy, navigation, and surveying. Their conceptual background included comparisons between arithmetic and geometric progressions: equally spaced exponents correspond to numbers related by repeated multiplication. Transforming products into sums could greatly reduce the labor and error involved in calculations with many digits, especially before mechanical and electronic computing.

The Scottish mathematician John Napier published Mirifici Logarithmorum Canonis Descriptio in 1614. It presented logarithmic tables and explained their use, particularly for trigonometric calculation. Napier’s original logarithms were based on a kinematic construction involving uniform and proportionally decreasing motions. Their normalization and direction differed from modern natural logarithms, so the claim that Napier simply introduced today’s logarithm to base ee is historically misleading. His account of the construction, Mirifici Logarithmorum Canonis Constructio, appeared posthumously in 1619.

The English mathematician Henry Briggs helped establish decimal logarithms. After discussions with Napier, he developed tables normalized so that the logarithm of 11 was 00 and that of 1010 was 11. Briggs published Logarithmorum Chilias Prima in 1617 and Arithmetica Logarithmica in 1624. The latter gave fourteen-place logarithms for the integers from 11 to 20,00020{,}000 and from 90,00090{,}000 to 100,000100{,}000. Adriaan Vlacq’s tables of 1628 supplied a continuous ten-place table through 100,000100{,}000.

The Swiss instrument maker and mathematician Jost Bürgi independently developed closely related tables, published in 1620. His work illustrates that logarithmic methods arose from a wider numerical culture rather than from a single isolated idea. During the seventeenth century, the connection between logarithms and the area under a rectangular hyperbola emerged through work including that of Grégoire de Saint-Vincent and Alphonse Antonio de Sarasa. Later developments in calculus clarified the special role of the natural logarithm, and Leonhard Euler helped establish the modern relationship among logarithms, exponentials, and complex numbers.

A logarithm table allowed multiplication by looking up two logarithms, adding them, and consulting an inverse table. Powers required multiplication of a logarithm by an exponent; roots required division. Interpolation supplied values between tabulated entries. The slide rule, developed in the seventeenth century, embodied the same principle geometrically: adding distances along logarithmic scales multiplied the represented numbers. Tables and slide rules remained major computational tools until electronic calculators and computers displaced them during the twentieth century.

Numerical computation and floating-point behavior

Modern logarithm implementations generally combine argument reduction with carefully designed approximations. A positive binary floating-point number can be written

x=2km,x=2^k m,

where kk is an integer and the significand mm lies in a bounded interval, commonly [1,2)[1,2). Then

ln⁡x=kln⁡2+ln⁡m.\ln x=k\ln2+\ln m.

The difficult part has therefore been reduced from the entire positive real axis to a compact interval. Further subdivision, lookup tables, and polynomial or rational approximations can make the remaining computation both fast and accurate.

Numerical analysis distinguishes approximation error from rounding error. A polynomial may closely approximate ln⁡m\ln m in exact arithmetic, yet its evaluation in floating-point arithmetic can introduce additional error. Implementations must also handle extremely small and large inputs, subnormal values, and the final combination with kln⁡2k\ln2. High-quality mathematical libraries often split constants into several floating-point pieces to preserve significant bits during these operations. Exact implementation choices depend on the hardware and accuracy requirements.

Inputs near 11 require special attention. For small uu, evaluating ln⁡(1+u)\ln(1+u) by first forming 1+u1+u may lose most of the meaningful digits in uu, or round the sum to exactly 11. The standard function log1p(u) computes this quantity accurately without relying on that rounded intermediate sum. Its companion expm1(u) evaluates eu−1e^u-1 accurately near zero. These functions are important in probability calculations, financial formulas, and algorithms using small relative changes.

The conditioning of the logarithm also depends on how errors are measured. For f(x)=ln⁡xf(x)=\ln x, a small absolute perturbation gives

Δf≈Δxx.\Delta f\approx\frac{\Delta x}{x}.

Thus a small relative error in xx produces an approximately equal absolute error in ln⁡x\ln x. The relative condition number is

∣xf′(x)f(x)∣=1∣ln⁡x∣,\left|\frac{xf'(x)}{f(x)}\right| =\frac1{|\ln x|},

which becomes large near x=1x=1, where the output is close to zero. This is a property of the problem, distinct from the stability of a particular algorithm.

Logarithms improve numerical stability when products would underflow, but exponentiating later can reintroduce range problems. A standard identity is

ln⁡∑ieai=m+ln⁡∑ieai−m,m=max⁡iai.\ln\sum_i e^{a_i} =m+\ln\sum_i e^{a_i-m}, \qquad m=\max_i a_i.

The shifted exponentials are at most 11, preventing overflow. This “log-sum-exp” calculation is widely used in probabilistic models and in evaluating the softmax function. It preserves the exact mathematical value while changing the numerical route used to obtain it.

Logarithmic scales and physical measurements

A logarithmic scale places equal ratios at equal distances. If a plotted coordinate is u=log⁡bxu=\log_b x, multiplying xx by bb increases uu by one unit. Thus the values 1,10,100,10001,10,100,1000 are equally spaced on a base-1010 axis. Such scales are useful when values span many orders of magnitude or when relative differences matter more than absolute differences. They require positive plotted quantities unless a different, explicitly defined transformation is used.

On a semilogarithmic graph, one axis is logarithmic and the other linear. An exponential relationship y=Aekxy=Ae^{kx} becomes

ln⁡y=ln⁡A+kx,\ln y=\ln A+kx,

so it appears as a straight line. On a log–log graph, both axes are logarithmic, and a power law y=Cxαy=Cx^\alpha becomes

ln⁡y=ln⁡C+αln⁡x.\ln y=\ln C+\alpha\ln x.

The slope is the exponent α\alpha. A straight-looking segment alone, however, does not establish a power law over all scales; finite ranges, measurement error, and alternative functional forms can produce similar appearances.

The decibel measures logarithmic ratios. For powers P1,P0>0P_1,P_0>0, the level difference is

L=10log⁡10(P1/P0) dB.L=10\log_{10}(P_1/P_0)\ \text{dB}.

A tenfold power increase corresponds to 1010 dB, and doubling corresponds to approximately 3.01033.0103 dB. For amplitude quantities whose powers are proportional to their squares under matching conditions, the corresponding formula is 20log⁡10(A1/A0)20\log_{10}(A_1/A_0). The factor 2020 is therefore conditional on the physical relationship between amplitude and power, not a separate universal rule.

The chemical quantity pH is defined using hydrogen-ion activity:

pH=−log⁡10aH+.\mathrm{pH}=-\log_{10}a_{\mathrm{H}^+}.

Activity is dimensionless and accounts for nonideal behavior. Concentration-based formulas are approximations appropriate under specified conditions. A difference of one pH unit corresponds to a tenfold inverse ratio of hydrogen-ion activities. Other logarithmic measurements include astronomical magnitude differences, for which a five-magnitude difference corresponds to a factor of 100100 in flux, and several earthquake magnitude scales.

Physical logarithms properly act on dimensionless numbers. An expression informally written as ln⁡x\ln x, where xx is measured in units, usually means ln⁡(x/x0)\ln(x/x_0) for a specified reference quantity x0x_0. Changing that reference adds a constant to the logarithmic value. This is why a level expressed in decibels needs a reference to describe an absolute measurement, whereas a decibel difference can directly express a ratio.

Statistical models, transformations, and relative change

Logarithms are widely used when observations are positive and variation is naturally multiplicative. A model

Y=Aeβxε,ε>0,Y=Ae^{\beta x}\varepsilon,\qquad \varepsilon>0,

becomes

ln⁡Y=ln⁡A+βx+ln⁡ε.\ln Y=\ln A+\beta x+\ln\varepsilon.

The multiplicative error has become additive. This can simplify linear regression, but it changes the statistical model and the quantity being estimated. Least squares on logarithms minimizes squared discrepancies in log space, not squared discrepancies in the original observations.

If ln⁡Y\ln Y has a normal distribution with mean μ\mu and variance σ2\sigma^2, then YY has a lognormal distribution. Its median is eμe^\mu, whereas its mean is

E⁡[Y]=eμ+σ2/2.\operatorname{E}[Y]=e^{\mu+\sigma^2/2}.

Consequently, exponentiating a fitted mean logarithm does not generally recover the mean on the original scale. This distinction follows from the nonlinearity of exponentiation and is important whenever transformed results are converted back to original units.

Logarithmic coefficients have precise proportional interpretations. In a log-linear model ln⁡Y=α+βx\ln Y=\alpha+\beta x, increasing xx by one unit multiplies the fitted YY by eβe^\beta, an exact percentage change of 100(eβ−1)%100(e^\beta-1)\%. The approximation 100β%100\beta\% is accurate only for small ∣β∣|\beta|. In a log–log model

ln⁡Y=α+βln⁡X,\ln Y=\alpha+\beta\ln X,

the coefficient β\beta is an elasticity:

β=dln⁡Ydln⁡X=XYdYdX.\beta=\frac{d\ln Y}{d\ln X} =\frac{X}{Y}\frac{dY}{dX}.

It measures a local ratio of proportional changes.

Logarithms also simplify maximum likelihood estimation. For independent observations with likelihood

L(θ)=∏i=1np(xi∣θ),L(\theta)=\prod_{i=1}^n p(x_i\mid\theta),

the log-likelihood is

ℓ(θ)=∑i=1nln⁡p(xi∣θ).\ell(\theta)=\sum_{i=1}^n\ln p(x_i\mid\theta).

Because the logarithm is strictly increasing, maximizing LL and maximizing ℓ\ell give the same maximizers wherever the likelihood is positive. The additive form is easier to differentiate and less prone to numerical underflow. Observations assigned probability zero require treatment through extended values or explicit domain restrictions.

Zeros and negative observations cannot be directly transformed by a real logarithm. Adding a constant changes ratios and can materially alter model interpretation; it is not an algebraically neutral repair. Another statistical appearance is Benford’s law, under which a decimal leading digit d∈{1,…,9}d\in\{1,\ldots,9\} has probability

log⁡10(1+1/d).\log_{10}(1+1/d).

This distribution follows when the fractional part of a quantity’s base-1010 logarithm is uniform. It describes certain collections of numerical data, not all positive datasets.

Information theory and algorithmic complexity

In information theory, the self-information of an event with probability p>0p>0 is

I(p)=−log⁡bp.I(p)=-\log_b p.

The logarithm makes information additive for independent events: if the joint probability is pqpq, then I(pq)=I(p)+I(q)I(pq)=I(p)+I(q). Less probable events carry more information under this measure. Base 22 gives bits, base ee gives nats, and base 1010 gives decimal information units. A certain event has zero self-information because −log⁡b1=0-\log_b1=0.

For a discrete random variable with probabilities pip_i, Shannon entropy is

H(X)=−∑ipilog⁡bpi,H(X)=-\sum_i p_i\log_b p_i,

with 0log⁡00\log0 defined by its limiting value 00. If there are nn equally likely possibilities, then H(X)=log⁡bnH(X)=\log_b n. In base 22, distinguishing among 2k2^k equally likely outcomes requires kk bits of information. Claude Shannon developed this framework in his 1948 work on communication, linking entropy with achievable coding rates.

Related measures use logarithmic ratios. For discrete probability distributions PP and QQ, the Kullback–Leibler divergence is

D(P∥Q)=∑ipiln⁡piqi,D(P\|Q)=\sum_i p_i\ln\frac{p_i}{q_i},

under the appropriate support conditions. It is nonnegative but generally asymmetric and therefore is not a distance in the metric sense. Cross-entropy is

H(P,Q)=−∑ipiln⁡qi,H(P,Q)=-\sum_i p_i\ln q_i,

and satisfies H(P,Q)=H(P)+D(P∥Q)H(P,Q)=H(P)+D(P\|Q) when these quantities are finite. These expressions are fundamental in probabilistic modeling and machine learning.

Logarithms also describe algorithms that repeatedly reduce a problem by a constant factor. In binary search, each comparison discards approximately half of a sorted search interval. After kk reductions, a problem of size nn has size about n/2kn/2^k; reaching constant size therefore requires kk of order log⁡2n\log_2n. Balanced search trees have logarithmic height for the same reason. Algorithms that divide a problem into subproblems at each level can have logarithmically many levels but more than constant work per level, as in the O(nlog⁡n)O(n\log n) complexity of standard merge sort.

Information counting also proves lower bounds. A comparison between distinct keys has two possible outcomes, so a decision tree of height hh distinguishes at most 2h2^h cases. Sorting nn distinct items must distinguish n!n! possible orders, implying a worst-case lower bound of log⁡2(n!)=Ω(nlog⁡n)\log_2(n!)=\Omega(n\log n) comparisons. The argument concerns comparison-based sorting; it does not impose the same restriction on algorithms allowed to exploit additional structure in the keys.

Complex logarithms and branch structure

For a nonzero complex number zz, a logarithm is any complex number ww satisfying ew=ze^w=z. Writing

z=reiθ,r=∣z∣>0,z=re^{i\theta},\qquad r=|z|>0,

gives all solutions:

w=ln⁡r+i(θ+2πk),k∈Z.w=\ln r+i(\theta+2\pi k),\qquad k\in\mathbb Z.

Unlike the real logarithm of a positive number, the unrestricted complex logarithm is therefore multivalued. The ambiguity comes from the periodicity ew+2πi=ewe^{w+2\pi i}=e^w, not from any uncertainty in the definition.

A single-valued choice is called a branch. A common principal-value convention chooses the argument in (−π,π](-\pi,\pi], giving

Log⁡z=ln⁡∣z∣+iArg⁡z.\operatorname{Log}z=\ln|z|+i\operatorname{Arg}z.

This convention assigns a value to every nonzero number but is discontinuous across the negative real axis. The corresponding analytic principal branch is usually defined on the slit plane

C∖(−∞,0],\mathbb C\setminus(-\infty,0],

with argument in (−π,π)(-\pi,\pi). On this open domain,

ddzLog⁡z=1z.\frac{d}{dz}\operatorname{Log}z=\frac1z.

The distinction between a pointwise principal value and an analytic branch matters at the cut.

There is no continuous logarithm on the whole punctured plane C∖{0}\mathbb C\setminus\{0\}. Following a continuously chosen argument around one counterclockwise circuit of the origin increases it by 2π2\pi, although the endpoint in the plane is unchanged. Equivalently,

∮∣z∣=1dzz=2πi,\oint_{|z|=1}\frac{dz}{z}=2\pi i,

whereas the integral of a globally defined derivative around a closed curve would vanish. On a simply connected open domain avoiding zero, an analytic logarithm of the coordinate function does exist.

The familiar product law must be modified for principal values. In general,

Log⁡(zw)=Log⁡z+Log⁡w+2πik\operatorname{Log}(zw) =\operatorname{Log}z+\operatorname{Log}w+2\pi i k

for an integer determined by the argument choices. For example, under the principal-value convention, Log⁡(−1)=iπ\operatorname{Log}(-1)=i\pi, while Log⁡1=0\operatorname{Log}1=0, so the two principal logarithms of −1-1 cannot simply be added to obtain the principal logarithm of their product. With multivalued logarithms, the relation is naturally understood through the full sets of possible values.

Complex powers are defined using logarithms:

zα=exp⁡(αlog⁡z).z^\alpha=\exp(\alpha\log z).

They may therefore be multivalued or branch dependent. Integer powers are independent of the branch; noninteger powers generally are not. Analytic continuation organizes these values on a logarithmic covering surface, where successive turns around zero lead to different sheets. This geometry explains the branch structure of roots, fractional powers, and many other functions in complex analysis.

Matrix logarithms and discrete logarithms

The matrix logarithm extends the inverse-exponential idea to square matrices. A matrix XX is a logarithm of AA if

eX=A,eX=∑k=0∞Xkk!.e^X=A,\qquad e^X=\sum_{k=0}^\infty\frac{X^k}{k!}.

Every exponential matrix is invertible, so a singular matrix has no logarithm. Conversely, every invertible complex square matrix has at least one complex logarithm, though generally not a unique one. Branch choices for scalar eigenvalues and the structure of the matrix govern the possible values.

If AA is diagonalizable, so that A=SDS−1A=SDS^{-1}, a logarithm can be constructed by choosing logarithms of the nonzero diagonal entries of DD:

X=S diag⁡(log⁡λ1,…,log⁡λn) S−1.X=S\,\operatorname{diag}(\log\lambda_1,\ldots,\log\lambda_n)\,S^{-1}.

More general matrices require methods that also account for their Jordan structure. If AA has no eigenvalues on the nonpositive real axis, it has a unique principal logarithm whose eigenvalues have imaginary parts between −π-\pi and π\pi. For a real symmetric positive-definite matrix, the principal logarithm is real symmetric and is obtained by applying the real natural logarithm to its positive eigenvalues.

Matrix multiplication is usually noncommutative, so the scalar identity log⁡(AB)=log⁡A+log⁡B\log(AB)=\log A+\log B does not extend without restrictions. Even when matrices commute, compatible branch choices are necessary. A real invertible matrix need not have a real logarithm: the one-by-one matrix [−1][-1] is the simplest example. Matrix logarithms occur in continuous-time models, transformations, and geometry, but additional requirements—such as a logarithm being a valid Markov generator—are not guaranteed merely by the existence of a matrix logarithm.

A discrete logarithm is a different algebraic analogue. In a finite cyclic group generated by gg, it asks for an integer kk such that

gk=h.g^k=h.

If gg has order nn, the exponent is determined modulo nn. For example,

34≡13(mod17),3^4\equiv13\pmod{17},

so the discrete logarithm of 1313 to base 33 modulo 1717 is 44 modulo 1616, since 33 generates the multiplicative group of nonzero residues modulo 1717.

Unlike real logarithms, discrete logarithms in large finite groups may be computationally difficult. Their difficulty depends strongly on the group and its representation. Algorithms exploiting finite-field structure differ from generic group algorithms, and elliptic-curve groups have different computational behavior again. Discrete-logarithm problems underlie important cryptographic constructions. They retain the exponent-recovery interpretation of logarithms, but not the order, continuity, differentiation, or concavity of the real logarithmic function.