Saved

Press the star next to a tool's name to save it.

All my tools

Convolution Calculator

Use this convolution calculator to find the discrete convolution of two sequences, full or circular, with the result also shown as a product of polynomials.

Restored your last values ·

Type each sequence as a list of numbers, separated by commas, spaces or new lines. The first number of each list is at position 0. Choose a full convolution, or a circular one with a period N.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Enter two sequences, then press Calculate.

A convolution calculator computes the discrete convolution of two sequences: each number of the result is a sum of products of the two lists, taken with one list reversed. Type the two sequences and press the button. You can also choose a circular convolution with a period N. The result is also shown as the product of two polynomials, since the two operations are the same. The definition follows the Wikipedia page on convolution, and the work is done in your browser.

How to use the convolution calculator

  1. Type the first sequence and the second sequence, with commas, spaces or new lines between the numbers.
  2. Choose a full or a circular convolution, and give the period N if you like.
  3. Press Calculate.

The discrete convolution

For two sequences f and g, the page defines the convolution as (f ∗ g)[n] equal to the sum over all m of f[m] times g[n − m]. Each term of the result mixes values of f with values of g in reverse order. If f has p numbers and g has q numbers, the full result has p + q − 1 numbers. For f = (1, 2, 3) and g = (0, 1, 0.5), the result is (0, 1, 2.5, 4, 1.5). For example, the term at position 2 is 1 × 0.5 + 2 × 1 + 3 × 0, which is 2.5. The calculator also checks the result: the sum of all the numbers of the result equals the product of the sums, 6 × 1.5 = 9.

Convolution and polynomial multiplication

The page notes that the coefficients of a product of two polynomials are the convolution of their coefficient sequences, a result also called the Cauchy product. If you read the lists as coefficients, lowest power first, the calculator shows the product polynomial. For (1, 1) convolved with (1, 1), the result is (1, 2, 1), which is x² + 2x + 1, the square of x + 1. For (1, 2, 3) and (0, 1, 0.5), the product is 1.5x⁴ + 4x³ + 2.5x² + x. This makes convolution a handy way to multiply long polynomials.

Circular convolution

For sequences with a period N, the page gives the circular convolution as the sum from m = 0 to N − 1 of f[m] times g with the index n − m taken modulo N. The result also has N numbers. For f = (1, 2, 3) and g = (0, 1, 0.5) with N = 3, the result is (4, 2.5, 2.5): it is the full result (0, 1, 2.5, 4, 1.5) with the last two numbers wrapped round and added to the first two. If N is at least p + q − 1, the circular convolution equals the full one. The calculator pads the shorter sequences with zeros to the length N.

Where convolution is used

Convolution describes how a linear system, such as a filter, responds to an input: the output is the input convolved with the system's impulse response. It is used to smooth data, to blur images, to find the distribution of a sum of independent random variables, and in the multiplication of long numbers. Circular convolution is the form that is computed with the fast Fourier transform, which is why it is so common in signal processing.

Working by hand

A simple way to convolve two short lists by hand is to write one list in a row and make one row for each number of the other, shifted one place to the right each time, then add the columns. For (1, 2, 3) and (0, 1, 0.5), the rows are 1 × (0, 1, 0.5) = (0, 1, 0.5), 2 × (0, 1, 0.5) shifted by one, and 3 × (0, 1, 0.5) shifted by two. Adding the columns gives the same five numbers as the calculator.

Example: a moving average

Convolution with a short list of weights smooths a sequence. Convolve (1, 2, 3, 4, 5) with (0.5, 0.5). The result is (0.5, 1.5, 2.5, 3.5, 4.5, 2.5). The middle four numbers are the averages of each pair of neighbors in the first list, and the first and last numbers are the edges, where only one neighbor exists. The same idea with longer lists of weights gives smoother averages, and it is how many filters are built.

Example: the sum of two dice

The number of ways to get each total with two dice is a convolution. The list (1, 1, 1, 1, 1, 1) shows that each face of a die can come up one way. Convolve it with itself, and the result is (1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1). These are the numbers of ways to roll the totals from 2 to 12, so that 7 can come up in 6 ways out of 36. The same method gives the distribution of the sum of any two independent quantities that take whole-number values, when you use their lists of probabilities.

Properties of convolution

The convolution is commutative, so f ∗ g equals g ∗ f, and it is associative. It is also distributive over addition: f ∗ (g + h) equals f ∗ g + f ∗ h. The sum of the result always equals the product of the sums of the two lists, which the calculator shows as a check. A list with a single 1, such as (1), acts as an identity: convolving with it leaves the other list unchanged, and a list (0, 1) shifts the other list one place to the right.

Common mistakes

  • Forgetting to reverse one list. The index of g runs backward as the index of f runs forward.
  • Getting the length wrong. The full result has p + q − 1 numbers.
  • Mixing up the order of the coefficients. The first number is the constant term.
  • Confusing circular and full convolution. Circular wraps the result around.
  • Using convolution when you want a product by position. That is the Hadamard product.

What next

Use this often? Add Convolution to your Home screen.

Frequently asked questions

What is a convolution calculator?

A tool that computes the discrete convolution of two sequences: (f∗g)[n] = Σ f[m]·g[n − m].

What is the convolution of (1, 2, 3) and (0, 1, 0.5)?

(0, 1, 2.5, 4, 1.5), which has 3 + 3 − 1 = 5 numbers.

How is convolution related to polynomial multiplication?

The coefficients of the product of two polynomials are the convolution of their coefficient lists.

What is circular convolution?

Convolution of sequences with period N, with indices taken modulo N, so the result has N numbers.

How long is the result of a convolution?

For lists of lengths p and q, the full convolution has p + q − 1 numbers.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools