DSP from Scratch · Lesson 5
Convolution Explained Simply: Flip, Slide, Multiply, Add
The most used recipe in signal processing, done in your head with one cup of coffee.

Press play: it starts at
Chapters14 parts, tap one to jump there
In one sentence
Flip the impulse response, slide it, multiply each input by the weight under it, and add.
Watch first, then read. The video shows every idea moving. These notes write out each step so you can check the maths at your own pace. Press any ▶ time button to jump the video to that moment.
Drink one coffee every five hours, for a whole week, and the caffeine in your body never passes two cups. Not after ten coffees. Not after thirty.
Why? Because only your last few coffees really count. The recipe that tells you how much each one counts is called convolution. It is the same recipe that blurs the background of a photo, and makes a song sung in a bedroom sound as if it were sung in a cathedral. All it takes is one cup of coffee and four simple moves.
Quick recap
From lesson 4: your body clears about half its caffeine every five hours. So one cup, checked every five hours, leaves 1, ½, ¼, ⅛. That fading list is your body’s impulse response: what comes out after a single tap.
For coffees at 9 am, 2 pm and 7 pm we drew a copy of that list for each cup and added them up: ⅞ of a cup at midnight. That works, but it is slow. A song is 44,100 numbers every second (lesson 3); one copy for every number? There is a quicker way.
Turn it around: look back
Instead of following each cup forward, stand at midnight and look back at the cups you drank.
- The 7 pm cup is one check old, so half of it is left.
- The 2 pm cup is two checks old: a quarter is left.
- The 9 am cup is three checks old: an eighth.
Add them: . The same answer as last time, and we did not draw a single curve.
So the impulse response also tells you how much a past cup still counts, by its age. A cup drunk right now counts fully: 1. One check old: ½. Two checks: ¼. Three checks: ⅛. We call these numbers weights. (Strictly, it keeps halving, , and so on; those are tiny, so for now we keep just four weights.)
The strip and the recipe
Write the four weights on a strip of paper and lay it under the clock. On a clock line older times sit on the left, so the oldest weight, ⅛, goes on the left and the newest weight, 1, goes on the right.
Look at the strip: ⅛, ¼, ½, 1. That is the impulse response backwards. It is flipped, and that is not a maths trick: the oldest cups have faded the most, so their small weights end up on the left.
| clock | 9 am | 2 pm | 7 pm | midnight |
|---|---|---|---|---|
| cups drunk | 1 | 1 | 1 | 0 |
| strip (weights) | ⅛ | ¼ | ½ | 1 |
| multiply | ⅛ | ¼ | ½ | 0 |
add: ⅛ + ¼ + ½ + 0 = ⅞ of a cup at midnight
Run it along the whole day, and keep sliding even after the last cup:
| Moment | Cups under the strip | Total |
|---|---|---|
| 9 am | 1 × 1 | 1 |
| 2 pm | 1 × ½ + 1 × 1 | 1½ |
| 7 pm | 1 × ¼ + 1 × ½ + 1 × 1 | 1¾ |
| midnight | 1 × ⅛ + 1 × ¼ + 1 × ½ | ⅞ |
| 5 am | 1 × ⅛ + 1 × ¼ | ⅜ |
| 10 am | 1 × ⅛ | ⅛ |
Exactly the numbers we got last lesson by drawing copies, and the caffeine outlasts the coffee.
Three cups and a strip of four weights gave six answers. That is a handy rule:
Cups can be different sizes too: a double coffee counts double, two times the weight under it.
¾ of a cup. The 7 pm cup sits over ½: ½. The empty 2 pm slot gives nothing. The double at 9 am sits over ⅛: . Then .
A week of coffee in one line
Back to the week: one cup every five hours, again and again. Slide the strip to any moment late in the week. How many cups are over it? Only four. Everything older is off the end of the strip. So at every check it is the same sum:
Drink your tenth cup or your thirtieth: the answer does not change. And the tiny leftovers we dropped? Each one covers half of the gap that is left to 2, so the total creeps closer and closer to two cups but never gets past it.
That is the power of the strip. However long the coffee diary, a week or a year, each answer needs just four multiplications and one sum. That is why even the tiny chip in a pair of earbuds can run a recipe like this on every number of a song, as it plays.
The real name: convolution
Flip the impulse response, slide it, multiply, add: that is called convolution. We write it with a star: the output equals the input, star, the impulse response.
In lesson 1 we wrote for the input at step . Call the impulse response and the output . Then one answer reads
In words: the first weight times the newest input, plus the second weight times the input one step ago, plus the third weight times the input two steps ago, and so on. That is our strip: the first weight, , always goes with the newest input.
Books squeeze all of that into one line with the Greek letter (sigma), which just means “add them all up”, and a letter that counts how many steps back you are looking:
Do not let it scare you: it is still flip, slide, multiply, add.
And last lesson’s way, one copy per input, sized, slid and added, is convolution too. The copies follow each input forward; the strip looks back from each output. Same sum, same answer: use whichever is easier.
An echo, and why the flip matters
Shout across a valley and you hear your voice, then a quieter copy a moment later: an echo. Here is the simplest echo as a system: the sound goes straight through, and a copy, half as loud, comes back two steps later. Tap it with a click and you get 1, 0, ½. That is its impulse response.
Feed it a short sound: 4, then 2. Flip the impulse response onto a strip, ½, 0, 1, and slide:
- step 0:
- step 1:
- step 2: the input has ended, but the ½ reaches back to the 4:
- step 3:
The output is 4, 2, 2, 1: your sound, 4, 2, then its echo, 2, 1, the same shape half as loud, two steps later. Exactly what an echo should do.
Now forget to flip. Lay the strip down the wrong way round, 1, 0, ½, and slide it. You get 2, 1, 4, 2: the quiet copy comes first. An echo you would hear before you even shouted.
Flipped: 4, 2, 2, 1
Your sound, then its echo: half as loud, two steps later.
Forgot to flip: 2, 1, 4, 2
The quiet copy comes first: an echo before the shout.
6, 0, 5, 0, 1. At step 2 the new 2 arrives just as the echo of the 6 comes back: . The echo lands on top of the next sound, and they simply add.
Convolution in real life
- The cathedral. Engineers pop a balloon inside a real cathedral and record what comes back: thousands of echoes, slowly fading. That recording is the cathedral’s impulse response. Take a dry recording made in a room with no echo, convolve it with that impulse response, and it sounds as if it were played right there. Music apps call this convolution reverb; reverb is the wash of echoes a room adds.
- Photos. A photo is a grid of tiny dots called pixels, and each pixel is a number: how bright it is. To blur it, slide a strip like ¼, ½, ¼ along each row, then down each column. Each new pixel becomes a mix of itself and its neighbours: the same recipe, in two directions.
- The 7-day average on a news chart. A strip of seven equal weights, each , sliding along the days. It smooths away the jumpy days, just like last lesson’s smoother.
Three common mistakes
Recap
- To find the output at any moment, look back.
- Flip the impulse response onto a strip, slide it to that moment, multiply each input by the weight under it, and add. That is convolution: .
- It gives the same answer as last lesson’s copies, and it explains why caffeine levels off, why an echo comes after the shout, and how a photo gets blurred.
Say it aloud once: flip, slide, multiply, add.
Next, lesson 6 feeds a system pure sine waves, and finds out why the same system lets a deep hum through but dims a high hiss.
Interactive lab
Flip, slide, multiply, add
Step the strip along any input, one output at a time. Try the coffee, the echo and the smoother, or type your own numbers. Then forget to flip and hear the echo come first.
Sign in to open the lab
It is free. Signing in with Google also keeps your progress and your scores.
Sign in with GoogleLesson 1 of every course is open without signing in.
Check yourself
Did it stick?
Work each one out on paper first. Every question has a full worked answer.
- 1
In , which input does the first weight go with?
Worked answer
multiplies : the newest input. The first weight of the impulse response is what comes out straight after a tap, so it belongs to the input that has only just arrived. Older inputs, , , get the later weights. Laid along the clock, with older times on the left, that is why the strip reads backwards.
- 2
The impulse response is 1, ½. The input is 4, 2. What comes out?
Worked answer
Flip the impulse response onto a strip, ½, 1, and slide it:
- step 0:
- step 1:
- step 2: the input has ended; the ½ reaches back to the 2:
The output is 4, 4, 1: three numbers, because .
- 3
An input of 6 numbers goes into a system whose impulse response has 4. How many numbers come out?
Worked answer
The output keeps going after the input ends, while the strip still reaches back to the last inputs.
- 4
The echo system has impulse response 1, 0, ½. The input is 2, 0, 4. What comes out?
Worked answer
The strip, flipped, is ½, 0, 1. Slide it:
- step 0:
- step 1:
- step 2:
- step 3:
- step 4:
The output is 2, 0, 5, 0, 2. At step 2 the echo of the first 2 lands on top of the new 4, and they add.
- 5
Half the caffeine is gone every five hours. You drink one cup at 9 am, nothing at 2 pm, and a double coffee at 7 pm. How many cups of caffeine are in you at midnight? (A decimal is fine.)
Worked answer
Stand at midnight and lay the strip ⅛, ¼, ½, 1 under the clock, with its 1 at midnight:
- the double at 7 pm (one check old) sits over ½:
- the empty 2 pm slot gives nothing
- the cup at 9 am (three checks old) sits over ⅛:
Add: cups.
Sign in to open the checks
It is free. Signing in with Google also keeps your progress and your scores.
Sign in with GoogleLesson 1 of every course is open without signing in.
Was this lesson clear?
Free weekly email
Get the next lesson by email.
The week's new lessons, the daily facts in one place, one thing to try in the lab and one puzzle. Free.
No spam. One click to leave.