Convolution Calculator | Linear, Circular, Formula & Examples

Calculate linear and circular convolution of two sequences with formulas, step-by-step working, tables, examples, and FAQs.
Convolution Calculator

Convolution Calculator

Use this convolution calculator to find the linear convolution or circular convolution of two finite discrete sequences. Convolution is a core operation in signals and systems, digital signal processing, probability, image processing, polynomial multiplication, and differential equations. For two discrete sequences \(x[n]\) and \(h[n]\), the linear convolution is written as \(y[n]=\sum_{k=-\infty}^{\infty}x[k]h[n-k]\). Enter two sequences below, choose the convolution type, and the calculator will show the output sequence with step-by-step summation.

Linear Convolution Circular Convolution Discrete Sequences Signal Processing Step-by-Step Working

Calculate Convolution

Enter each sequence as comma-separated numbers. For example, use 1, 2, 3 for \(x[n]=[1,2,3]\). For circular convolution, choose a circular length \(N\). If you leave \(N\) blank, the calculator uses the larger sequence length.

Result

Output Sequence
[4, 13, 28, 27, 18]
\(y[0]=1(4)=4\)
\(y[1]=1(5)+2(4)=13\)
\(y[2]=1(6)+2(5)+3(4)=28\)
\(y[3]=2(6)+3(5)=27\)
\(y[4]=3(6)=18\)

The output uses the selected starting index. Linear convolution of lengths \(M\) and \(L\) has length \(M+L-1\).

Convolution Formula

For discrete-time sequences, convolution combines two sequences by flipping one sequence, shifting it, multiplying overlapping terms, and adding the products. If the input sequence is \(x[n]\) and the impulse response or second sequence is \(h[n]\), the output sequence is:

\[y[n]=(x*h)[n]=\sum_{k=-\infty}^{\infty}x[k]h[n-k]\]

For finite sequences, only the overlapping terms contribute to the sum. If \(x[n]\) has length \(M\) and \(h[n]\) has length \(L\), the linear convolution has length:

\[\text{length of }y[n]=M+L-1\]

This length rule is one of the fastest ways to check whether a convolution answer is reasonable. For example, if \(x[n]\) has \(3\) terms and \(h[n]\) has \(3\) terms, the linear convolution should have \(3+3-1=5\) terms.

Linear convolution

Linear convolution is used when sequences do not wrap around. It is the standard convolution used in many signal-processing, probability, and polynomial multiplication problems.

Circular convolution

Circular convolution wraps indices around a fixed length \(N\). It is common in discrete Fourier transform and frequency-domain calculations.

How to Use the Convolution Calculator

  1. Choose linear convolution or circular convolution.
  2. Enter the first sequence \(x[n]\) as comma-separated numbers.
  3. Enter the second sequence \(h[n]\) as comma-separated numbers.
  4. For circular convolution, enter the length \(N\). If you leave it blank, the calculator uses the larger sequence length.
  5. Choose the number of decimal places for the output sequence.
  6. Click Calculate Convolution and read the output sequence and summation steps.
Note: This calculator is designed for finite discrete sequences. It does not symbolically integrate continuous functions. For continuous convolution, the formula uses an integral, while this tool uses finite sums.

Linear vs Circular Convolution

Linear convolution and circular convolution look similar, but they are not the same operation. Linear convolution assumes the sequences extend with zeros outside their listed values. Circular convolution assumes the sequences repeat periodically around a fixed length \(N\). This difference changes both the output length and the way terms overlap.

Feature Linear convolution Circular convolution
Main formula \(y[n]=\sum_k x[k]h[n-k]\) \(y[n]=\sum_{k=0}^{N-1}x[k]h[(n-k)\bmod N]\)
Output length \(M+L-1\) \(N\)
Index behavior Terms outside the sequence are treated as zero. Indices wrap around modulo \(N\).
Common use Filtering, polynomial multiplication, probability sums. DFT, FFT, periodic signals, frequency-domain processing.
Risk Longer output may be expected. Time-domain aliasing can occur if \(N\) is too small.

