FOIL, generalized. Multiply each term of the left polynomial by each term of the right — that's the grid. Group cells with the same power of x into like-term buckets, then sum each bucket.
Pick an example or build your own
Left polynomial — P(x)
x2 − 3x + 2
x
x
x
Right polynomial — Q(x)
2x + 5
x
x
0 / 6 cells
P(x) · Q(x) — pairwise products and collection
Left has 3 terms, right has 2 terms. Distributing gives 3 × 2 = 6 pairwise products. Each cell's exponent is the sum of its row and column exponents — that's how products group into like-term buckets.
Six cells and no acronym: every left term meets every right term once, and the degree of the result is the sum of the degrees. Learn more about this product · All presets
Polynomial multiplication — the operation of multiplying two polynomials P(x) and Q(x), producing a new polynomial whose degree is the sum of the degrees of P and Q.
Distributive property — the rule a(b+c)=ab+ac, applied repeatedly to multiply each term of one polynomial by each term of the other.
FOIL — the mnemonic for multiplying two binomials: First, Outer, Inner, Last. A special case of distribution that produces exactly four pairwise products.
Grid method (box method) — a tabular visualization of polynomial multiplication. The terms of P label the rows, the terms of Q label the columns, and each cell holds the product of its row and column terms. Generalizes FOIL to any number of terms.
Like terms — terms that share the same power of x. After distributing, like terms are grouped and their coefficients summed.
Degree of a product — equals the degree of P plus the degree of Q. A trinomial times a binomial yields a polynomial of degree (2 + 1) = 3, for example.
Getting Started
The tool opens with the polynomial pair (x2−3x+2)(2x+5) loaded by default. The layout is split into two cards side by side:
• A left card with preset buttons, two polynomial editors for P(x) and Q(x), and animation controls.
• A right card showing the multiplication grid, the like-term buckets below it, and the final result box.
To explore:
• Click any preset to load a curated example.
• Edit the coefficients and exponents directly in the term rows.
• Add or remove terms with the + add term button and the small × per row.
• Press Step ▶ to fill one grid cell at a time, or Auto-expand to play through all cells continuously.
The status badge at the bottom of the left card tracks progress as k/N cells filled, where N is the total number of pairwise products to compute.
Entering the Polynomials
Two polynomial editors sit in the left card, one for P(x) and one for Q(x). Each editor has three parts:
• A live display at the top showing the polynomial in standard form, with terms sorted by descending exponent and signs handled correctly.
• A list of term rows, one per term. Each row has a coefficient input (any integer or decimal between −9999 and 9999), the literal x, an exponent input (an integer between 0 and 12), and a remove button.
• An + add term button to append another term, up to a maximum of 6 terms per polynomial.
A few mechanics worth knowing:
• Editing any input updates the grid and result instantly. There is no apply button.
• The remove button is disabled when only one term remains — every polynomial must have at least one term.
• Total grid size is capped at 36 cells. A 6×6 product is the largest configuration; anything larger triggers a validation error.
• Coefficients of zero are dropped from the grid silently. All zeros in a polynomial produces a validation error.
Presets
Five preset products demonstrate different sizes and structures:
• (x+2)(x+3) — the canonical FOIL: binomial times binomial, a 2×2 grid with four cells.
• (2x−1)(x+4) — binomial times binomial with a negative coefficient, useful for seeing sign handling.
• (x+1)(x2−x+1) — binomial times trinomial, a 2×3 grid. Note the famous result: this product equals x3+1 — the sum of cubes.
• (2x2+x−3)(x2−2x+1) — trinomial times trinomial, a 3×3 grid with nine cells. The most complex preset.
Click any preset to load it; the editors, grid, buckets, and result all refresh immediately.
The Canonical FOIL
(x+2)(x+3), frozen with all four cells delivered: a 2×2 grid whose cells read x2, 3x, 2x, 6, three like-term buckets, and the result x2+5x+6.
(x + 2)(x + 3), frozen at completion
FOIL as territory rather than tour: four cells, and the two middle ones merging in the amber bucket to 5x.
This is the product every algebra student meets first, and the grid explains the FOIL acronym better than the acronym does: First, Outer, Inner, Last are simply the four cells of a 2×2 grid, visited in row-major order. The mnemonic is a tour route; the grid is the territory.
The frozen buckets show the one interesting event: the two middle cells 3x and 2x land in the same amber bucket and merge to 5x. Every like-term collection in every larger product is this event repeated — which is why the tool colors cells by exponent rather than by position.
Sign Handling
(2x−1)(x+4), frozen at completion: four cells again, but one row carries the negative term, and the bucket arithmetic must subtract — the x bucket collects 8−1=7.
(2x − 1)(x + 4), frozen at completion
Signs decided cell by cell: the bottom row carries the minuses, and the x bucket adds 8 − 1 = 7.
Negative coefficients are where hand multiplication usually goes wrong, and the grid localizes the danger: each cell's sign is decided once, at the cell, by the ordinary rule of signs (−1⋅4=−4), and the buckets then merely add signed numbers. Two error-prone operations become two separate, simpler ones.
The frozen frame keeps the evidence visible: the bottom row's cells carry the minus signs of the −1 term, and the bucket contributions show +8 and −1 arriving as separate deliveries before summing to the final 7x. The result: 2x2+7x−4.
Trinomial Times Binomial
The default load: (x2−3x+2)(2x+5), frozen with all six cells delivered in a 3×2 grid, four buckets, and the result 2x3−x2−11x+10.
(x² − 3x + 2)(2x + 5), frozen at completion
Six cells, four buckets, no acronym — the grid principle scaling where FOIL cannot.
Six cells is where FOIL-the-mnemonic dies — there is no acronym for 3×2 — and the grid principle takes over undamaged: every term of the left meets every term of the right, once. The cell count is always the product of the term counts, so the bookkeeping scales multiplicatively while the rule stays constant.
The four buckets illustrate the other scaling law: the result's degree is the sum of the factors' degrees (2+1=3), and every exponent from 3 down to 0 is hit. Both middle buckets require genuine arithmetic (5−6=−1 for x2; −15+4=−11 for x) — collection is no longer optional the way it nearly is in the FOIL frame.
The Sum of Cubes
(x+1)(x2−x+1), frozen at completion — and the buckets steal the show: the x2 bucket collects −1+1=0, the x bucket collects 1−1=0, and the result collapses to x3+1.
(x + 1)(x² − x + 1), frozen at completion
Four of six cells annihilate: both middle buckets sum to zero, and x³ + 1 emerges — the sum-of-cubes identity, verified.
This preset freezes a factoring identity being verified in public: (x+1)(x2−x+1)=x3+1, the sum-of-cubes pattern. Six cells are delivered, but four of them exist only to annihilate each other — the frozen buckets display the cancellation as visibly empty sums rather than as algebraic sleight of hand.
Cancellation is the phenomenon that makes special products special: the second factor is engineered so its cross-terms exactly oppose the first factor's contributions. Seen in the grid, the identity stops being a formula to memorize and becomes a pattern of paired cells — the same mechanism behind the difference of squares and the telescoping products of higher factoring identities.
Trinomial Times Trinomial
The heavyweight: (2x2+x−3)(x2−2x+1), frozen with all nine cells delivered, five buckets from x4 down to the constants, and the result 2x4−3x3−3x2+7x−3.
(2x² + x − 3)(x² − 2x + 1), frozen at completion
Nine cells, five buckets, and equal exponents striping the anti-diagonals — convolution made visible.
Nine cells is roughly the practical limit of by-hand multiplication, and the frozen frame shows why the grid remains calm where vertical multiplication gets crowded: every product has a pre-assigned cell, every cell a pre-assigned bucket, and nothing depends on keeping running totals in your head. The x2 bucket alone collects three contributions (2−2−3=−3) — the kind of triple merge that produces most hand-calculation errors.
The five colors of the frozen grid also make a structural point: cells of equal exponent lie along the grid's anti-diagonals. That diagonal striping is not a coincidence of this preset — it is the convolution structure of polynomial multiplication, the same pattern that makes long multiplication of numbers carry along diagonals.
The Multiplication Grid
The right-card grid is the visual centerpiece. Each row corresponds to one term of P(x) (sorted by descending exponent); each column corresponds to one term of Q(x) (also sorted). The cell at row i, column j holds the product of those two terms.
The fundamental rule: each cell's exponent equals the sum of its row exponent and its column exponent. So x2⋅x=x3, x⋅x=x2, x⋅1=x, and so on. Cells with the same total exponent share a color, drawn from a palette that distinguishes constants, x, x2, x3, and higher powers at a glance.
Cells fill in left-to-right, top-to-bottom as the animation runs. Three visual states:
• Empty cells — outlined in light gray, showing the product symbolically without color.
• Hot cell — the cell just delivered. Briefly scaled up with a blue glow ring for about 360 ms.
• Collected cells — fully colored according to their exponent. Cells with the same color belong to the same like-term bucket below.
The Like-Term Buckets
Below the grid sits a row of buckets, one per distinct exponent that appears in any product. Each bucket collects all the cells that produce the same power of x.
A bucket displays three things:
• A header naming the like-term group: constants, x terms, *x² terms*, *x³ terms*, and so on, with the exponent value shown on the right.
• A contributions row listing the signed coefficients delivered to this bucket so far, in the order they arrived (for example, *− 6 + 2*).
• A sum line showing the running total: the combined coefficient times the appropriate power of x.
Each time a cell delivers, the matching bucket briefly highlights to show where the contribution went. By the time all cells fill, each bucket holds the final coefficient for that power of x. Reading the buckets from highest exponent to lowest reconstructs the product polynomial term by term.
Animation Controls
Three buttons drive the animation at the bottom of the left card:
• Step ▶ — deliver one grid cell. Useful for walking through the multiplication slowly and reading off each product as it lands.
• Auto-expand / ⏸ Pause / Replay — the primary play button. Starts continuous play at about 480 ms per cell; pauses if already playing; restarts from the beginning if all cells are already delivered.
• ↺ Reset — clear the grid and buckets, return to step 0, without changing the polynomials.
Two pieces of feedback help track progress:
• The status text on the right of the control bar reads k/N cells, where N is the total cell count for the current grid.
• If the polynomials are invalid (no non-zero terms, too many terms, grid too big), a red error message replaces the status and the action buttons disable.
Any edit to the polynomials, or selecting a different preset, automatically stops play and resets the animation.
The Final Result
Below the buckets, a blue gradient Result box shows the final product P(x)⋅Q(x) as a fully simplified polynomial. The box is faded with the label *Result (pending)* while cells are still being delivered, and activates at full opacity once every cell is filled.
The polynomial in the box comes from combining the bucket sums:
• Read each bucket's sum (its coefficient).
• Pair each coefficient with its bucket's power of x.
• Sort by descending exponent and write out with signs.
The result is the canonical form of the product. For a quick check on small examples like the default (x2−3x+2)(2x+5)=2x3−x2−11x+10, you can verify by FOIL-style hand calculation. For larger products like the 3×3 trinomial-times-trinomial case, the tool does the bookkeeping so you can focus on the structure.
What Is Polynomial Multiplication
Polynomial multiplication is the operation that takes two polynomials P(x) and Q(x) and returns their product P(x)⋅Q(x), another polynomial. The recipe comes directly from the distributive property: multiply every term of P by every term of Q, then collect like terms.
If P has m terms and Q has n terms, distribution produces m⋅n individual products. Some of those products land on the same power of x, so the final result usually has fewer than m⋅n terms after collection. The degree of the product equals the degree of P plus the degree of Q.
The most common manual technique for two binomials is FOIL (First, Outer, Inner, Last) — but FOIL is just a labelled walkthrough of the four products in a 2×2 distribution. The grid method generalizes this to any size: an m×n rectangular table where each cell holds one pairwise product.
For more on polynomial operations, see the polynomial multiplication section in the algebra theory pages.
FOIL Generalized
FOIL stands for First, Outer, Inner, Last and labels the four products that appear when multiplying two binomials (a+b)(c+d):
• First: a⋅c
• Outer: a⋅d
• Inner: b⋅c
• Last: b⋅d
The product is ac+ad+bc+bd. The grid method makes the structure visible: a 2×2 table with a,b down the side and c,d across the top. Each of the four cells contains one of the four FOIL products.
The grid generalizes effortlessly to longer polynomials. A trinomial times a binomial fills a 3×2 grid with six products. A trinomial times a trinomial fills a 3×3 grid with nine. The same rule applies in every cell: multiply the coefficients, add the exponents.
After the grid fills, the like-term collection step groups cells whose exponents match and sums their coefficients. This is where the product polynomial usually simplifies — a 3×3=9-cell product typically collapses to 5 terms (degrees 0 through 4) once like terms combine.
Related Concepts
Distributive property — the algebraic law a(b+c)=ab+ac. Polynomial multiplication is repeated distribution.
Polynomial addition and subtraction — combine like terms across two polynomials. The companion operations to multiplication.
Polynomial division — long division or synthetic division. The inverse operation of multiplication.
Binomial theorem — gives the expansion of (a+b)n directly using binomial coefficients. A shortcut when one of the polynomials is a power.
Completing the square — uses controlled polynomial manipulation to rewrite a quadratic in vertex form.
Special products — recognizable patterns like (a+b)2=a2+2ab+b2, (a−b)2=a2−2ab+b2, and (a+b)(a−b)=a2−b2. Worth memorizing because they appear constantly.
Algebra calculator — for symbolic manipulation beyond what fits in a 36-cell grid, see the dedicated polynomial multiplication calculator in the algebra calculators section.