The following special formulas are vastly used in algebra and calculus, and should be memorized. You can verify each of the formulas by actual multiplication.
  1.   $(A+B)^{2}=A^{2}+2AB+B^{2}$    (Square of a Sum)
  2.   $(A-B)^{2}=A^{2}-2AB+B^{2}$                 (Square of a Difference)
  3.   $(A+B)^{3}=A^{3}+3A^{2}B+3AB^{2}+B^{3}$  (Cube of a Sum)
  4.   $(A-B)^{3}=A^{3}-3A^{2}B+3AB^{2}-B^{3}$  (Cube of a Difference) 

Here $A$ and $B$ represent real numbers, variables, or algebraic expressions.

  • Note than the Square of Difference formula can be obtained if we replace $B$ with $-B$ in the Square of Sum formula. Similarly replacing $B$ with $-B$ in the Cube of Sum formula yields the Cube of Difference formula.


Read more: Expansion of (A ± B)n

In the above formulas, we reviewed the square and cube of the binomial $A+B$. The expansion of $(A+B)^{n}$ for any positive integer $n$ is

\[(A+B)^{n}=A^{n}+{n \choose 1}A^{n-1}B+{n \choose 2}A^{n-2}B+\cdots+{n \choose n-1}AB+B^{n}\]


(A-B)^{n}=A^{n}-{n \choose 1}A^{n-1}B+&\cdots+(-1)^{k}{n \choose k}A^{n-k}B^{k}\\
&+\cdots+(-1)^{n-1}{n \choose n-1}AB^{n-1}+(-1)^{n}B^{n}


\[{n \choose k}=\frac{n!}{k!(n-k)!}\qquad(\text{read  “n choose k”})\]

with $k!=1\times2\times3\times\cdots\times(k-1)\times k.$

For example,

(x+y)^{4} & =x^{4}+{4 \choose 1}x^{3}y+{4 \choose 2}x^{2}y^{2}+{4 \choose 3}x^{3}y+y^{4}\\
& =x^{4}+\frac{4!}{1!\times3!}x^{3}y+\frac{4!}{2!\times2!}x^{2}y^{2}+\frac{4!}{3!\times1!}x^{3}y+y^{4}\\
& =x^{4}+4x^{3}y+6x^{2}y^{2}+4xy^{3}+y^{4}


  5.   $(x+A)(x+B)=x^{2}+(A+B)x+AB$ (Product of two Binomials having a Common Term)
  6.   $(A-B)(A+B)=A^{2}-B^{2}$  (Product of Sum and Difference)
  7.   $(A-B)(A^{2}+AB+B^{2})=A^{3}-B^{3}$ (Difference of Cubes)
  8.   $(A+B)(A^{2}-AB+B^{2})=A^{3}+B^{3}$ (Sum of Cubes) 
The formula for the square or cube of trinomial (=polynomial with three terms) can also be obtained using the Square of a Sum and the Cube of a Sum formulas.
  • $(A+B+C)^2=A^2+B^2+C^2+2AB+2AC+2BC$
  • $(A+B+C)^3=A^3+B^3+C^3+3A^2B+3AB^2+3A^2C+3AC^2+3B^2C+3BC^2$


Example 1

Expand $(3x-5y)^{2}$


Let $A=3x$ and $B=5y$. Then

(3x-5y)^{2} & =(A-B)^{2}\\
& =A^{2}-2AB+B^{2}\\
& =(3x)^{2}-2(3x)(5y)+(5y)^{2}\\
& =9x^{2}-30xy+25y^{2}

Example 2

Simplify $(x-y)(x+y)+y^{2}$


Because (Formula 6)


we have

(x-y)(x+y)+y^{2} & =x^{2}-y^{2}+y^{2}\\
& =x^{2}.

Example 3

Simplify $(x^{3}-2\sqrt{y})(x^{3}+2\sqrt{y})$


Let $A=x^{3}$ and $B=2\sqrt{y}$. Then the above product can be written as $(A-B)(A+B)$. Thus

(x^{3}-2\sqrt{y})(x^{3}+2\sqrt{y}) & =(A-B)(A+B)\\
& =A^{2}-B^{2}\\
& =\left(x^{3}\right)^{2}-(2\sqrt{y})^{2}\\
& =x^{6}-4(\sqrt{y})^{2}\\
& =x^{6}-4y

Note that the above equation has a meaning only when $y>0$.