On the source–filter page we saw that speech is a train of glottal kicks, each ringing through the vocal tract. Ringing is predictable: once a bell has been struck, you know roughly what it will do next. This page turns that hunch into one of the most successful ideas in speech technology, linear prediction: guess each new sample of a signal as a weighted sum of the last few. We build it from scratch, starting with a game and a scatter plot, and end up with the method inside every mobile-phone call you've made.
Below are the last few samples of a signal. Click where you think the next sample will be (the dashed column). Then we reveal the true value, and also the guess of a simple formula that only looks at the previous 12 samples. Play a few rounds of each signal.
You will find the tone easy, the vowel fairly easy (it keeps going smoothly in the direction it was heading), and white noise impossible: the past tells you nothing about the next value, and the best you can do is guess zero. The formula behaves exactly the same way. The rest of this page is about why, and how that formula is built.
Here is a simple way to ask “does the past say anything about the future?”. Take every sample \(x[n]\) and pair it with the sample \(k\) steps later, \(x[n+k]\). Plot all the pairs as dots. If the dots form a tilted line, knowing one sample tells you a lot about the other. If they form a round blob, it tells you nothing. The tilt and tightness of the cloud are summarised by one number, the correlation:
Pick a signal and slide the lag \(k\):
![Scatter plots of x[n] against x[n+k] for white noise, a vowel and a fricative, at four lags](linear_prediction/fig/01_scatter_grid.png?v=3)

Go back to the lag-1 scatter of the vowel and tick show the best-fit line. That line is a predictor: read off \(x[n-1]\) on the horizontal axis and the line gives a guess for \(x[n]\). The simplest possible predictor uses one weight:
Which slope \(a\) is best? The one that makes the errors as small as possible overall, i.e. minimises the total squared error. Set its derivative to zero:
Now compare this with the definition \(r(k) = \sum_n x[n]\,x[n+k] \big/ \sum_n x[n]^2\), one piece at a time:
So the best slope is just the correlation at lag 1. And how much does it help? Let's work out how much error energy is left.
Step 1: expand the square. Multiply out the error energy term by term:
Step 2: name the three sums. Write \(R(0) = \sum_n x[n]^2\) for the signal's energy. As we just saw, \(\sum_n x[n-1]^2\) is the same energy \(R(0)\), and \(\sum_n x[n]\,x[n-1]\) is the lag-1 sum \(R(1) = r(1)\,R(0)\) (since \(r(1) = R(1)/R(0)\)). Substitute and take \(R(0)\) out as a common factor:
Step 3: put in the best slope, \(a = r(1)\).
A bonus from Step 2: completing the square,
This is a parabola in \(a\) whose lowest point is at \(a = r(1)\): any other slope adds the extra \((a - r(1))^2\), which confirms the calculus without derivatives. Since \(r(1)^2\) can never exceed 1, the error can never be negative, and it only reaches zero when \(|r(1)| = 1\), i.e. when the scatter is a perfect straight line.
Plugging in our three signals:
\(r(1) \approx 0 \Rightarrow a \approx 0\): the best guess is zero, and the error is as big as the signal. Gain 0 dB.
\(r(1) = -0.37\): guess the opposite sign, a lot smaller. Error energy \(1 - 0.13 = 87\%\). Gain \(\approx 0.6\) dB.
\(r(1) = 0.96\): “next \(\approx\) previous”. Error energy \(1 - 0.92 = 8\%\). Gain \(\approx 11\) dB from one weight.
The three cards above already used it. Prediction gain is the standard single number for how predictable a signal is. It compares the energy of the signal with the energy of what the predictor leaves behind:
Reading the decibels: the gain says what fraction of the signal's energy was not predictable. (New to decibels, or wondering why audio uses them everywhere? See the extra page Why does audio live in decibels?)
| prediction gain | error energy left | in words |
|---|---|---|
| 0 dB | 100 % | the past says nothing about the next sample |
| 3 dB | 50 % | half of it was predictable |
| 10 dB | 10 % | 90 % was predictable |
| 20 dB | 1 % | 99 % was predictable |
| 30 dB | 0.1 % | almost completely predictable |
The values met on this page and the next ones, side by side:
| signal | predictor | gain | why |
|---|---|---|---|
| white noise | any order | \(\approx 0\) dB | no correlation at any lag |
| fricative /s/ | 1 weight → 24 weights | 0.6 → \(\approx 8\) dB | turbulent noise; only its spectral shape is predictable |
| vowel /ɑ/ | 1 weight → 18 weights | 11 → \(\approx 24\) dB | two strong, low formants (\(F_1 \approx 660\), \(F_2 \approx 1200\) Hz): a smooth waveform |
| vowel /i/ | 1 weight → 18 weights | 17 → \(\approx 27\) dB | a very low \(F_1\) (\(\approx 290\) Hz) makes it even smoother; its high \(F_2/F_3\) need the extra weights |
| /ɑ/, pre-emphasised (section 07) | 14 weights | \(\approx 13\) dB | pre-emphasis removed the easy low-frequency part |
| speech at 8 kHz (codecs page) | 10 weights, refitted every 20 ms | \(\approx 13\) dB | averaged over a whole recording, vowels and consonants |
| pure tone | 2 weights | \(\infty\) (in theory) | a sinusoid is exactly predictable (section 04) |
A gain is only meaningful together with how it was measured. The same speech can give very different numbers depending on:
One weight can only express “the signal changes slowly”. A ringing resonance does more than that: it curves, overshoots and comes back. To follow a curve you need to know not just where the signal is but where it was heading, which takes two previous samples. In fact, two weights predict a pure sinusoid perfectly, thanks to this identity:
Start from the two angle-sum formulas, for any angles \(A\) and \(B\):
$$\sin(A+B) = \sin A\cos B + \cos A\sin B$$ $$\sin(A-B) = \sin A\cos B - \cos A\sin B$$Add them: the \(\cos A\sin B\) terms cancel.
$$\sin(A+B) + \sin(A-B) = 2\sin A\cos B$$Now choose \(A = \omega(n-1)\), the middle sample's angle, and \(B = \omega\), one step. Then \(A + B = \omega n\) and \(A - B = \omega(n-2)\):
$$\sin(\omega n) + \sin\bigl(\omega(n-2)\bigr) = 2\cos\omega\,\sin\bigl(\omega(n-1)\bigr)$$Move \(\sin(\omega(n-2))\) to the right-hand side and we have the identity. \(\blacksquare\)
Three things to take from it:
This rule of thumb for the predictor order looks arbitrary, but every part of it has a meaning. It is a budget: count the resonances the predictor has to capture, give each one two weights, and add a little extra for the overall slope of the spectrum.
We just proved that a sinusoid is predicted exactly by two weights. A formant is a sinusoid that dies away, the decaying ring of a resonance. That also costs exactly two weights. Multiply both sides of the identity by \(\rho^{\,n}\) (with \(0 < \rho < 1\) setting how fast the ring decays) and regroup the powers of \(\rho\):
Recall the tube from the source–filter page: a 17.5 cm vocal tract has resonances at 500, 1500, 2500, 3500 Hz, …. They are spaced about 1000 Hz apart, because the spacing is \(c/2L = 350/(2 \times 0.175) = 1000\) Hz. Real vowels push individual formants up and down, but the average density stays about one formant per kilohertz.
A signal sampled at \(f_s\) only contains frequencies up to \(f_s/2\) (the Nyquist frequency), so the predictor only has to deal with the formants below that:
Why the extra 2? Besides its peaks, a voiced spectrum has an overall downward slope (about −6 dB per octave), from the smooth glottal pulse and the radiation at the lips (section 05 of the source–filter page). A slope is not a resonance, but the predictor still has to model it, and a couple of extra weights take care of it. (Pre-emphasis, which flattens that slope, is partly a way of saving those weights for the formants.)
\(8 \text{ formants} \times 2 \text{ weights} + 2 \text{ for tilt} = \mathbf{18}\). At 8 kHz sampling only \(F_1\)–\(F_4\) lie below the 4 kHz Nyquist limit, giving \(4 \times 2 + 2 = \mathbf{10}\).
| Sampling rate \(f_s\) | Nyquist \(f_s/2\) | Formants below it | Order \(p\) | Typical use |
|---|---|---|---|---|
| 8 kHz | 4 kHz | \(\approx 4\) | 10 | telephone speech, LPC-10, most phone codecs |
| 10 kHz | 5 kHz | \(\approx 5\) | 12 | classic speech-analysis setups |
| 16 kHz | 8 kHz | \(\approx 8\) | 18 | wideband speech, most speech corpora (e.g. CMU ARCTIC), ASR |
It's a guideline, not a law. The 1000 in the formula is really the formant spacing \(c/2L\), so it depends on the speaker. A shorter (female or child) tract has formants about 1200–1500 Hz apart, so slightly fewer of them fit below Nyquist and a slightly lower order suffices. The high formants are also weak, so in the demo below the gain for /ɑ/ is already within about 2 dB of its maximum by \(p \approx 12\). Too low an order merges or misses formants. Too high an order starts fitting individual harmonics and noise, giving spurious peaks. The rule puts you safely in between.
Putting it together, the general predictor is a weighted vote of the last \(p\) samples:
It is called linear prediction because the guess is a weighted sum: no squares, no thresholds, nothing fancy. Try different orders:
What to notice:
Because there is no longer one best answer: there are infinitely many, all perfect. For a sinusoid, any three consecutive samples are tied together by the identity itself (written one step earlier):
$$x[n-1] - 2\cos\omega\,x[n-2] + x[n-3] = 0 \quad\text{for every } n$$So we can add any multiple \(\lambda\) of that zero to the two-weight predictor without changing a single prediction. With \(c = \cos\omega\), every member of this family is exact:
$$\bigl(a_1, a_2, a_3\bigr) = \bigl(2c,\; -1,\; 0\bigr) + \lambda\,\bigl(1,\; -2c,\; 1\bigr)$$For our 200 Hz tone: \(\lambda = 0\) gives \((1.994, -1, 0)\); \(\lambda = -2c\) gives \((0,\, 2.975,\, -1.994)\), a predictor that ignores the most recent sample entirely; and the demo shows \((1.552,\, -0.120,\, -0.441)\), which is \(\lambda \approx -0.44\). All three have zero error.
In matrix terms, the normal-equation matrix for a pure tone has rank 2. For \(p = 3\) it is singular (one eigenvalue is exactly zero), so the equations don't pin down a unique solution. The solver needs a tie-breaker. A tiny amount of “prefer small weights” (regularisation) would select the family member with the smallest total \(\sum_k a_k^2\), which is \(\lambda = -2c/(1 + 2c^2) \approx -0.667\), i.e. \((1.327,\, 0.330,\, -0.667)\). That spreads the weight over all the lags rather than zeroing the extra ones. The demo lands on a different member for a mundane reason: its samples are stored rounded to 4 decimals, and that rounding acts like a tiny, periodic “noise” that makes the matrix very slightly non-singular, so the rounding, not the regulariser, breaks the tie. Either way, the extra weights are not zero.
Real signals don't have this problem. Speech, noise, even a tone with a little added noise, carry information in more than two dimensions, so the matrix is invertible and the weights are unique. The pure tone is the special case that shows exactly how much structure a signal has: two numbers' worth, so a third weight is redundant.
With one weight we set a derivative to zero and got \(a = r(1)\). With \(p\) weights we do exactly the same thing, once for each weight: minimise the total squared error
Each condition says “the error must be uncorrelated with \(x[n-i]\)”: whatever is left over shouldn't still be predictable from the past. Written out, they are \(p\) linear equations that only involve the correlations \(r(k)\) we already know how to compute:
The absolute value in \(r(|i-k|)\) is the symmetry from section 03 again: \(r(-k) = r(k)\), so only the distance between the two samples counts. The matrix therefore has the same value along every diagonal (a Toeplitz matrix), and it is also symmetric. That structure lets the Levinson–Durbin recursion solve the system in about \(p^2\) operations instead of \(p^3\): fast enough for 1970s chips to do it 50 times a second. (The demos on this page solve the same least-squares problem directly, in your browser, each time you move a slider.)
Did prediction start in astronomy? Mostly yes. The fitting machinery (least squares, which is exactly how we found the weights) was born predicting the motion of a celestial body. The specific idea of predicting a signal from its own past came in the 1920s, again from a sky-watching problem (sunspots), and reached speech in the 1960s.
Gauss and the lost planet Ceres. Ceres was spotted in January 1801, then lost in the Sun's glare after only 41 days of observations. The 24-year-old Carl Friedrich Gauss fitted an orbit to those few noisy positions by least squares and predicted where it would reappear; it was found there on 31 December 1801. Legendre published least squares first (1805); Gauss published his method in 1809.
Yule and the sunspots. Udny Yule modelled the yearly sunspot numbers as each value predicted from the previous two plus a random disturbance. This was the first autoregressive (AR) model, and the same structure as our predictor.
Walker generalised it to more past values while studying atmospheric pressure at Darwin, giving the Yule–Walker equations, the very equations of section 05.
Kolmogorov and Wiener founded the theory of optimal prediction of random signals. Wiener's version came from a wartime problem: predicting where an aircraft would be by the time an anti-aircraft shell arrived.
Levinson found the fast recursion for the Toeplitz equations (refined by Durbin in 1960).
Speech arrives. Fumitada Itakura and Shuzo Saito at NTT in Japan, and Bishnu Atal and Manfred Schroeder at Bell Labs, independently realised that the vocal tract makes speech highly predictable, so a predictor's weights are a compact description of the filter. Atal & Hanauer's 1971 paper “Speech analysis and synthesis by linear prediction of the speech wave” became the field's foundation.
John Makhoul's tutorial “Linear prediction: a tutorial review” makes LPC the standard tool of speech processing.
Texas Instruments' Speak & Spell toy talks using a single LPC synthesis chip: the source–filter model, in a children's toy.
LPC-10 (US standard FS-1015) sends intelligible speech at 2.4 kbit/s: per frame just ~10 predictor weights, a pitch, a voicing flag and a gain.
CELP (Schroeder & Atal) adds a smarter way to code the prediction error. Its descendants (GSM's enhanced full-rate codec, AMR, EVS, …) and close linear-predictive relatives such as the speech mode of Opus run in essentially every mobile phone today.
Sunspots are dark patches on the Sun's visible surface (the photosphere). They are dark only by comparison: at roughly 3,500–4,500 K they are cooler than the surrounding surface at about 5,800 K, and on their own they would glow bright orange. They form where bundles of intense magnetic field push up through the surface and choke the churning convection that normally carries heat up from below. Big ones are several times wider than the Earth. They last from days to weeks, appear in groups, usually in two bands either side of the solar equator, and are carried across the disk by the Sun's rotation (about 27 days as seen from Earth).
It is not a count of how many different spots appeared during the year. It is the average of the daily numbers:
$$R_{\text{day}} = k\,(10\,g + s) \quad\text{(from the visible half of the Sun on that day)}, \qquad R_{\text{year}} = \frac{1}{\text{days}}\sum_{\text{days in the year}} R_{\text{day}}$$Nobody tracks individual spots from day to day. A long-lived group is simply counted again on every day it is visible: about two weeks as the Sun's rotation carries it across the disk, and again if it survives to come back round about 27 days later. So the yearly number measures how spotted the Sun looks on a typical day of that year, a level of activity. For example, 1957's record yearly value of about 190 corresponds to an average day showing something like 12 groups and 70 spots (\(10 \times 12 + 70 = 190\)). The factor \(k\) puts different observers and telescopes on a common scale. Today a worldwide network of stations contributes, which also covers days when one site is clouded out.
Sunspots were noted with the naked eye in Chinese chronicles over two thousand years ago, and drawn through the first telescopes by Harriot, Galileo, Scheiner and Fabricius in 1610–1611. The cycle was discovered almost by accident: Heinrich Schwabe, an apothecary and amateur astronomer, counted spots on every clear day from 1826, hoping to catch an unknown planet crossing the Sun. He found no planet, but in 1843 he announced that the number of spots rises and falls over about ten years. In 1848 Rudolf Wolf in Bern (later Zürich) defined the sunspot number above, began a systematic daily record, and painstakingly reconstructed earlier years from old observations: monthly back to 1749, yearly back to 1700. His successor Alfred Wolfer continued it, which is why Yule speaks of “Wolfer's sunspot numbers”. The series is still maintained today (by the Royal Observatory of Belgium) and is one of the longest scientific records that exists.

In 1852 Edward Sabine (and independently Wolf and Gautier) showed that disturbances of the Earth's magnetic field, the restless twitching of compass needles, rise and fall in step with the sunspot cycle. Then in September 1859 Richard Carrington saw a brilliant flare on the Sun, and within a day the largest magnetic storm on record struck. Aurorae were seen near the tropics, and telegraph systems across Europe and America failed, threw sparks, or kept working on currents induced by the storm alone. The Sun clearly mattered for the new electrical technologies.
If the Sun's output varied with the cycle, perhaps the weather did too. William Herschel suggested in 1801 that English wheat prices were higher in years with few sunspots. In the 1870s the economist W. S. Jevons argued that trade crises recurred with the sunspot cycle (the “sunspot theory” of business cycles). Most such links did not survive careful testing, but for decades the sunspot cycle was a prime suspect for anything that seemed to repeat.
When the monsoon failed, millions died: in the famines of 1876–78 and 1899–1900. Forecasting the monsoon became a priority of the India Meteorological Department (H. F. Blanford issued long-range forecasts from 1886), and sunspots were among the predictors examined. In 1904 Gilbert Walker, a Cambridge mathematician, became Director-General of Observatories in India with exactly this task. Searching worldwide weather records for anything that foretold the monsoon, he discovered the Southern Oscillation, a see-saw of air pressure across the Pacific (Darwin vs. Tahiti), today known as part of ENSO (El Niño) and still a key monsoon predictor. His 1931 paper was built to analyse exactly such series.
With over two centuries of numbers and an obvious but irregular rhythm, the sunspot series became the standard test case for methods of finding cycles in data. Yule was worried about how easily one finds spurious patterns in time series (his 1926 paper asked “Why do we sometimes get nonsense-correlations between time-series?”). The sunspots were the natural place to show that a better model was needed.
The question has never gone away. Solar storms now threaten satellites, GPS, radio links and power grids: the March 1989 storm blacked out the Québec grid for nine hours. Space-weather centres forecast the sunspot cycle (cycle 25 reached its maximum around 2024–25), and autoregressive models in Yule's spirit are still among the tools used.
The equations in sections 03–05 were not invented for speech. They were worked out by two statisticians trying to understand sunspots, and seeing how they did it makes the method feel much less arbitrary. We can redo their analysis on the same data (the yearly sunspot numbers of 1749–1924 that Yule used).
Astronomers had long known that sunspots come and go in a cycle of roughly 11 years. Around 1900 the standard tool for finding such cycles was Arthur Schuster's periodogram (essentially a Fourier transform). It assumed the data were one or more perfect sine waves plus independent measurement errors. But the sunspot cycle doesn't behave like that. Its length wanders between about 9 and 14 years and its peaks vary wildly in height. A perfect sine wave can't drift like that: the “errors” in one year have no effect on the next.
George Udny Yule proposed a different picture, in a famous image. Imagine a pendulum swinging in a room, and some boys who keep pelting it with peas. Each pea doesn't add an error on top of the swing. It knocks the pendulum, and the pendulum carries that knock forward into all its future swinging. The motion still looks roughly periodic (a pendulum has a natural period), but its timing and size wander irregularly, just like sunspots.

Try it yourself: throw some peas.
Set the peas to zero and the pendulum just swings down to rest: without disturbances the cycle dies away. The random knocks are what keep it going and what make it irregular.
A damped pendulum, written one time step at a time, says that this year's value is a fixed mix of the last two years' values. So Yule wrote, with \(x_t\) the sunspot number in year \(t\) (measured from its average) and \(\varepsilon_t\) the year's random “pea”:
To find \(a_1\) and \(a_2\) he did what we did. First he checked that neighbouring years are correlated, with the same kind of lagged scatter plot as in section 02:

Then he chose the weights that minimise the squared prediction error (least squares, Gauss's tool from the Ceres story), exactly as in section 05. On his data this gives:

And the two numbers have a physical meaning, the same one they have for speech. Using section 04's result for a decaying ring, \(a_1 = 2\rho\cos\omega\) and \(a_2 = -\rho^2\):
In speech terms, Yule found the sunspot record's single formant: its resonant frequency and its damping, read directly off two prediction weights. This is the same calculation that gives \(F_1\) from a vowel, some 40 years before anyone did it for speech.
Sir Gilbert Walker, studying the Southern Oscillation (the see-saw of air pressure across the Pacific, measured at Darwin), extended Yule's model to any number of past values and noticed something elegant. Take the model, multiply both sides by an earlier value \(x_{t-j}\), and average over all \(t\):
Two consequences:

| Yule & Walker (sunspots, 1927–31) | Speech (LPC, 1966–) | |
|---|---|---|
| time step | one year | one sample (\(1/16000\) s) |
| the thing that rings | a damped “pendulum” (the solar cycle) | the vocal tract |
| the random knocks | peas \(\varepsilon_t\) | glottal pulses and turbulence \(e[n]\) |
| the model | \(x_t = \sum_k a_k x_{t-k} + \varepsilon_t\): identical | |
| how the weights are found | correlations → Yule–Walker (normal) equations → least squares: identical | |
| what the weights reveal | one resonance: period 10.6 years | several resonances: the formants |
| typical order | 2 (Yule), more (Walker) | 10–18 |
When Itakura, Saito and Atal applied this to speech in the late 1960s, the pendulum had become a vocal tract and the peas had become glottal pulses, but the mathematics was Yule's and Walker's, unchanged.
Here is linear prediction run on real speech. Look at what is left after the predictor has done its best:

Remember the source–filter picture: each period, a glottal kick starts a ringing. The ringing follows smoothly from what came before, so the predictor learns it and removes it. The kick arrives out of nowhere, so it can't be predicted, and it stays in the error. Prediction splits speech back into its two parts:
The weights \(a_1,\dots,a_p\) describe the vocal tract's ringing: its resonances, its formants.
The error \(e[n]\) is close to the impulse train of glottal kicks (or the noise, for /s/).
Rearranging the definition of the error gives the model that ties it all together:
Read that equation as a filter driven by \(e[n]\) and it is the source–filter model: an autoregressive (all-pole) filter. Next we'll see how its weights become poles, each pair of poles one formant; how its frequency response draws the smooth envelope over a real spectrum; and how to pick the order. Then we close the loop with the tubes: the same weights can be turned into the reflection coefficients of a concatenated-tube vocal tract.
Between two samples only \(1/16000\) s passes, while the dominant ringing (\(F_1 \approx 700\) Hz) takes over 1 ms per cycle, so consecutive samples barely change. At 48 kHz they would be even closer, so \(r(1)\) even nearer 1. High sampling rates make speech more predictable sample-to-sample.
Its energy is concentrated at high frequencies, around a quarter of the sampling rate or more, so the waveform tends to flip sign from one sample to the next. “Guess the opposite of the last sample” is the best one-step strategy.
The predictable part (the ringing of a few resonances) is already captured. What remains is mostly the glottal kicks, which are new information each period. A predictor reaching back over a whole pitch period (~100–150 samples for a male voice at 16 kHz; 116 for our /ɑ/) could exploit that too: this is the long-term (pitch) predictor used in CELP codecs.
Music: yes, tonal music is highly predictable (lossless codecs such as FLAC use linear prediction). Rain: hardly. It is noise-like, so like white noise or /s/ the gain would be small; only its spectral shape could be captured.