Convolution Calculator
Our free sequences calculator solves convolution problems. Get worked examples, visual aids, and downloadable results.
Calculator
Adjust values & calculateStep-by-Step Computation
Formula
For each output position n, the convolution sums the products of overlapping elements from sequence a and the reversed, shifted sequence b. The output length equals len(a) + len(b) - 1. This operation is equivalent to polynomial multiplication when sequences represent polynomial coefficients.
Last reviewed: December 2025
Worked Examples
Example 1: Moving Average Filter
Example 2: Polynomial Multiplication
Background & Theory
The Convolution Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.
History
The history behind the Convolution Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.
Frequently Asked Questions
Formula
(a*b)[n] = Sum of a[k] x b[n-k] for all valid k
For each output position n, the convolution sums the products of overlapping elements from sequence a and the reversed, shifted sequence b. The output length equals len(a) + len(b) - 1. This operation is equivalent to polynomial multiplication when sequences represent polynomial coefficients.
Worked Examples
Example 1: Moving Average Filter
Problem: Convolve the signal [2, 4, 6, 8, 10] with the averaging kernel [1/3, 1/3, 1/3] to smooth the signal.
Solution: Signal a = [2, 4, 6, 8, 10], Kernel b = [0.333, 0.333, 0.333]\nOutput length = 5 + 3 - 1 = 7\ny[0] = 2 x 0.333 = 0.667\ny[1] = 2 x 0.333 + 4 x 0.333 = 2.000\ny[2] = 2 x 0.333 + 4 x 0.333 + 6 x 0.333 = 4.000\ny[3] = 4 x 0.333 + 6 x 0.333 + 8 x 0.333 = 6.000\ny[4] = 6 x 0.333 + 8 x 0.333 + 10 x 0.333 = 8.000\ny[5] = 8 x 0.333 + 10 x 0.333 = 6.000\ny[6] = 10 x 0.333 = 3.333
Result: Output: [0.667, 2.000, 4.000, 6.000, 8.000, 6.000, 3.333]
Example 2: Polynomial Multiplication
Problem: Multiply (1 + 2x + 3x^2) by (1 + x) using convolution of coefficients [1,2,3] and [1,1].
Solution: a = [1, 2, 3] (coefficients of 1 + 2x + 3x^2)\nb = [1, 1] (coefficients of 1 + x)\nOutput length = 3 + 2 - 1 = 4\ny[0] = 1 x 1 = 1\ny[1] = 1 x 1 + 2 x 1 = 3\ny[2] = 2 x 1 + 3 x 1 = 5\ny[3] = 3 x 1 = 3\nResult polynomial: 1 + 3x + 5x^2 + 3x^3
Result: Convolution: [1, 3, 5, 3] = polynomial 1 + 3x + 5x^2 + 3x^3
Frequently Asked Questions
What is convolution and what does it represent mathematically?
Convolution is a mathematical operation that combines two sequences (or functions) to produce a third sequence expressing how the shape of one is modified by the other. For discrete sequences, the convolution of a[n] and b[n] is defined as (a*b)[n] = sum of a[k] x b[n-k] for all valid k. Intuitively, convolution slides one sequence across the other, multiplying overlapping elements and summing the products at each position. It measures the overlap between one function and a reversed, shifted copy of another. Convolution is commutative (a*b = b*a), associative, and distributive over addition, making it algebraically well-behaved.
How is discrete convolution computed step by step?
Discrete convolution follows a systematic slide-multiply-sum process. Given sequences a = [a0, a1, ..., am] and b = [b0, b1, ..., bn], the output has length m+n+1. For each output index k, reverse sequence b, shift it by k positions, multiply element-wise with a where they overlap, and sum all products. At position k=0, only a[0]*b[0] contributes. At position k=1, both a[0]*b[1] and a[1]*b[0] contribute. This continues until the final position where only the last elements overlap. The process is equivalent to polynomial multiplication when sequences represent polynomial coefficients.
What is the relationship between convolution and polynomial multiplication?
Convolution of two sequences is mathematically identical to multiplying two polynomials whose coefficients are those sequences. If a = [1, 2, 3] represents the polynomial 1 + 2x + 3x^2, and b = [1, 1] represents 1 + x, then their convolution [1, 3, 5, 3] represents the product polynomial 1 + 3x + 5x^2 + 3x^3. This connection makes convolution fundamental in algebra and computer science. The Fast Fourier Transform (FFT) exploits this relationship by converting sequences to frequency domain representations where convolution becomes simple element-wise multiplication, reducing complexity from O(n^2) to O(n log n).
How is convolution used in signal processing?
In signal processing, convolution is the fundamental operation for applying filters to signals. When a digital signal passes through a Linear Time-Invariant (LTI) system, the output equals the convolution of the input signal with the system impulse response. Low-pass filters smooth signals by convolving with averaging kernels like [1,1,1]/3. High-pass filters detect edges by convolving with difference kernels like [-1,2,-1]. Audio effects like reverb simulate room acoustics by convolving dry audio with a recorded room impulse response. Equalization, noise reduction, and echo cancellation all rely on convolution operations.
What is the convolution theorem and why is it important?
The convolution theorem states that convolution in the time domain equals multiplication in the frequency domain, and vice versa. Mathematically: FFT(a*b) = FFT(a) x FFT(b), where FFT is the Fourier Transform and x represents element-wise multiplication. This theorem is enormously important because direct convolution requires O(n^2) operations, while FFT-based convolution requires only O(n log n) operations. For large signals, this speedup is dramatic. A convolution of two signals with 1 million samples each would take roughly 10^12 operations directly but only about 4 x 10^7 operations using FFT, a speedup factor of about 25,000.
How does convolution work in image processing and convolutional neural networks?
In image processing, 2D convolution slides a small kernel (filter matrix) across an image, computing weighted sums at each position. Common kernels include blur (averaging nearby pixels), sharpen (emphasizing center pixel), edge detection (Sobel, Prewitt operators), and emboss filters. Convolutional Neural Networks (CNNs) learn optimal kernel values from training data rather than using hand-designed filters. A CNN might have dozens of layers, each with multiple learned kernels that detect progressively more abstract features, from edges and textures in early layers to complex shapes and objects in deeper layers. This hierarchical feature learning makes CNNs exceptionally powerful for image recognition.
References
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy