A logarithm is the exponent that produces a specified number when a fixed base is raised to that exponent. For positive real numbers and , with , the statement means precisely that . Thus , because , and , because . A logarithmic function is the inverse of an exponential function.
Logarithms connect multiplicative relationships with additive ones. Their central identity, , 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 and . The real exponential function is a continuous, one-to-one map from the real numbers onto the positive real numbers. Its inverse is the logarithmic function with base , written . Consequently,
The domain is , and the range is all real numbers. The inverse identities are
for real and positive . In particular, and .
The conditions on the base are essential. Base would give a constant exponential function and therefore no inverse. Base 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 , the logarithm is strictly increasing. Arguments greater than have positive logarithms, while arguments between and have negative logarithms. If , the function is strictly decreasing and these signs reverse. For example, . The graph always passes through , and it is the reflection of the graph of across the line . The vertical axis is an asymptote, never a part of the graph.
Logarithms need not be integers or even rational numbers. For instance, is irrational. If it equaled a positive rational number , then , 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 make ?” from whole numbers of factors to arbitrary real exponents.
Solving an exponential equation is therefore a basic application. If , with , then . More generally, , with and , gives . Here denotes the natural logarithm.
Algebraic laws and change of base
For positive , an admissible base , and a real exponent , logarithms satisfy
These identities follow directly from the laws of exponentiation. If and , then , so its logarithm is . 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, 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,
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:
where , , and , . To derive this formula, write and take logarithms to base , obtaining . Important consequences include
when both bases are admissible, and
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, ; the latter equals . Expressions involving sums usually require other methods. A useful exception in form, rather than substance, is
for positive . This merely factors before applying the product rule.
Domain restrictions also prevent careless rearrangement. The real expression is defined for every nonzero , whereas requires . The universally valid real identity is . 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
usually called Euler’s number. The logarithm to base is the natural logarithm, written , although advanced mathematical texts also commonly write . The natural base is distinguished by differentiation: the derivative of is , and the derivative of is exactly . Other bases introduce a constant factor.
One way to define the natural logarithm without first defining exponentiation is
This integral is negative when , zero at , and positive when . 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, is the unique positive number satisfying .
The common logarithm has base , written , and often simply in elementary science and engineering. It is adapted to decimal positional notation. If
then . 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 , floor-based decomposition requires care because the characteristic is negative while the fractional part remains nonnegative.
The binary logarithm, , is natural in computing and information measurement. Since , . A positive integer requires
digits in binary notation, while a positive integer requires 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, usually means the natural logarithm; in some engineering settings it means the common logarithm; and in some algorithmic discussions it means base . Explicit subscripts eliminate ambiguity. The bases are related by and , so their mathematical differences are scale differences, not differences in underlying functional behavior.
Differential and integral properties
The derivative of a real logarithm is
This follows either from the integral definition of or by differentiating . The sign of determines monotonicity. For the natural logarithm,
Thus is strictly increasing and strictly concave. A base between and reverses both properties: its logarithm is decreasing and convex.
The chain rule gives
where . More generally, wherever is differentiable and nonzero. The ratio is called a logarithmic derivative. It measures instantaneous proportional change: if a population grows according to , then . 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 , setting gives , so
For a product of positive differentiable factors,
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
on any interval not containing zero. Integration by parts also yields
Although diverges to negative infinity as , its improper integral near zero is finite:
The distinction illustrates that an unbounded function can still have a convergent improper integral.
Concavity produces important inequalities. The tangent at gives
with equality only at . More generally, Jensen’s inequality implies
for positive , nonnegative weights , and . 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
It converges for . Within , it follows by integrating the geometric series for term by term. At , it gives the alternating harmonic series
which converges conditionally. At , the series diverges, consistent with the singularity of .
Near zero, the first few terms provide useful approximations:
In particular, as . This justifies interpreting a small change in logarithm as an approximate proportional change. For example, a increase multiplies a quantity by and changes its natural logarithm by , close to but not exactly . For , truncating the alternating series gives an error bounded in magnitude by the first omitted term.
Another useful expansion is
For every positive , , so this series converges. It is particularly effective when is near , since then is small. It follows from subtracting the expansions of and . Unlike the alternating series for , all displayed terms have the same sign when .
Logarithms also admit integral representations beyond their defining area:
The difference inside the integral is essential: the two integrals considered separately diverge. Differentiation with respect to recovers , while substitution of fixes the constant. Such formulas connect scalar logarithms with operator functions and integral inequalities.
The Taylor series about a general positive point is
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 ,
More generally, for fixed positive ,
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 , because they introduce only a constant multiplier.
Despite this slow growth, logarithmic divergence is mathematically significant. The harmonic sums satisfy
where is the Euler–Mascheroni constant. Thus the harmonic series diverges even though its partial sums grow only logarithmically. Related integral tests give
as convergent precisely when . The substitution 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 of primes not exceeding satisfies
A more refined classical comparison uses the logarithmic integral, commonly normalized as
The denominator reflects the increasingly sparse distribution of primes. Another important appearance is the logarithmic form of Stirling’s approximation:
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 leads to the Lambert function, defined by . An equation such as can be rearranged to
giving when , subject to branch and domain restrictions. Depending on , there may be no positive real solution, one, or two.
Near zero, logarithms also exhibit characteristic limiting behavior:
for every . A power approaching zero dominates the logarithmic divergence. This fact explains the continuous extension 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 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 was and that of was . Briggs published Logarithmorum Chilias Prima in 1617 and Arithmetica Logarithmica in 1624. The latter gave fourteen-place logarithms for the integers from to and from to . Adriaan Vlacq’s tables of 1628 supplied a continuous ten-place table through .
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
where is an integer and the significand lies in a bounded interval, commonly . Then
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 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 . 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 require special attention. For small , evaluating by first forming may lose most of the meaningful digits in , or round the sum to exactly . The standard function log1p(u) computes this quantity accurately without relying on that rounded intermediate sum. Its companion expm1(u) evaluates 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 , a small absolute perturbation gives
Thus a small relative error in produces an approximately equal absolute error in . The relative condition number is
which becomes large near , 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
The shifted exponentials are at most , 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 , multiplying by increases by one unit. Thus the values are equally spaced on a base- 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 becomes
so it appears as a straight line. On a log–log graph, both axes are logarithmic, and a power law becomes
The slope is the exponent . 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 , the level difference is
A tenfold power increase corresponds to dB, and doubling corresponds to approximately dB. For amplitude quantities whose powers are proportional to their squares under matching conditions, the corresponding formula is . The factor 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:
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 in flux, and several earthquake magnitude scales.
Physical logarithms properly act on dimensionless numbers. An expression informally written as , where is measured in units, usually means for a specified reference quantity . 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
becomes
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 has a normal distribution with mean and variance , then has a lognormal distribution. Its median is , whereas its mean is
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 , increasing by one unit multiplies the fitted by , an exact percentage change of . The approximation is accurate only for small . In a log–log model
the coefficient is an elasticity:
It measures a local ratio of proportional changes.
Logarithms also simplify maximum likelihood estimation. For independent observations with likelihood
the log-likelihood is
Because the logarithm is strictly increasing, maximizing and maximizing 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 has probability
This distribution follows when the fractional part of a quantity’s base- 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 is
The logarithm makes information additive for independent events: if the joint probability is , then . Less probable events carry more information under this measure. Base gives bits, base gives nats, and base gives decimal information units. A certain event has zero self-information because .
For a discrete random variable with probabilities , Shannon entropy is
with defined by its limiting value . If there are equally likely possibilities, then . In base , distinguishing among equally likely outcomes requires 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 and , the Kullback–Leibler divergence is
under the appropriate support conditions. It is nonnegative but generally asymmetric and therefore is not a distance in the metric sense. Cross-entropy is
and satisfies 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 reductions, a problem of size has size about ; reaching constant size therefore requires of order . 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 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 distinguishes at most cases. Sorting distinct items must distinguish possible orders, implying a worst-case lower bound of 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 , a logarithm is any complex number satisfying . Writing
gives all solutions:
Unlike the real logarithm of a positive number, the unrestricted complex logarithm is therefore multivalued. The ambiguity comes from the periodicity , not from any uncertainty in the definition.
A single-valued choice is called a branch. A common principal-value convention chooses the argument in , giving
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
with argument in . On this open domain,
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 . Following a continuously chosen argument around one counterclockwise circuit of the origin increases it by , although the endpoint in the plane is unchanged. Equivalently,
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,
for an integer determined by the argument choices. For example, under the principal-value convention, , while , so the two principal logarithms of 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:
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 is a logarithm of if
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 is diagonalizable, so that , a logarithm can be constructed by choosing logarithms of the nonzero diagonal entries of :
More general matrices require methods that also account for their Jordan structure. If has no eigenvalues on the nonpositive real axis, it has a unique principal logarithm whose eigenvalues have imaginary parts between and . 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 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 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 , it asks for an integer such that
If has order , the exponent is determined modulo . For example,
so the discrete logarithm of to base modulo is modulo , since generates the multiplicative group of nonzero residues modulo .
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.