Total variation is a mathematical measure of accumulated change that counts increases and decreases without allowing them to cancel. For a function on an interval, it is the supremum of the sums of absolute increments over all finite partitions. For a signed or complex measure, it is a positive measure recording the magnitude of that measure independently of sign or phase. In probability, total variation distance measures the largest difference that two probability distributions assign to the same event.
These formulations are connected rather than merely analogous. A function of bounded variation has a derivative that can be interpreted as a measure, and the total mass of its variation measure recovers its accumulated change. In several dimensions, this construction accommodates discontinuities along surfaces, making total variation fundamental to mathematical analysis, geometric problems involving perimeter, and partial differential equations. Its ability to penalize oscillation without excluding jumps also underlies edge-preserving methods in imaging and statistical estimation.
Variation of functions on an interval
Let . For a partition
the variation sum is
The total variation of on the interval is
where the supremum is taken over all finite partitions. The definition also applies to complex-valued functions by using the complex modulus, and to maps into a metric space by replacing absolute differences with distances. A function is said to have bounded variation if this supremum is finite.
Refining a partition cannot decrease its variation sum, by the triangle inequality. This distinguishes total variation from the net change : an excursion upward followed by an equal excursion downward contributes positively even though its net change vanishes. For a monotone function,
For on , the total variation is , although the endpoint values agree. For a piecewise constant function, the variation is the sum of its jump magnitudes, provided the values assigned at the jump points introduce no additional excursions.
Total variation is additive across adjacent intervals:
It is homogeneous and subadditive:
It is therefore a seminorm on the vector space of bounded-variation functions. Constants have zero variation, so a norm requires additional information, for example
With this norm, the space is complete.
The classical theory is associated with Camille Jordan, who introduced bounded variation in his 1881 work on Fourier series. The central structural result, the Jordan decomposition, states that a real-valued function has bounded variation precisely when it can be expressed as the difference of two bounded nondecreasing functions. To see the mechanism, set
The functions
are nondecreasing and satisfy . Thus finite accumulated oscillation is equivalent to the possibility of separating all upward and downward change into two finite monotone components.
Differentiation, continuity, and singular change
For a continuously differentiable function, total variation has the familiar calculus expression
The same identity holds when is absolutely continuous, with its derivative understood almost everywhere and the integral interpreted as a Lebesgue integral. Absolute continuity ensures that
so every change in the function is accounted for by its integrable derivative. For a smooth curve , the analogous expression gives its length, illustrating how variation generalizes accumulated path length.
Bounded variation is strictly weaker than absolute continuity. A one-dimensional bounded-variation function has finite one-sided limits at every interior point and is differentiable almost everywhere. Its derivative belongs to , but generally only
holds. A step function has derivative zero almost everywhere but positive variation. More subtly, the Cantor function is continuous, nondecreasing, and has variation on , while its derivative vanishes almost everywhere. Its change is concentrated on the Cantor set, which has Lebesgue measure zero. Consequently, neither continuity nor almost-everywhere differentiability rules out change invisible to the ordinary derivative.
For an appropriately chosen representative, the generalized derivative of a bounded-variation function decomposes into three parts:
Here denotes Lebesgue measure, is an atomic measure carrying jumps, and is singular with respect to Lebesgue measure but has no atoms. At a jump point , the derivative measure has mass . Its variation therefore counts . The three mutually singular components contribute separately to the total variation measure.
A distinction between pointwise and measure-theoretic definitions is essential. Changing a function at one point may alter its partition-based variation, but it does not change its equivalence class in an space or its distributional derivative. For example, the function equal to at a single interior point and elsewhere has classical variation , but represents the zero element of , whose distributional variation is zero. Right-continuous representatives are commonly used in one-dimensional measure constructions. Endpoint values must likewise be specified when comparing variation on a closed interval with the mass of a derivative measure defined only on its interior.
Variation of signed, complex, and vector measures
The measure-theoretic definition extends the same principle of preventing cancellation. Let be a finite signed or complex measure on a measurable space . Its total variation measure is
where the supremum is over all finite measurable partitions of . Although may take negative or complex values, is a positive measure. The quantity
is a norm on the space of finite signed or complex measures. The resulting space is a Banach space.
For a signed measure, the measure version of Jordan decomposition gives
where and are positive measures concentrated on disjoint measurable regions. For example,
has total mass , but variation norm . Here is the Dirac measure at . The distinction between signed mass and variation mass is exactly the distinction between net displacement and accumulated change for functions.
If has density with respect to a positive measure , then
More generally, the Radon–Nikodym theorem yields the polar representation
For real signed measures, takes values and ; for complex measures it records phase. Integration against satisfies
and the associated dual characterization is
These formulas explain why variation is the natural measure for controlling integration against signed data.
The connection to functions is supplied by Lebesgue–Stieltjes measures. A right-continuous bounded-variation function determines a signed measure through increments
With compatible endpoint conventions, the mass of its variation measure agrees with the corresponding function variation. The construction extends to finite-dimensional vector measures by replacing absolute value with a chosen vector norm. Their variation is again a positive measure, and their polar decomposition writes the measure as a unit-vector-valued density times its variation. This vector-valued case is the foundation of total variation for gradients in several dimensions.
Functions of bounded variation in several dimensions
There is no single ordered family of partitions in analogous to subdivisions of an interval. The standard multidimensional definition instead uses distributional derivatives. For an open set and , define
The space consists of the functions for which this quantity is finite. The compact support of the test vector fields means that this definition measures variation inside , without automatically adding a boundary contribution.
The distributional gradient of a function is a finite vector-valued Radon measure, and is its total variation measure. If is smooth, integration by parts gives
where is the ordinary gradient. The same identity holds for in the Sobolev space . Thus , but the inclusion is generally strict: a characteristic function separated by a smooth interface has a measure-valued gradient concentrated on that interface, not an integrable gradient density.
For scalar-valued functions, the derivative measure has a decomposition analogous to the one-dimensional case:
The jump component has the representation
D^j u = (u^+-u^-)\nu_u\, \mathcal H^{d-1}\!\mathbin{\vrule height 1.4ex depth -0.3ex width 0.07ex\vrule height 0.07ex depth -0.02ex width 0.7ex}J_u,where is the approximate jump set, are the approximate values on its two sides, is a unit normal, and is Hausdorff measure. In particular,
This formula makes the geometric meaning explicit: a jump costs its amplitude multiplied by the area of the interface carrying it.
The standard norm is
The first term controls the level of the function, while the second controls spatial change. The use of the Euclidean norm in the definition is a substantive choice: it gives isotropic variation, invariant under rotations. Replacing it with another norm produces an anisotropic variation whose cost depends on interface orientation. This distinction matters both in geometric variational problems and in numerical approximations, where coordinate-aligned differences can introduce a preferred set of directions.
Perimeter, level sets, and compactness
Total variation supplies a measure-theoretic definition of perimeter. For a measurable set , let be its indicator function. Its perimeter relative to an open set is
A set with finite perimeter is also called a Caccioppoli set. If has a smooth boundary, this definition agrees with the -dimensional area of . Unlike a definition based directly on the topological boundary, it is unchanged by alterations on sets of Lebesgue measure zero. It therefore avoids assigning artificial perimeter to negligible modifications of a set.
For general finite-perimeter sets, the relevant boundary is the reduced boundary, where a measure-theoretic unit normal exists. Perimeter is the Hausdorff measure of this boundary:
The reduced boundary is rectifiable, meaning that, up to a negligible set, it can be covered by countably many suitably regular hypersurface pieces. These results place perimeter within geometric measure theory, whose modern development owes much to the work of Renato Caccioppoli and Ennio De Giorgi.
The coarea formula links an arbitrary scalar function to its level sets:
It states that total variation is the accumulated perimeter of all superlevel sets. For an image intensity function, the formula interprets variation as the aggregate length of intensity contours. It also implies that almost every superlevel set of a function has finite perimeter. For a jump from to a height across an interface of area , the same interface occurs for every threshold , producing variation .
Two analytic properties make this geometric framework useful in the calculus of variations. First, total variation is lower semicontinuous under convergence:
Second, on a bounded Lipschitz domain, a sequence bounded in the norm has a subsequence converging in . Together these properties support existence proofs by taking limits of minimizing sequences. They do not imply convergence of the variation values themselves. A stronger notion, called strict convergence in , requires both convergence and convergence of total variation. This distinction matters when approximating sharp interfaces by smooth transition layers or passing geometric quantities to limits.
Total variation distance between probability distributions
For probability measures and on the same measurable space, total variation distance is conventionally defined by
It lies between and , and it measures the largest possible disagreement about the probability of a single event. In terms of the variation measure of their signed difference,
The factor arises because has total mass zero: its positive and negative parts have equal mass. Some texts instead call the total variation distance, so formulas involving constants depend on the convention.
If and have densities and with respect to a common measure , then
For discrete distributions, the integral becomes a sum. The event attains the supremum, up to irrelevant choices on equality sets. In particular, for Bernoulli distributions with success probabilities and ,
The density formula is always available abstractly by choosing ; a Lebesgue probability density is not required.
An equivalent characterization uses bounded observables:
Thus total variation simultaneously controls every bounded measurable measurement. If takes values in , then
It does not similarly control arbitrary unbounded observables: a very small probability discrepancy placed at sufficiently large values can have a large effect on an expectation or variance.
Total variation convergence is stronger than weak convergence. For instance, converges weakly to , but its total variation distance from is for every . Likewise, an empirical distribution with finite support is at distance from any nonatomic distribution, regardless of sample size. Even uniform convergence of cumulative distribution functions need not imply total variation convergence. This strength reflects the fact that the supremum ranges over all measurable events, including sets that distinguish extremely fine differences of support.
Testing, coupling, and convergence of Markov chains
Total variation has an exact interpretation in statistical hypothesis testing. Suppose a single observation is drawn from or , with equal prior probabilities. A nonrandomized test chooses on an event and otherwise. Its average probability of error is
Optimizing over yields
Consequently, distance zero means that no test improves on a random guess, whereas distance one means that perfect discrimination is possible. Allowing randomized tests does not improve this optimum.
A second interpretation uses coupling. A coupling of and is a pair of random variables defined jointly with marginal laws and . Every coupling satisfies
because the indicators of an event can disagree only when the variables differ. On standard Borel spaces, a maximal coupling achieves equality:
The construction matches the common density with probability , then assigns the unmatched mass separately. This interpretation is especially useful when distributions can be generated by related random mechanisms.
For a Markov chain with transition kernel , applying the same transition cannot increase distance:
Indeed, for any event , the function takes values in , so the bounded-observable characterization applies. If is a stationary distribution, convergence to equilibrium is often quantified through . For finite irreducible aperiodic chains, this tends to zero. Coupling proofs construct two chains, one started at and one in equilibrium, and bound their disagreement by the probability that they have not yet met and remained together.
Total variation also connects to information theory through inequalities between divergences. Pinsker’s inequality, using natural logarithms, is
where is Kullback–Leibler divergence. Small relative entropy therefore implies small total variation. There is no unconditional reverse bound: relative entropy can be infinite even when total variation is small, for example when gives positive mass to a set to which assigns zero mass. Total variation is symmetric and always finite for probability distributions; relative entropy is asymmetric and measures a different aspect of discrepancy.
Regularization, imaging, and numerical optimization
Total variation became a central tool in image restoration through the 1992 model of Leonid Rudin, Stanley Osher, and Emad Fatemi. In a common normalization, their denoising problem is
where is the observed image. The first term penalizes disagreement with the data, while the second performs regularization by discouraging unnecessary spatial change. On suitable bounded domains, lower semicontinuity and compactness give existence, while strict convexity of the quadratic fidelity term gives uniqueness up to almost-everywhere equality.
The edge-preserving mechanism differs from that of quadratic gradient penalties. Suppose a transition of height is spread over a layer of width . Per unit interface area, its total variation is approximately
independent of the layer width. By contrast,
diverges as the transition becomes sharp. Total variation can therefore retain discontinuities at finite cost. It does not preserve every feature without bias: small structures may disappear, contrast may decrease, and smooth ramps can become piecewise constant, an artifact known as staircasing.
For a discrete image , two common penalties are
and
where are chosen finite differences. The first is separable in the coordinate differences and has a pronounced directional preference. The second groups horizontal and vertical components by their Euclidean norm, although a finite grid still introduces discretization effects. Boundary rules, grid spacing, and quadrature weights are part of the mathematical model rather than incidental implementation details.
The resulting problems are convex but nonsmooth, so ordinary differentiation at zero gradients is unavailable. Their dual formulation follows from
For a discrete gradient operator , the quadratic denoising model becomes
Primal–dual methods alternate an update of with an update of , followed by projection onto Euclidean balls. Other approaches use operator splitting, augmented Lagrangians, or smoothed penalties such as . The last choice changes the original nonsmooth objective and introduces an approximation parameter.
In one dimension, the discrete analogue
is total variation denoising, closely related to the fused lasso. It promotes sparsity of successive differences rather than sparsity of the fitted values themselves. This makes it useful for estimating piecewise constant signals and locating changes in time series. On a weighted graph, the corresponding penalty is , extending the same principle to data without a regular spatial grid.
Conservation laws and variation-diminishing evolution
Total variation plays a distinct role in the analysis of conservation laws. A scalar conservation equation in one space dimension has the form
Even smooth initial data can develop discontinuities because different values of propagate at different characteristic speeds. For the inviscid Burgers equation, , the characteristic speed is ; faster portions of a profile can catch slower portions and form shocks. Classical derivatives then cease to suffice, and solutions must be interpreted in a weak sense, supplemented by an entropy condition that selects physically admissible shocks.
For scalar entropy solutions on the whole line, suitable integrability and finite-variation assumptions yield
The principle is connected to contraction and translation invariance. Applying contraction to a solution and a spatial translate controls
by the corresponding initial difference. Dividing by and passing to the small-translation limit gives the variation estimate. This control prevents uncontrolled growth of spatial oscillations and provides compactness for approximation sequences. Analogous statements for systems of conservation laws require substantially more structure and cannot be inferred directly from the scalar theory.
Numerical finite-difference schemes often seek a related property called total variation diminishing, or TVD:
Under an appropriate relation between time step and mesh size, many monotone first-order schemes satisfy such an estimate. Higher-order methods use nonlinear limiters to reduce oscillations near shocks while retaining greater accuracy in smooth regions. The TVD requirement addresses a specific failure of unrestricted high-order reconstructions: the creation of spurious overshoots and undershoots around discontinuities. It does not by itself establish consistency, select an entropy solution, or guarantee high-order accuracy everywhere.
Total variation also generates its own smoothing evolution. Formally, the gradient flow of is
The expression is undefined at zero gradients, so rigorous formulations use the subdifferential of the convex total variation functional rather than treating the equation as an ordinary smooth differential operator. This contrasts with the heat equation, the gradient flow of a quadratic gradient energy. Total variation flow can form flat regions and evolve sharp interfaces. Under the coarea interpretation, its behavior is tied to the geometry of level sets, bringing together the analytic, geometric, and computational meanings of accumulated variation.