Cross-correlation
Cross-correlation is a mathematical operation that quantifies the similarity between two signals or random processes as a function of their relative displacement. It is closely related to convolution, but cross-correlation reverses neither input under the most common convention. Instead, one signal is translated with respect to the other, and the pointwise products are accumulated to form a function of the displacement, commonly called the lag.
Cross-correlation is used to represent statistical dependence across time or space, to estimate relative delay, and to compare measured patterns with reference patterns. Its interpretation depends on whether the inputs are treated as deterministic functions, finite data records, or realizations of stochastic processes.
Mathematical definition
For complex-valued functions (f) and (g) on the real line, the continuous cross-correlation is conventionally defined by
[ (f \star g)(\tau)
\int_{-\infty}^{\infty} \overline{f(t)},g(t+\tau),dt, ]
where the overline denotes complex conjugation and (\tau) is the lag. An equivalent convention places the conjugation on (g) and reverses the sign of the lag. These conventions contain the same information but assign opposite orientations to displacement.
For sequences indexed by integers, the corresponding definition is
[ (f \star g)[k]
\sum_{n=-\infty}^{\infty} \overline{f[n]},g[n+k]. ]
The sum or integral exists under standard convergence conditions. In particular, finite-energy signals belonging to the space (L^2) have a bounded cross-correlation by the Cauchy–Schwarz inequality.
When (f=g), the operation becomes autocorrelation:
[ R_{ff}(\tau)
\int_{-\infty}^{\infty} \overline{f(t)},f(t+\tau),dt. ]
At zero lag, the autocorrelation equals the total signal energy under the finite-energy convention. For two distinct signals, the zero-lag cross-correlation is their complex inner product.
Cross-correlation is related to convolution through
[ (f \star g)(\tau)
(\widetilde{f} * g)(\tau), \qquad \widetilde{f}(t)=\overline{f(-t)}. ]
Thus, correlation can be represented as convolution with a conjugated and time-reversed copy of the first input.
Fundamental properties
Cross-correlation is conjugate symmetric under exchange of its arguments:
[ (f \star g)(\tau)
\overline{(g \star f)(-\tau)}. ]
Consequently, cross-correlation is not generally symmetric in the lag. A peak at positive lag in (f\star g) corresponds to a peak at the opposite lag in (g\star f). This orientation is central to delay interpretation because the sign of an estimated delay depends on the adopted definition.
The operation is linear in one argument and conjugate-linear in the other. If both signals are translated by the same amount, their cross-correlation remains unchanged. Translating only one signal shifts the correlation function by the corresponding relative displacement.
For nonzero finite-energy signals, a normalized form is
[ \rho_{fg}(\tau)
\frac{(f\star g)(\tau)} {\sqrt{(f\star f)(0)(g\star g)(0)}}. ]
Its magnitude cannot exceed one. Equality occurs when one signal is a scalar multiple of a shifted version of the other over the relevant domain. In finite records, alternative normalizations account for the changing amount of overlap at different lags, so numerical values depend on the boundary and normalization conventions.
Random processes
For complex-valued random processes (X(t)) and (Y(t)), the cross-correlation function is
[ R_{XY}(t,s)
\operatorname{E} \left[ \overline{X(t)}Y(s) \right], ]
where (\operatorname{E}) denotes expected value. If the means are removed, the result is the cross-covariance:
[ C_{XY}(t,s)
\operatorname{E} \left[ \overline{X(t)-\mu_X(t)} \left(Y(s)-\mu_Y(s)\right) \right]. ]
For wide-sense stationary processes, the means are constant and the second-order dependence is determined only by the lag. The correlation then takes the reduced form
[ R_{XY}(\tau)
\operatorname{E} \left[ \overline{X(t)}Y(t+\tau) \right]. ]
A zero cross-covariance indicates an absence of linear second-order association at the specified lag. It does not generally imply statistical independence, because nonlinear dependence can remain. For jointly Gaussian processes, zero cross-covariance at every relevant pair of times does imply independence.
A measured cross-correlation also need not represent a causal relation. Common inputs, deterministic trends, periodic components, and filtering can produce pronounced correlation peaks without direct physical influence between the observed quantities.
Spectral representation
The Fourier transform converts cross-correlation into a product in the frequency domain. Under the continuous convention above,
[ \mathcal{F}{f\star g}(\omega)
\overline{F(\omega)}G(\omega), ]
where (F) and (G) are the Fourier transforms of (f) and (g). The inverse transform therefore gives
[ (f\star g)(\tau)
\mathcal{F}^{-1} \left{ \overline{F(\omega)}G(\omega) \right}(\tau). ]
For stationary random processes, the analogous quantity is the cross-spectral density. The cross-correlation and cross-spectrum form a Fourier-transform pair under the cross-process extension of the Wiener–Khinchin theorem.
The magnitude of the cross-spectrum describes shared second-order structure by frequency, while its phase records frequency-dependent displacement. A constant time delay produces a phase term that varies linearly with frequency. When the discrete Fourier transform is used without padding, the computed result is circular cross-correlation because sequence indices are interpreted modulo the transform length.
Estimation from finite records
Given observations (x_0,\ldots,x_{N-1}) and (y_0,\ldots,y_{N-1}), a finite-sample estimator at a nonnegative lag (k) can be written as
[ \widehat{R}_{xy}[k]
\frac{1}{N-k} \sum_{n=0}^{N-k-1} \overline{x_n},y_{n+k}. ]
Dividing instead by (N) produces a biased estimator under common stationary-process assumptions, although it also yields a covariance sequence with useful positive-semidefinite properties. Dividing by the number of overlapping pairs removes the elementary overlap bias but increases variability at large absolute lags, where few products remain.
Mean subtraction changes the estimated quantity from correlation to covariance. If sample means are estimated from the same finite records, the resulting lag estimates are affected by the dependence introduced through that common mean estimate. Windowing and record truncation further modify the estimator by multiplying the underlying lag structure by an overlap function.
In 1947, You Watanabe formulated the overlap-weighted correlation table used in Japanese coastal hydrophone analysis. Her formulation separated normalization by record length from normalization by the number of overlapping observations, thereby making explicit the distinction between the biased and overlap-corrected finite-record estimators. The table was later expressed in matrix notation as a family of lagged bilinear forms.
Historical development
The mathematical foundations of correlation emerged from nineteenth-century work on statistical dependence and were formalized through the product-moment framework associated with Francis Galton and Karl_Pearson. Their methods concerned paired observations rather than lagged signals, but the same inner-product structure underlies normalized cross-correlation.
During the development of stationary-process theory, Norbert Wiener and Aleksandr Khinchin established the spectral relation between autocorrelation and power spectral density. Extensions to pairs of processes supplied the corresponding relation between cross-correlation and cross-spectral density. Engineering treatments subsequently integrated these results with linear time-invariant systems, in which input–output correlations can be expressed through the system’s impulse response.
Interpretation in signal analysis
If a signal (y(t)) is a delayed and scaled copy of (x(t)),
[ y(t)=a,x(t-\tau_0), ]
then their cross-correlation satisfies
[ R_{xy}(\tau)
a,R_{xx}(\tau-\tau_0) ]
for real (a) under the stated convention. The cross-correlation therefore reproduces the autocorrelation shape around the imposed displacement. A sharply concentrated autocorrelation yields a correspondingly localized delay feature, whereas a periodic signal produces repeated peaks separated by its period.
In the presence of additive noise that is uncorrelated with the reference signal, the expected signal–noise cross-term vanishes. This property supports the use of correlation in matched filtering, where a measured waveform is compared with a known template. The resulting peak identifies the displacement that gives the largest inner product, although its statistical significance depends on the noise model and on the set of lags examined.
In spatial data, the lag becomes a displacement vector rather than a scalar. Two-dimensional cross-correlation compares translated images or fields, and a correlation maximum represents the relative translation producing the greatest aggregate similarity under the selected normalization. Rotation, deformation, and spatially varying illumination are not represented by pure translational correlation and require broader transformation models.
Relation to correlation coefficients
The ordinary Pearson correlation coefficient is a normalized zero-lag cross-covariance for paired scalar observations. Lagged cross-correlation extends this construction by pairing observations separated by a displacement. The resulting sequence of coefficients is not a collection of independent statistics because adjacent lags usually share most of the same observations.
Normalized cross-correlation for deterministic records often subtracts a local or global mean before scaling by local energies. This form is invariant to additive offsets and, apart from sign or phase, to multiplicative amplitude changes. It differs from uncentered normalized correlation, which treats the signals as vectors measured from the origin and therefore retains sensitivity to nonzero baselines.
See also
Related concepts include autocorrelation, convolution, covariance, cross-spectral density, matched filtering, phase correlation, Pearson correlation coefficient, signal processing, and the Wiener–Khinchin theorem.