To make circular convolution match linear convolution, choose a circular length large enough to prevent wrap-around overlap. A common rule is:

\[N\ge M+L-1\]

When \(N\) is at least the linear convolution length and both sequences are zero-padded to length \(N\), circular convolution can reproduce the linear convolution values without time-domain aliasing.

Worked Examples

Example 1: Linear convolution

Find the linear convolution of \(x[n]=[1,2,3]\) and \(h[n]=[4,5,6]\).

\[y[0]=1(4)=4\] \[y[1]=1(5)+2(4)=13\] \[y[2]=1(6)+2(5)+3(4)=28\] \[y[3]=2(6)+3(5)=27\] \[y[4]=3(6)=18\]

So the convolution output is \(y[n]=[4,13,28,27,18]\). Since both sequences have length \(3\), the result has length \(3+3-1=5\).

Example 2: Circular convolution

Find the circular convolution of \(x[n]=[1,2,3]\) and \(h[n]=[4,5,6]\) with \(N=3\).

\[y[n]=\sum_{k=0}^{2}x[k]h[(n-k)\bmod 3]\] \[y[0]=x[0]h[0]+x[1]h[2]+x[2]h[1]=1(4)+2(6)+3(5)=31\] \[y[1]=x[0]h[1]+x[1]h[0]+x[2]h[2]=1(5)+2(4)+3(6)=31\] \[y[2]=x[0]h[2]+x[1]h[1]+x[2]h[0]=1(6)+2(5)+3(4)=28\]

The circular convolution is \([31,31,28]\). Notice that this is not the same as the linear convolution result because the circular length is only \(3\), so terms wrap around.

Example 3: Convolution as polynomial multiplication

Suppose \(x=[2,3]\) and \(h=[4,5]\). These can represent polynomial coefficients:

\[(2+3z)(4+5z)=8+10z+12z+15z^2\] \[(2+3z)(4+5z)=8+22z+15z^2\]

The coefficient sequence is \([8,22,15]\), which is exactly the linear convolution of \([2,3]\) and \([4,5]\).

Example 4: Convolution in probability

If two independent discrete random variables are added, the probability distribution of their sum is found using convolution. If \(X\) and \(H\) are independent, then:

\[P(Y=n)=\sum_k P(X=k)P(H=n-k)\]

This has the same structure as discrete convolution. Each possible sum is built by multiplying compatible probability terms and adding them.

Complete Guide to Convolution

Convolution is a mathematical operation that combines two functions, signals, sequences, or distributions to produce a third one. At first, convolution can look complicated because it involves flipping, shifting, multiplying, and summing. However, the underlying idea is simple: convolution measures how much one object overlaps with another as one is shifted across the other. In discrete mathematics and signal processing, this overlap is measured by multiplying matching terms and adding the products.

For finite discrete sequences, convolution is especially practical. If one sequence represents an input signal and the other represents a system’s impulse response, the convolution gives the output signal. This is why convolution is central in linear time-invariant systems. A system may receive a signal such as audio, sensor data, voltage, or a digital image row, and the system’s response can be described by a smaller sequence called a kernel, filter, or impulse response. The output is formed by sliding the filter across the signal and computing sums of products.

The standard discrete convolution formula is \(y[n]=\sum_k x[k]h[n-k]\). In this formula, \(x[k]\) is one sequence, \(h[n-k]\) is a shifted and reversed version of the second sequence, and \(y[n]\) is the output at index \(n\). The summation adds all products that overlap at that shift. For finite sequences, many terms are zero or outside the sequence, so only the overlapping terms are included.

Why convolution flips one sequence

One of the most confusing parts of convolution is the expression \(h[n-k]\). This is not just \(h[k]\). The term \(n-k\) causes the second sequence to be reversed and shifted. In graphical convolution, the usual method is to flip one signal, slide it across the other, multiply overlapping values, and sum. This process is easier to understand visually, but the algebraic formula captures the same idea.

For finite arrays, many students calculate convolution using a table instead of drawing the flip-and-slide diagram. The table method lists each output index and includes all pairs of sequence elements whose indices add to that output index. For example, in linear convolution, if the first sequence has values \(x[0],x[1],x[2]\) and the second sequence has values \(h[0],h[1],h[2]\), then \(y[2]\) receives contributions from \(x[0]h[2]\), \(x[1]h[1]\), and \(x[2]h[0]\). The index pairs add to \(2\).

Linear convolution

Linear convolution is the standard convolution of two finite sequences without wrap-around. If the first sequence has length \(M\) and the second sequence has length \(L\), the result has length \(M+L-1\). This length occurs because the sequences first overlap at one term, then overlap more fully, and finally overlap less as one sequence slides past the other. The output begins when the first elements just touch and ends when the last elements just separate.

Linear convolution is used in many settings. In signal processing, it describes the output of a linear time-invariant system. In probability, it gives the distribution of the sum of independent random variables. In algebra, it gives the coefficients when two polynomials are multiplied. In numerical methods, it appears in smoothing, filtering, and kernel operations. The same mathematical structure appears in different subjects because all of these problems involve combining values based on all ways their indices can add to a target index.

Circular convolution

Circular convolution is a variation where sequences are treated as periodic with a fixed length \(N\). Instead of falling outside the sequence and becoming zero, indices wrap around modulo \(N\). The formula is:

\[y[n]=\sum_{k=0}^{N-1}x[k]h[(n-k)\bmod N]\]

This operation is important in the discrete Fourier transform. Multiplication in the DFT domain corresponds to circular convolution in the time domain. That is why circular convolution appears in FFT-based filtering, frequency-domain processing, and periodic signal analysis.

Circular convolution can accidentally produce time-domain aliasing if the circular length is too short. When linear convolution is squeezed into a circular result of smaller length, the tail wraps back and adds to earlier samples. This may be intentional in periodic problems, but it is an error when the goal is ordinary linear convolution. To compute linear convolution using circular convolution, zero-pad both sequences so that \(N\ge M+L-1\). This prevents wrap-around overlap from corrupting the linear result.

Convolution in signals and systems

In signals and systems, convolution is the operation that describes how an input signal passes through a linear time-invariant system. The system is characterized by its impulse response \(h[n]\). If the input is \(x[n]\), the output is \(y[n]=x[n]*h[n]\). The impulse response tells how the system reacts to a single impulse. Since a general input can be viewed as a weighted sum of shifted impulses, the total output is a sum of shifted and scaled impulse responses. That total sum is convolution.

This interpretation is powerful because it separates the signal from the system. The input sequence tells what is being fed into the system. The impulse response tells how the system behaves. Convolution combines them. For example, in audio processing, a short impulse response might represent echo, reverb, smoothing, or filtering. Convolution applies that behavior to the entire sound. In digital electronics, a finite impulse response filter uses convolution to remove noise, emphasize certain frequencies, or smooth rapid changes.

Convolution and filtering

A digital filter often uses a small sequence of coefficients called a kernel. When this kernel is convolved with a signal, each output value becomes a weighted sum of nearby input values. For example, a simple moving average filter with kernel \([\frac{1}{3},\frac{1}{3},\frac{1}{3}]\) replaces each value with the average of nearby values. This reduces rapid fluctuations and smooths the signal. Sharpening filters, edge detectors, blur filters, and many image-processing operations are based on the same idea.

In one-dimensional convolution, the kernel slides along a sequence. In two-dimensional convolution, a matrix kernel slides across an image. Each output pixel is computed from neighboring pixels weighted by the kernel. This is one reason convolution is important in computer vision and machine learning. Convolutional neural networks use learned kernels to detect patterns such as edges, textures, shapes, and eventually higher-level features.

Convolution in probability

Convolution also appears in probability. If two independent random variables are added, the distribution of the sum is the convolution of their distributions. For discrete random variables, the formula is:

