Skip to content

FOIL Calculator

Expand (ax + b)(cx + d) with the First, Outer, Inner, Last steps, multiply any two polynomials, and spot perfect squares, difference of squares and cubes.

Calculator Details

Expanded:2x² − 5x − 12See results ↓

A × B, or A squared, or A cubed

A binomial such as 2x + 3, or any polynomial (x, y and other single letters)

For example x - 4 or 3y + 1/2

Your Results

Expanded: 2x² − 5x − 12

Expanded

2x² − 5x − 12

(2x + 3)(x − 4)

Terms

3

After combining like terms

Degree

2

Pattern

FOIL

Two binomials

(2x + 3)(x − 4) = 2x² − 5x − 12, with 3 terms after combining like terms.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

FOIL: First, Outer, Inner, Last
StepTerm of ATerm of BProduct
First2xx2x²
Outer2x−4−8x
Inner3x3x
Last3−4−12
Combine like terms
Like terms inProductsCombined
x−8x + 3x−5x

How This Calculator Works

How it's calculated

(a + b)(c + d) = ac + ad + bc + bd (First, Outer, Inner, Last)

Your numbers: 2x² − 8x + 3x − 12, which combines to 2x² − 5x − 12. Coefficients are multiplied as exact fractions, so nothing is rounded.

Frequently Asked Questions

What does FOIL stand for?

First, Outer, Inner, Last: the four products you get when multiplying two binomials. In (2x + 3)(x − 4): First 2x · x = 2x², Outer 2x · (−4) = −8x, Inner 3 · x = 3x, Last 3 · (−4) = −12. Add them and combine like terms: 2x² − 5x − 12.

Does FOIL work for trinomials?

No, FOIL is only a memory aid for two binomials. For longer polynomials, multiply every term of the first by every term of the second (the distributive property) and combine like terms. (x² + 2x − 1)(x + 3) has 3 × 2 = 6 products and simplifies to x³ + 5x² + 5x − 3.

What is a perfect square trinomial?

The square of a binomial: (a + b)² = a² + 2ab + b² and (a − b)² = a² − 2ab + b². For (3x − 5)²: (3x)² = 9x², 2 · 3x · 5 = 30x, and 5² = 25, giving 9x² − 30x + 25. A common mistake is writing just 9x² + 25 and forgetting the middle term.

Why does the middle term disappear in a difference of squares?

In (a + b)(a − b) the outer product is −ab and the inner product is +ab, so they cancel, leaving a² − b². (5m − 9)(5m + 9) = 25m² − 45m + 45m − 81 = 25m² − 81.

How do I expand a binomial cubed?

Square it first, then multiply by the binomial again, or use the pattern (a + b)³ = a³ + 3a²b + 3ab² + b³. (x + 2)³ = x³ + 3 · x² · 2 + 3 · x · 4 + 8 = x³ + 6x² + 12x + 8. The coefficients 1, 3, 3, 1 come from Pascal’s triangle.

Can I use two variables, like (2x + 3y)(x − y)?

Yes. Any single letter is a variable. The four products are 2x², −2xy, 3xy and −3y², and the xy terms combine to give 2x² + xy − 3y². Terms with the same letters to the same powers are like terms; x²y and xy² are not.

How do I type exponents and fractions?

Use ^ for powers (x^2 for x²), / for fractions (x/2 or 1/3) and a decimal point for decimals (0.5x). Multiplication can be implied (2x, 3xy) or written with *. You can also put brackets inside a factor, such as (x + 1)^2 as factor A.

How do I go back from the expanded form to the factors?

That is factoring. For a quadratic like 2x² − 5x − 12, find two numbers that multiply to 2 × (−12) = −24 and add to −5 (−8 and 3), or solve 2x² − 5x − 12 = 0 with the equation solver: the roots 4 and −3/2 give the factors (x − 4) and (2x + 3).

Polynomials are multiplied term by term with exact fractions (OpenStax Elementary Algebra 2e §6.3–6.4); FOIL labels are shown when both factors are binomials, and perfect squares, differences of squares and binomial cubes are named. Single-letter variables, whole-number powers up to 12 and division by numbers only. Not included: factoring (see the equation solver), negative or fractional exponents, division by polynomials (see synthetic division) and powers above the cube.

FOIL Calculator: Multiply Binomials Step by Step

By FindMySum · Last reviewed

A FOIL calculator expands a product of two binomials and shows the four products that make it up, then combines the like terms. FOIL stands for First, Outer, Inner, Last, a memory aid for the distributive property when both factors have two terms. This calculator also multiplies longer polynomials term by term, handles two variables such as (2x + 3y)(x − y), squares and cubes a binomial, and names the special products (perfect square, difference of squares, binomial cube) when it sees them. The worked example uses the default: (2x + 3)(x − 4).

