Signal Processing & DSP
Advanced

Discrete Convolution

Output of a filter is the convolution of input and impulse response.

Formula

y[n]=∑kx[k]h[n−k]y[n] = \sum_k x[k] h[n-k]

Variables

y[n]Output sample
x[k]Input sample
hImpulse response

Example

Every FIR filter computes this weighted sliding sum.

How it works

Discrete convolution tells you how a linear time-invariant system combines a past input sequence with its impulse response to produce the current output. Each output sample is formed by reversing and shifting h[n], multiplying it point-by-point with x[k], and summing the overlap; this works because any input can be decomposed into shifted impulses, and the system’s response to each impulse adds linearly. The formula captures both memory and delay, which is why it is the core operation behind digital filters and many DSP algorithms.

When to use it

Use this whenever you need the output of an LTI discrete-time system from a known input and impulse response, especially for FIR/IIR filter analysis, smoothing, echo simulation, or system modeling. It also appears when combining signals with kernels in image and audio processing.

Worked example, step by step

Let x[n] = {x[0]=2, x[1]=-1, x[2]=3} and h[n] = {h[0]=1, h[1]=4, h[2]=-2}. We compute y[n] = Σ_k x[k] h[n-k] for n = 0 to 4. n = 0: y[0] = x[0]h[0] = 2·1 = 2 n = 1: y[1] = x[0]h[1] + x[1]h[0] = 2·4 + (-1)·1 = 8 - 1 = 7 n = 2: y[2] = x[0]h[2] + x[1]h[1] + x[2]h[0] = 2·(-2) + (-1)·4 + 3·1 = -4 - 4 + 3 = -5 n = 3: y[3] = x[1]h[2] + x[2]h[1] = (-1)·(-2) + 3·4 = 2 + 12 = 14 n = 4: y[4] = x[2]h[2] = 3·(-2) = -6 Final output sequence: y[n] = {2, 7, -5, 14, -6}.

Common mistakes to avoid

  • Forgetting that h[n-k] means the impulse response is time-reversed before shifting
  • Using only overlapping indices incorrectly and missing edge terms at the start and end of the output
  • Confusing convolution with correlation, which does not reverse the second sequence

Did You Know?

Convolution reverb captures a real space's impulse response, then convolves it with your track to place it 'inside' that room.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026