Two input spikes each launch a copy of . Step Which copy through Copy 0, Copy 1 and Sum, and watch how the sum is built.
Overlaying every copy at once
Every input sample launches its own copy of h. Convolution is that construction, given one name and one picture.
Fixed h[n] = 1.00, 0.50, 0.25. Input: x[0] = 2, x[1] = 1.
Describe this picture
One plot of samples with two launched copies of , “copy 0 (from x[0])” and “copy 1 (from x[1])”, and their sum, “sum, y[n]”. Three “Which copy” buttons, “Copy 0”, “Copy 1” and “Sum”, highlight one of them.
Naming what you already built
Last page, I fed a system a short input, one number-worth of “spike” at a time, and watched each spike launch its own scaled, shifted copy of the impulse response . The output was just those copies, added up. I used and an input , , and got by stacking two launched copies.
That construction is common enough to earn its own name and its own symbol. It’s called convolution, and I write it . Nothing new is happening here: the picture at the top of the page just draws both launched copies and their sum at once, instead of placing them one spike at a time.
Notice its Sum is exactly the same output trace I built by hand last page, : convolution is that construction, now with a name.
Flip and slide: a mechanical way to compute it
Overlaying every copy at once works, but it means drawing a separate copy for every input sample. There’s a faster, purely mechanical way to get the same numbers, one output value at a time, and it’s the picture worth having in your head whenever you see convolution.
Here’s the recipe in words. To find the output at one instant, flip left-to-right, slide it so it sits at that instant, multiply every pair of numbers that now overlap, and add up the products. That total is at that instant. Slide to the next instant and do it again.
Written down, that recipe is
Read it the same way you just did it by hand. is the instant you’re asking about. runs over every index where or has a value. is , flipped and slid to instant : plugging in gives , sitting right under , and every other lands on some other flipped, shifted sample of . Multiplying by and summing over every is exactly “multiply the overlaps and add them up.” The symbol is shorthand for this whole sum: means “compute this way for every .”
Drag Position n from 0 to 3, one step at a time, and read Total at this position.
Flip and slide
Flip h left-to-right, slide it under x, and multiply every overlapping pair. Their total is y[n] at that position.
Describe this picture
Two plots against the index . The upper one shows , fixed, with flipped and slid underneath it and the products of the overlapping pairs. The lower one shows so far, with this position marked. The “Position n” slider runs from 0 to 3, and the readout “Total at this position” gives the sum of the products.
Notice it retraces the same four numbers, , one at a time instead of all at once, exactly matching the sum trace from the last instrument.
It does not matter which one you flip
The recipe said “flip .” Nothing in the arithmetic actually needs it to be that gets flipped rather than : flipping and sliding under a fixed multiplies and adds up the exact same pairs, just written down the other way around, .
Slide Position n, then switch Flip between Flip h and Flip x at the same position.
It does not matter which one you flip
Flip h and slide it past x, or flip x and slide it past h: either way the plotted y[n] is pixel for pixel identical.
Describe this picture
The same two plots as before: one sequence fixed, the other flipped and slid underneath it with the products of the overlapping pairs, and the output trace below. The “Position n” slider moves the slide, the “Flip” buttons choose “Flip h” or “Flip x”, and the readout “Total at this position” gives the sum of the products.
Notice the picture underneath looks completely different, but the plotted output trace never moves: and give the identical numbers. Convolution is commutative, so it never matters which sequence you call “the input” and which you call “the impulse response.”
How long is the output
Flip-and-slide only has something to multiply while the flipped, sliding sequence still overlaps the fixed one at all. Slide it in from far enough away and there’s no overlap yet, so ; slide it out far enough past the other side and there’s no overlap left, so again. In between, for two finite sequences of length and , there are exactly sliding positions with any overlap at all, so that’s how many samples of can be nonzero.
But if never quite settles to zero (an infinite impulse response, previewed here and covered properly later), there’s no “far enough past the other side”: the output can keep going forever too, even while it keeps shrinking.
Switch h type between Finite pulse and Decaying, and read the verdict readout.
How long is the output
Two finite sequences give a finite output with a hard edge. A never-quite-zero h keeps the output going too.
Describe this picture
One plot of the output of a 3-sample pulse convolved with , and two “h type” buttons: “Finite pulse”, a 2-sample pulse, and “Decaying”. The readout “The output” gives the verdict on how the output ends.
Notice the finite pulse’s output hits exactly zero right after , matching a 3-sample and a 2-sample , , while the decaying ‘s output only ever gets smaller, never hitting zero on the nose.
Same rule, different h
Every one of those instruments ran the exact same flip-and-slide machinery. What changes the effect entirely is only the numbers you put in .
Average a handful of neighboring samples together and you get a moving average, a simple smoother: it’s what a running weather report does when it quotes “the average of the last three days’ temperatures” instead of today’s alone, damping out day-to-day noise. Put a small copy of the signal a few samples later, scaled down, and you get an echo, the same effect as sound bouncing off a far wall and arriving again, quieter, a moment after the original. Subtract the sample before it from each sample, , and you get back the first difference from 2.2: the same “how fast is it changing” measurement, now written as a convolution.
Step Filter through Moving average, Echo and Differencer on the same noisy clip.
Same rule, different h
It's the same flip-and-slide machinery every time. Only the numbers in h change, and the effect looks completely different.
Describe this picture
Two plots: a fixed noisy clip , and convolved with the chosen . Three “Filter” buttons choose “Moving average”, “Echo” or “Differencer”.
Notice the output trace looks completely different each time, even though it’s the identical flip-and-slide rule running underneath, just with a different .
Two more views of the same numbers
There are two other ways to describe exactly the same operation, and both are useful later.
Write a sequence’s samples as the coefficients of a polynomial in a placeholder variable : the sequence becomes . Multiply two such polynomials the ordinary way you learned in algebra, collecting like powers of , and the coefficients of the product are exactly the convolution of the two original sequences. It’s the same arithmetic you already know, just with standing in for “the sample at index .”
The other view stacks ‘s job into a grid of numbers, a matrix , where every column is a shifted copy of ; multiplying that matrix by the vector produces , the same output as convolution, one row of the grid at a time. This is only a light preview, matrices get their own full treatment in a linear algebra course, but it’s worth seeing once here.
Switch View between Polynomial and Matrix.
Two more views of the same numbers
Convolution is also polynomial multiplication of the coefficients, and a matrix times a vector. Same numbers, three descriptions.
x(z) = 1 + 2z + 3z^2
h(z) = 1 + z
x(z) h(z) = 1 + 3z + 5z^2 + 3z^3
Describe this picture
The output and two “View” buttons. Polynomial writes the convolution as a product of two polynomials in ; Matrix writes it as a grid of shifted copies of times the column .
Notice both land on the exact same output numbers as every earlier instrument, just written two more ways.
The maths behind it · matrix-vector products
Stack the samples of into a column and put shifted copies of side by side in a grid of numbers (a matrix ), and convolution becomes one grid-times-column product, . Linear algebra studies exactly this kind of product, and Chapter 14 comes back to this grid when it finds a faster way to compute it.
Worked example
Multiply the polynomials and , matching and :
So , a sequence of length , exactly the numbers both the polynomial and matrix views above land on.
For the moving-average case, take and let be a step, for and before. Then , , , and for every : the running average climbs up to, then settles at, the step’s steady value.
Where you’ll meet this
Every audio effect that smooths, echoes or filters a recording, every camera blur, and every “apply this impulse response” trick from the last page, runs on exactly this sum: flip one sequence, slide it past the other, multiply the overlaps, and add. Chapter 14 comes back to it from a different angle and finds a way to compute the exact same far faster once the sequences get long.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Convolution | commutative: | |
| Flip-and-slide | flip one sequence, slide it past the other, multiply overlaps, sum | the mechanical way to compute the sum above |
| Output length | for two finite sequences of length , | |
| Infinite | output can stay nonzero forever, even while shrinking | previews finite vs. infinite impulse responses |
| Polynomial view | coefficients of | the sample at index |
| Matrix view | , columns of are shifted copies of | bridge to linear algebra |