\[P(X+H=n)=\sum_k P(X=k)P(H=n-k)\]

This formula says that to get a sum of \(n\), you add the probabilities of all compatible pairs. For example, to get a sum of \(7\) when rolling two dice, possible pairs are \((1,6),(2,5),(3,4),(4,3),(5,2),(6,1)\). Each pair contributes to the total probability. This is the same indexing idea used in sequence convolution.

Convolution and polynomial multiplication

Another useful interpretation is polynomial multiplication. If a sequence is treated as a list of polynomial coefficients, then linear convolution gives the coefficients of the product polynomial. Suppose \(x=[a_0,a_1,a_2]\) and \(h=[b_0,b_1]\). These correspond to polynomials \(a_0+a_1z+a_2z^2\) and \(b_0+b_1z\). Multiplying them gives coefficients formed by sums of products whose powers add to the same exponent. That is exactly convolution.

This connection helps explain the output length. A degree \(2\) polynomial times a degree \(1\) polynomial produces a degree \(3\) polynomial with four coefficients. The sequence lengths are \(3\) and \(2\), so the convolution length is \(3+2-1=4\). The same rule appears from two different viewpoints.

Continuous convolution

Continuous convolution is the analog of discrete convolution for continuous functions. Instead of a sum, it uses an integral:

\[(f*g)(t)=\int_{-\infty}^{\infty}f(\tau)g(t-\tau)\,d\tau\]

This formula is used in differential equations, continuous-time signals, probability density functions, physics, and engineering. The idea is the same as discrete convolution: flip, shift, multiply, and accumulate. The difference is that continuous functions require integration over a continuous variable, while discrete sequences use summation over integer indices. This calculator focuses on discrete convolution because it is practical to compute directly from finite lists of numbers.

Convolution properties

Convolution has several important algebraic properties. It is commutative, meaning:

\[x[n]*h[n]=h[n]*x[n]\]

This means the order of the two sequences does not change the linear convolution result. Convolution is also associative:

\[(x*h)*g=x*(h*g)\]

It is distributive over addition:

\[x*(h+g)=x*h+x*g\]

These properties make convolution useful in systems analysis, filter design, and algebraic manipulation. They also help check answers. For example, if you swap the two input sequences in a linear convolution calculator, the output should stay the same.

Convolution and correlation

Convolution is often compared with correlation. Both operations involve sliding one sequence against another and adding products, but convolution flips one sequence while correlation does not. Cross-correlation is often used to measure similarity or detect delays between signals. Convolution is often used to model system response or filtering. The formulas look similar, so students sometimes mix them up. The key difference is the index reversal in convolution.

In simple terms, convolution answers “what output is produced when this input passes through this system?” Correlation answers “how similar are these two signals at this shift?” Both are important, but they serve different purposes. Many software libraries implement both, so checking the operation name matters.

Step-by-step method for linear convolution

To compute linear convolution by hand, start by writing the two sequences with their indices. Then determine the output length \(M+L-1\). For each output index \(n\), list all index pairs \((k,n-k)\) that correspond to valid entries in both sequences. Multiply each pair and add the products. Repeat until every output index is computed.

For example, if \(x=[1,2,3]\) and \(h=[4,5,6]\), output index \(2\) receives terms from pairs \((0,2)\), \((1,1)\), and \((2,0)\). That gives \(1(6)+2(5)+3(4)=28\). This index-pair method is often easier than trying to draw every flip-and-shift diagram.

Step-by-step method for circular convolution

For circular convolution, first choose the circular length \(N\). Pad the sequences with zeros if necessary so both have length \(N\). Then compute each output index using modulo indexing:

\[y[n]=\sum_{k=0}^{N-1}x[k]h[(n-k)\bmod N]\]

The modulo operation is what creates wrap-around. For example, if \(N=4\) and an index becomes \(-1\), it wraps to \(3\). If an index becomes \(4\), it wraps to \(0\). This circular behavior is why the output has exactly \(N\) values.

Common mistakes in convolution

The first common mistake is forgetting the output length of linear convolution. If two finite sequences have lengths \(M\) and \(L\), the result should have \(M+L-1\) values. A shorter answer may indicate that circular convolution was accidentally used or that the edge overlaps were missed. The second common mistake is mixing up convolution and correlation. Correlation does not flip the second sequence in the same way, so the result can differ.

The third common mistake is using circular convolution with a length that is too small when the goal is linear convolution. If \(N<M+L-1\), circular convolution wraps part of the output back into earlier indices. This creates aliasing. The fourth mistake is misaligning sequence indices. If the first term is not actually index \(0\), the output index labels must shift. The calculator includes a starting index field so you can label the result according to the convention you are using.

Why convolution matters

Convolution matters because it is a universal way to describe how effects combine across time, space, or index. In audio, convolution can create echo and reverb. In image processing, convolution can blur, sharpen, or detect edges. In probability, convolution combines distributions. In polynomial algebra, convolution multiplies coefficient lists. In systems theory, convolution predicts the output of a system from its input and impulse response. The same operation appears across many disciplines because the same structure appears whenever one quantity is combined with shifted versions of another.

A good convolution calculator should therefore do more than output a sequence. It should show the summation structure, output length, index behavior, and difference between linear and circular convolution. This is important for students because convolution is easy to compute mechanically but harder to interpret. If you understand why each output term is a sum of products, the formula becomes much less mysterious.

In summary, convolution is a sum of shifted products. Linear convolution treats values outside the sequence as zero and produces an output of length \(M+L-1\). Circular convolution wraps values around a fixed length \(N\) and produces an output of length \(N\). The calculator above lets you compute both versions and compare their step-by-step results.

Convolution Formula Summary

Type Formula Output length Main use
Discrete linear convolution \(y[n]=\sum_k x[k]h[n-k]\) \(M+L-1\) Filtering, systems, probability, polynomial multiplication
Discrete circular convolution \(y[n]=\sum_{k=0}^{N-1}x[k]h[(n-k)\bmod N]\) \(N\) DFT, FFT, periodic signals, frequency-domain processing
Continuous convolution \((f*g)(t)=\int_{-\infty}^{\infty}f(\tau)g(t-\tau)\,d\tau\) Depends on function support Continuous signals, differential equations, probability densities

Related Calculators and Study Tools

These related tools can help with the next step in signal processing, algebra, or applied mathematics:

Convolution Calculator FAQs

What is convolution?

Convolution is an operation that combines two sequences, signals, functions, or distributions by shifting one across the other, multiplying overlapping values, and adding the products.

What is the formula for discrete convolution?

The standard discrete convolution formula is \(y[n]=\sum_k x[k]h[n-k]\). For finite sequences, only valid overlapping terms are included in the sum.

What is the length of linear convolution?

If one sequence has length \(M\) and the other has length \(L\), the linear convolution has length \(M+L-1\).

What is circular convolution?

Circular convolution is convolution with wrap-around indexing over a fixed length \(N\). Its formula is \(y[n]=\sum_{k=0}^{N-1}x[k]h[(n-k)\bmod N]\).

What is the difference between linear and circular convolution?

Linear convolution treats values outside the sequence as zero and produces length \(M+L-1\). Circular convolution wraps indices modulo \(N\) and produces length \(N\).

How can circular convolution match linear convolution?

Zero-pad both sequences so that the circular length satisfies \(N\ge M+L-1\). This prevents wrap-around aliasing and allows circular convolution to reproduce linear convolution values.

Is convolution the same as multiplication?

No. Convolution is not ordinary multiplication of two sequences term by term. It is a sum of shifted products. However, linear convolution is related to polynomial multiplication when sequences are treated as coefficient lists.

Is convolution the same as correlation?

No. Convolution flips one sequence before shifting and summing, while correlation usually measures similarity without the same flip. They are closely related but not identical.

More Sly academy Content

Calculate Your AP Score
Support Us