# Matched filter
A **matched filter** is the linear filter that maximizes the output signal-to-noise ratio when a signal of known shape, buried in additive noise, must be detected or timed. Its impulse response is the known signal reversed in time, and conjugated if the signal is complex-valued, so that filtering the received data through it is equivalent to correlating the data against a template of exactly the signal being sought.[^north1943] The related microsim on this page slides a copy of one signal past another, buries a chosen delay and a chosen amount of noise in the second copy, and lets the reader watch a correlation curve peak at the true delay even when the two signals no longer look alike to the eye.
The same operation appears, described in different vocabulary, wherever a system must decide whether a known pattern is present in a noisy record: as pulse compression in [[Radar|radar]] and [[Sonar|sonar]], as the optimal receive filter for a known pulse shape in digital communications, and as the correlator that recovered the chirp of a merging pair of black holes from detector noise in the first direct observation of a gravitational wave. Matched filtering is closely related to, and grew up alongside, [[Autocorrelation|autocorrelation]] and [[Convolution|convolution]], the two operations its own definition combines.
## Derivation
Posed as an optimization problem, the matched filter is the answer to a single question: among all linear filters, which one maximizes the output [[Signal-to-noise_ratio|signal-to-noise ratio]], the ratio of the peak signal it outputs to the noise power riding along with it, at one chosen instant, given a known signal buried in additive noise of known statistics.
### Derivation via matrix algebra
Represent the known signal as a vector s and the noise as a random vector with covariance matrix Rn; a linear filter with as many taps as the signal has samples, the structure of a [[Finite_impulse_response|finite impulse response]] filter, is then a weight vector w, whose output at the instant that matters is wᵀs for the signal alone and wᵀRnw for the noise power. The Cauchy–Schwarz inequality bounds the squared output SNR, (wᵀs)² / (wᵀRnw), by sᵀRn⁻¹s, with equality exactly when w is proportional to Rn⁻¹s. That proportionality is the matched filter: for white noise, where Rn is a multiple of the identity matrix, it reduces to w proportional to s itself, filtering with a plain copy of the signal.
### Derivation via Lagrangian
The same result follows from calculus instead of an inequality: maximize wᵀs subject to the constraint that the noise power wᵀRnw be held at some fixed value, and introduce a Lagrange multiplier λ for the constraint. Setting the gradient of wᵀs − λ(wᵀRnw − constant) to zero gives s = 2λ·Rn·w, or w proportional to Rn⁻¹s, the identical weight vector the inequality approach gives, reached by finding a stationary point of a constrained optimization rather than by an algebraic bound.
## Interpretation as a least-squares estimator
The same weight vector that maximizes output SNR also arises from a different question: given observed data y = A·s + n for an unknown scalar amplitude A and known noise statistics, what is the best estimate of A.
### Derivation
Minimizing the noise-weighted squared error (y − A·s)ᵀRn⁻¹(y − A·s) over A gives the estimate  = (sᵀRn⁻¹y) / (sᵀRn⁻¹s), whose numerator is exactly a matched-filter output: the received data correlated against the noise-whitened signal template. For white noise this is the ordinary least-squares estimate  = (sᵀy)/(sᵀs), the projection of the data onto the direction the known signal occupies.
### Implications
A single filter therefore does three jobs under three different names: it maximizes detection SNR, it computes the maximum-likelihood estimate of a signal's amplitude under Gaussian noise, and it projects the observed data onto the signal's own direction in signal space, discarding everything orthogonal to it. None of the three interpretations is more fundamental than the others; they are the same linear operation described from [[Detection_theory|detection theory]], from [[Estimation_theory|estimation theory]], and from geometry, and the agreement is why a matched filter is optimal in more than one sense at once rather than only in the sense it was first derived for.
## Frequency-domain interpretation
Expressed in the frequency domain, the matched filter for a signal with spectrum S(f) in noise with [[Spectral_density|power spectral density]] N(f) has frequency response proportional to `conj(S(f))/N(f)`, the complex conjugate of the signal's own spectrum weighted inversely by how much noise power sits at each frequency: it favours frequencies where the signal is both strong and relatively free of noise, and suppresses frequencies dominated by noise even where the signal itself has some content there. For white noise, N(f) is constant and the weighting drops out, leaving the response proportional simply to the conjugate spectrum.
Because a filter's output is the inverse transform of the product of two spectra, the matched filter's output as a function of the time offset between signal and template is exactly the signal's cross-correlation, or [[Autocorrelation|autocorrelation]] when the template matches the received signal exactly, `rho(lag) = sum(x[n]*y[n+lag])`, swept over every lag.[^downey-acf] The related sketch on this page sweeps exactly this sum, sliding a noisy, delayed copy of a waveform past a clean reference and tracing the resulting correlation curve, whose peak locates the true delay far more precisely than the eye can align the two waveforms directly.
## Examples
### Radar and sonar
A radar or sonar matched filter is built from the outgoing pulse itself: the receiver correlates the returning echo against a stored copy of the transmitted waveform, concentrating the echo's energy into a sharp peak at the instant, and so the range, the echo actually arrived. Pulse compression, sending a long, coded or swept-frequency pulse and matched-filtering the return, gets the range resolution of a short pulse without the peak transmitter power a short pulse of the same energy would need, at the cost of the range–Doppler trade-off a single correlation peak cannot fully resolve, the subject of the [[Ambiguity_function|ambiguity function]]. A closely related use appears in satellite navigation, where a receiver despreads a signal by correlating it against a known spreading code, a matched filter for that code rather than for a radar pulse; the Global Positioning System's coarse-acquisition signal, spread across roughly a megahertz of bandwidth at 50 bits per second, yields a processing gain of about 43 decibels this way.[^ellingson-gps]
### Digital communications
A digital receiver correlates each received symbol interval against every candidate pulse shape it might contain, and the matched filter is the specific receive filter that minimizes the resulting bit-error rate for a given [[Signal-to-noise_ratio|signal energy to noise level]] ratio, which is why receiver design almost always pairs a known transmit pulse shape with its time-reversed match at the receiver rather than an arbitrary low-pass filter.
### Gravitational-wave astronomy
The first direct detection of a gravitational wave, from a pair of merging black holes observed on September 14, 2015, was pulled out of detector noise by correlating the recorded strain against a large bank of matched-filter templates computed from general relativity for black holes of many different masses and spins, the best-matching template identifying both the detection and the source's approximate properties at once.[^abbott2016]
### Seismology
Seismologists use the same correlation against a stored template to find small, repeating earthquakes and low-level tremor buried in continuous background noise, detecting events a fixed-threshold trigger would miss entirely because no single sample ever crosses the threshold on its own, only the correlated sum of many samples against a known waveform does.
### Biology
Sensory biologists have described some receptor systems in similar terms, as filters tuned to a biologically important signal rather than to sound or light in general: a moth's simple ear, for instance, responds most strongly at the frequencies an echolocating bat's calls occupy, filtering for the one signal that matters to the moth's survival far more than for the much wider range of sound the ear could physically transduce.
## Microsims
The related sketch on this page, *Similarity (signal processing)*, builds a second signal as a noisy, delayed copy of a first and scores their resemblance four ways at once: a sliding [[Autocorrelation|cross-correlation]], whose peak locates the delay directly; a correlation coefficient, normalized so it ignores any difference in overall level or offset; a cosine similarity, the angle between the two signals treated as vectors; and a mean-squared error, which measures difference rather than likeness and so is smallest, not largest, at the best alignment. A lag control slides a displayed alignment past the signal; a true-delay control buries an actual shift in the second copy before the sliding begins; and a noise control corrupts that copy with an adjustable amount of random noise. ILLUSTRATIVE: the correlation sum the sketch computes assumes signals of finite, equal length, and is not the noise-whitened, frequency-weighted matched filter of the derivation above, which reduces to the same plain correlation only in the special case of white noise.
*Try:* Raise the noise control well above the signal's own amplitude and watch the cross-correlation curve still peak at the true delay, buried under noise no sample-by-sample comparison could see through. Live sketch: https://editor.p5js.org/sciencenibber/full/rNUw1kXLL ; fork: https://editor.p5js.org/sciencenibber/sketches/rNUw1kXLL .
A three.js companion renders the correlation peak rising directly from noise, including chirp compression, the pulse-compression case radar and sonar depend on.
<!-- SIGSIM:BEGIN g35 — Signal Processing portal microsim (framework build, specs/sims/Matched_filter.json); do not hand-edit inside -->
**Microsim — three.js (Wikitube framework), pending deploy:** *Matched filter: the pulse that maximizes output SNR* will play here once `https://wikitube-3d-microsims.netlify.app/signal/Matched_filter.html` is live.
<!-- pending: <div class="wt-sim" data-src="https://wikitube-3d-microsims.netlify.app/signal/Matched_filter.html" data-title="Matched filter"></div> -->
*Built from `MICROSIM_GUIDE/specs/sims/Matched_filter.json`; part of the [[Signal_processing]] set ([[PORTAL_Signal_Processing]]).*
<!-- SIGSIM:END -->
## Wikipedia : Wikitube
**Strict pair:** [Wikipedia](https://en.wikipedia.org/wiki/Matched_filter) : [Wikitube](https://en.wikitube.io/wiki/Matched_filter)
Skeleton mirrored at revision 1351517179. Prose, emphasis and the microsims are Wikitube's own.
## See also
- [[Radar]]
- [[Sonar]]
- [[Detection_theory]]
- [[Ambiguity_function]]
- [[Autocorrelation]]
- [[Convolution]]
- [[Finite_impulse_response]]
- [[Wiener_filter]]
## Notes
The related sketch computes the plain correlation sum, the special case of a matched filter that holds only for white noise; the general, noise-whitened form in the derivation above and the sketch's own curve agree exactly in that case and diverge for coloured noise. Page numbers in the references below are PDF pages of the open editions cited.
## References
[^north1943]: D. O. North, "An Analysis of the Factors which Determine Signal/Noise Discrimination in Pulsed-Carrier Systems," RCA Laboratories, Princeton, NJ, Technical Report PTR-6C (June 1943); reprinted in *Proceedings of the IEEE*, vol. 51, no. 7 (July 1963), pp. 1016–1027. https://ieeexplore.ieee.org/document/1444313
[^abbott2016]: B. P. Abbott et al. (LIGO Scientific Collaboration and Virgo Collaboration), "Observation of Gravitational Waves from a Binary Black Hole Merger," *Physical Review Letters*, vol. 116, 061102 (February 2016). https://doi.org/10.1103/PhysRevLett.116.061102
[^downey-acf]: Allen Downey, *Think DSP: Digital Signal Processing in Python* (2012), pp. 63–64 (PDF pages). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/think-dsp-digital-signal-processing-in-python . CC BY-NC.
[^ellingson-gps]: Steven Ellingson, *Radio Systems Engineering*, Revised 1st ed. (2023), pp. 179–180 (PDF pages). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/radio-systems-engineering . CC BY-NC.
## Further reading
- Steven Ellingson. *Radio Systems Engineering*, Revised 1st ed. 2023. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/radio-systems-engineering
- Allen Downey. *Think DSP: Digital Signal Processing in Python*. 2012. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/think-dsp-digital-signal-processing-in-python
- Christian Tiberius; Max Mulder. *Engineering Signal Analysis: From Fourier to filtering: Theory*. 2026. Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/engineering-signal-analysis-from-fourier-to-filtering-theory
<!-- Hubs: Signal_processing. Portals: PORTAL_Signal_Processing. Signal Processing portal wave 1 · 2026-09-17 · drafted. -->