# FOIL method

A visual representation of the FOIL rule. Each colored line represents two terms that must be multiplied.

In elementary algebra, FOIL is a mnemonic for the standard method of multiplying two binomials—hence the method may be referred to as the FOIL method. The word FOIL is an acronym for the four terms of the product:

• First ("first" terms of each binomial are multiplied together)
• Outer ("outside" terms are multiplied—that is, the first term of the first binomial and the second term of the second)
• Inner ("inside" terms are multiplied—second term of the first binomial and first term of the second)
• Last ("last" terms of each binomial are multiplied)

The general form is:

$(a+b)(c+d) = \underbrace{ac}_\mathrm{first} + \underbrace{ad}_\mathrm{outside} + \underbrace{bc}_\mathrm{inside} + \underbrace{bd}_\mathrm{last}$

Note that $a$ is both a "first" term and an "outer" term; $b$ is both a "last" and "inner" term, and so forth. The order of the four terms in the sum is not important, and need not match the order of the letters in the word FOIL.

The FOIL method is a special case of a more general method for multiplying algebraic expressions using the distributive law. The word FOIL was originally intended solely as a mnemonic for high-school students learning algebra, but many students and educators in the United States now use the word "foil" as a verb meaning "to expand the product of two binomials".[citation needed] This neologism has not gained widespread acceptance in the mathematical community.[citation needed]

## Examples

The FOIL method is most commonly used to multiply linear binomials. For example,

\begin{align} (x + 3)(x + 5) \,&=\, x\cdot x \,+\, x\cdot 5 \,+\, 3 \cdot x \,+\, 3 \cdot 5 \\ &=\, x^2 + 5x + 3x + 15 \\ &=\, x^2 + 8x + 15 \end{align}

If either binomial involves subtraction, the corresponding terms must be negated. For example,

\begin{align} (2x-3)(3x-4) &= (2x)(3x)+(2x)(-4)+(-3)(3x)+(-3)(-4) \\ &= 6x^2 - 8x - 9x + 12 \\ &= 6x^2 - 17x + 12 \end{align}

## The distributive law

The FOIL method is equivalent to a two-step process involving the distributive law:

\begin{align} (a+b)(c+d) &{} = a(c+d) + b(c+d) \\ &{}= ac + ad + bc + bd \end{align}

In the first step, the $(c+d)$ is distributed over the addition in first binomial. In the second step, the distributive law is used to simplify each of the two terms. Note that this process involves a total of three applications of the distributive property.

## Reverse FOIL

The FOIL rule converts a product of two binomials into a sum of four (or fewer, if like terms are then combined) monomials. The reverse process is called factoring or factorization. In particular, if the proof above is read in reverse it illustrates the technique called factoring by grouping.

## Table as an alternative to FOIL

A visual memory tool can replace the FOIL mnemonic for a pair of polynomials with any number of terms. Make a table with the terms of the first polynomial on the left edge and the terms of the second on the top edge, then fill in the table with products. The table equivalent to the FOIL rule looks like this.

$\begin{matrix} \times & c & d \\ a & ac & ad \\ b & bc & bd \end{matrix}$

In the case that these are polynomials, $(ax+b)(cx+d),$ the terms of a given degree are found by adding along the antidiagonals

$\begin{matrix} \times & cx & d \\ ax & acx^2 & adx \\ b & bcx & bd \end{matrix}$

so $(ax+b)(cx+d) = acx^2 + (ad+bc)x + bd.$

To multiply (a+b+c)(w+x+y+z), the table would be as follows.

$\begin{matrix} \times & w & x & y & z \\ a & aw & ax & ay & az \\ b & bw & bx & by & bz \\ c & cw & cx & cy & cz \end{matrix}$

The sum of the table entries is the product of the polynomials. Thus

\begin{align} (a+b+c)(w+x+y+z) = {} & aw + ax + ay + az \\ & {} + bw + bx + by + bz \\ & {} + cw + cx + cy + cz . \end{align}

Similarly, to multiply $(ax^2+bx+c)(dx^3+ex^2+fx+g),$ one writes the same table

$\begin{matrix} \times & d & e & f & g \\ a & ad & ae & af & ag \\ b & bd & be & bf & bg \\ c & cd & ce & cf & cg \end{matrix}$

and sums along antidiagonals:

\begin{align}(ax^2&+bx+c)(dx^3+ex^2+fx+g)\\ &= adx^5 + (ae+bd)x^4 + (af+be+cd)x^3 + (ag+bf+ce)x^2+(bg+cf)x+cg.\end{align}

## Generalizations

The FOIL rule cannot be directly applied to expanding products with more than two multiplicands, or multiplicands with more than two summands. However, applying the associative law and recursive foiling allows one to expand such products. For instance,

\begin{align}(a+b+c+d)(x+y+z+w)=&\,((a+b)+(c+d))((x+y)+(z+w)) \\ =&\,(a+b)(x+y)+(a+b)(z+w) \\ &\,{}+(c+d)(x+y)+(c+d)(z+w) \\ =&\,ax+ay+bx+by+az+aw+bz+bw \\ &\,{}+cx+cy+dx+dy+cz+cw+dz+dw. \end{align}

Alternate methods based on distributing forgo the use of the FOIL rule, but may be easier to remember and apply. For example,

\begin{align} (a+b+c+d)(x+y+z+w)&=(a+(b+c+d))(x+y+z+w) \\ &=a(x+y+z+w)+(b+c+d)(x+y+z+w) \\ &=a(x+y+z+w)+(b+(c+d))(x+y+z+w) \\ &=a(x+y+z+w)+b(x+y+z+w) \\ &\qquad +(c+d)(x+y+z+w) \\ &=a(x+y+z+w)+b(x+y+z+w) \\ &\qquad +c(x+y+z+w)+d(x+y+z+w) \\ &=ax+ay+az+aw+bx+by+bz+bw \\ &\qquad +cx+cy+cz+cw+dx+dy+dz+dw. \end{align}