FOIL step by step

Multiply each term of the first binomial by each term of the second, in this order:

  • First: the first terms, 2x × x = 2x²
  • Outer: the outside terms, 2x × (−4) = −8x
  • Inner: the inside terms, 3 × x = 3x
  • Last: the last terms, 3 × (−4) = −12

Add the four products: 2x² − 8x + 3x − 12. The outer and inner products are like terms, so combine them: −8x + 3x = −5x. The answer is 2x² − 5x − 12.

The order doesn't change the answer. FOIL just makes sure none of the four products is missed. The calculator lists them in a table, labelled, with the like terms combined in a second table.

Why FOIL works

FOIL is the distributive property used twice. (2x + 3)(x − 4) means 2x(x − 4) + 3(x − 4). Distributing each part gives 2x² − 8x and 3x − 12, the same four products. Thinking of it this way makes it clear what to do with a trinomial or anything longer: multiply every term of the first factor by every term of the second. For (x² + 2x − 1)(x + 3) that is 3 × 2 = 6 products:

×x+3
x²x³3x²
2x2x²6x
−1−x−3

Adding the boxes and combining like terms gives x³ + 5x² + 5x − 3. This grid is the box or area model; for two binomials its four boxes are exactly First, Outer, Inner and Last.

Special products worth recognising

Three patterns come up so often that it pays to know them by sight:

Perfect square: (a + b)² = a² + 2ab + b², and (a − b)² = a² − 2ab + b². For (3x − 5)², a = 3x and b = 5: 9x² − 30x + 25. The middle term, twice the product, is the one people forget; (3x − 5)² is not 9x² + 25.

Difference of squares (conjugates): (a + b)(a − b) = a² − b². In (5m − 9)(5m + 9) the outer product is 5m × 9 = 45m and the inner product is −9 × 5m = −45m, so they cancel, leaving 25m² − 81. Recognising the pattern lets you skip straight to the answer, and reading it backwards is how you factor x² − 49 = (x + 7)(x − 7).

Binomial cube: (a + b)³ = a³ + 3a²b + 3ab² + b³. For (x + 2)³: x³ + 3(x²)(2) + 3(x)(4) + 8 = x³ + 6x² + 12x + 8. The calculator also shows the route through the square: (x + 2)² = x² + 4x + 4, then (x² + 4x + 4)(x + 2).

Two variables, fractions and decimals

Any letter can be a variable. (2x + 3y)(x − y) gives First 2x², Outer −2xy, Inner 3xy and Last −3y²; the xy terms combine to xy, so the answer is 2x² + xy − 3y².

Fractions and decimals work too, and are kept exact. (x/2 + 1/3)(x − 1/3) = x²/2 − x/6 + x/3 − 1/9 = (1/2)x² + (1/6)x − 1/9. When you type decimals, the answer is shown in decimals: (0.5x + 1.5)(2x − 4) = x² + x − 6.

Checking an expansion

Two quick checks catch most mistakes:

  • Substitute a number. Put x = 1 into both sides: (2 + 3)(1 − 4) = −15, and 2 − 5 − 12 = −15. If the two differ, something is wrong. Try a second value such as x = 2 to be sure.
  • Count the terms. Two binomials give four products before combining; a trinomial times a binomial gives six. If you have fewer, a product is missing.

Expanding is also the way to check a factoring answer: if you factor 2x² − 5x − 12 as (2x + 3)(x − 4), FOIL should take you straight back.

More questions

Is FOIL still taught in schools?

Many teachers now teach the distributive property or the box (area) method first, because FOIL only works for two binomials and students who learn it as a rule can get stuck on trinomials. FOIL remains a useful check that you have all four products, and it appears in most algebra textbooks.

What is the box method for multiplying polynomials?

Draw a grid with one row for each term of one factor and one column for each term of the other. Write each product in its box, then add the boxes, combining like terms. For two binomials the four boxes are exactly the First, Outer, Inner and Last products.

What are like terms?

Terms with the same variables raised to the same powers, such as −8x and 3x, or 2xy and −5xy. Only their coefficients are added: −8x + 3x = −5x. x² and x are not like terms, so 2x² − 5x cannot be simplified further.

Why do signs cause so many mistakes in FOIL?

Each term carries its sign. In (2x + 3)(x − 4) the second term of the second factor is −4, so the outer product is 2x × (−4) = −8x, not +8x. Writing each factor with its signs attached, as + 3 and − 4, before multiplying avoids most sign errors.

Where is multiplying binomials used outside math class?

Area problems are the classic case: a garden x metres long and x − 2 metres wide, with a 1 m path around it, has an outside area of (x + 2)(x) = x² + 2x. The same expansions appear in physics formulas, compound interest over two periods and probability.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy