Discrete Convolution Calculator

Compute discrete convolution of two sequences with step-by-step computation, signal visualization, and output analysis.

About the Discrete Convolution Calculator

Discrete convolution is one of the most important operations in signal processing, probability, and applied mathematics. Given two sequences a[n] and b[n], their convolution (a * b)[n] = Σ a[k]·b[n−k] produces an output sequence that represents how one signal is modified by the other. In signal processing, this is how filters transform signals.

The classic "flip-and-slide" interpretation makes convolution intuitive: reverse one sequence, slide it across the other, and at each position compute the inner product of overlapping elements. The result tells you the weighted overlap at each shift position. This operation appears in moving averages, image filtering (blur, sharpen, edge detect), polynomial multiplication, and probability (distribution of sums of random variables).

This calculator computes the full discrete linear convolution of two user-defined sequences. It shows every computation step — which elements multiply and sum at each output index n — so you can follow the flip-and-slide process exactly. The signal visualization plots both input sequences and the output side by side with bar charts.

Key properties are displayed: output length (len A + len B − 1), peak value, sum of output (equals product of input sums), and energy. Optional normalization divides the output by sum(B), useful for averaging filters.

Presets cover common scenarios: box filters, edge detection kernels, moving averages, impulse responses, Gaussian approximations, and exponential decays. Whether you are learning DSP fundamentals or implementing a filter, this tool provides transparent, verifiable convolution computations.

Why Use This Discrete Convolution Calculator?

Discrete convolution requires sliding one sequence across another and summing element-wise products at every shift — for sequences of length m and n, that means (m+n−1) output values, each requiring up to min(m,n) multiplications. Even short sequences produce long computations ripe for indexing and sign errors. This calculator computes the full linear convolution instantly, displays an interactive step-by-step sliding-window visualization, and offers a normalized mode for probability and filter applications. DSP students, audio engineers, and data scientists use it to verify convolution results and build intuition for how filter kernels reshape signals.

How to Use This Calculator

  1. Enter sequence A as comma-separated values (e.g., 1,2,3).
  2. Enter sequence B as comma-separated values.
  3. Or pick a preset pair to populate both fields.
  4. Choose whether to normalize the output by sum(B).
  5. Read output length, sequence, and energy from the output cards.
  6. Check the step-by-step table to see each y[n] computation.
  7. View the signal visualization for a graphical comparison.

Formula

(a * b)[n] = Σ_{k} a[k] · b[n−k]; length = len(a) + len(b) − 1; sum(a*b) = sum(a) · sum(b)

Example Calculation

Result: Output: 1, 3, 6, 5, 3 (length 5)

Convolving [1,2,3] with [1,1,1] yields a 5-element sequence. At n=2: 1×1 + 2×1 + 3×1 = 6.

Tips & Best Practices

What Convolution Really Does

Convolution combines two sequences to produce a third that represents how the shape of one is modified by the other. Mathematically, (f * g)[n] = Σ f[k] g[n−k]. In signal processing, one sequence is the input signal and the other is the system's impulse response; the convolution gives the output signal. In probability, convolving two probability mass functions gives the PMF of the sum of two independent random variables. The key geometric intuition is "flip, shift, multiply, sum" — one sequence is reversed, slid across the other, and at each position the overlapping products are summed. This sliding-window view is exactly what this calculator visualizes step by step.

Convolution and the Fourier Transform

The convolution theorem states that convolution in the time/space domain equals pointwise multiplication in the frequency domain: DFT(f * g) = DFT(f) · DFT(g). This property is the basis of fast convolution via the FFT: transform both sequences, multiply element-wise, then inverse-transform. For long sequences, FFT-based convolution runs in O(n log n) versus O(n²) for direct computation. Every digital audio reverb, image blur, and neural-network convolution layer exploits this speedup. The convolution theorem also explains why frequency-domain filters are multiplicative — a low-pass filter's frequency response simply zeros out high-frequency components.

Applications Beyond Signal Processing

Convolution appears in polynomial multiplication (the coefficients of the product polynomial are the convolution of the coefficient arrays), in combinatorics (generating functions multiplied via convolution), in image processing (2D convolution with edge-detection or blur kernels), and in deep learning (convolutional neural networks slide learned filter kernels across images to extract features). Even in finance, the distribution of total portfolio returns over multiple periods is the convolution of daily return distributions. Mastering linear convolution builds the foundation for understanding all these applications.

Frequently Asked Questions

What is discrete convolution?

It is the sum Σ a[k]·b[n−k] over all valid k. It combines two sequences into a new one representing their "interaction."

What is the flip-and-slide method?

You reverse one sequence, slide it across the other, and at each position multiply overlapping elements and sum. This is the graphical interpretation of convolution.

Why is the output longer than the inputs?

Output length is len(A)+len(B)−1 because there are that many positions where the flipped sequence has nonzero overlap with the other. Use this as a practical reminder before finalizing the result.

Is convolution commutative?

Yes. a*b = b*a. The order does not matter.

How is convolution related to polynomial multiplication?

Convolving coefficient sequences is identical to multiplying polynomials. For example, [1,1]*[1,1] = [1,2,1], which is (1+x)² = 1+2x+x².

What is the difference between convolution and correlation?

Convolution flips one sequence before sliding; correlation slides without flipping. For symmetric sequences, they are the same.

Related Pages