# Difference Of Squares

The **difference of two squares** identity is a squared number subtracted from another squared number to get factorized in the form of

\[a^2-b^2=(a+b)(a-b).\]

We will also prove this identity by multiplying polynomials on the left side and getting equal to the right side. This identity is often used in algebra where it is useful in applications to integer factorization, the quadratic sieve, the algebraic factorization, etc.

## Identity

The difference of two squares identity is \((a+b)(a-b)=a^2-b^2\). We can prove this identity by multiplying the expressions on the left side and getting equal to the right side expression. Here is the proof of this identity.

Let's begin with the left side of the expression. We have

\[ \begin{align} (a+b)(a-b) &= a(a-b) + b(a-b) \\ &= a^2 - ab + ab - b^2 \\ & = a^2 - b^2, \end{align} \]

which is equal to the right side of the identity. Hence proved. \(_\square\)

## Example Problems

This section contains examples and problems to boost understanding in the usage of the difference of squares identity: \(a^2-b^2=(a+b)(a-b)\).

Here are the examples to learn the usage of the identity.

Rewrite \(5^2-2^2\) as a product.

We have

\[5^2-2^2 = (5-2) \times (5+2) = 3\times 7. \ _\square\]

Calculate \(299\times 301\).

You can brute force the answer to this problem by using a calculator, but we have a sweeter way. We can apply the difference of two squares identity.

At first we may think about using the long multiplication method, but it wastes time and is, of course, boring. Notice that \(299=300-1\) and \(301=300+1\), so

\[\begin{align*}299\times 301&=(300-1)(300+1)\\&=300^2-1^2\\&=89999. \ _\square \end{align*}\]

Show that any odd number can be written as the difference of two squares.

Let the odd number be \( n = 2b + 1 \), where \(b\) is a non-negative integer. Then we have

\[ n = 2b+1 = [ (b+1) + b ] [ (b+1) - b ] = (b+1)^2 - b^2. \ _\square\]

What is

\[234567^2-234557\times 234577\ ?\]

Using the same method as the example above,

\[\begin{align*} 234567^2-234557\times 234577&=234567^2-\big(234567^2-10^2\big)\\ &=234567^2-234567^2+10^2\\ &=100.\ _\square \end{align*}\]

Solve the following problems:

## Further Extension

Since the two factors are different by \(2b\), the factors will always have the same parity. That is, if \(a-b\) is even then \(a+b\) must also be even, so the product is divisible by four. Or neither are divisible by 2, so the product is odd. This implies that numbers which are multiple of 2 but not 4 cannot be expressed as the difference of 2 squares.

The

**product of two differences of two squares is itself a difference of two squares**in two different ways:

\[\begin{array} { l l l } \left(a^2-b^2\right)\left(c^2-d^2\right) &= (ac)^2-(ad)^2-(bc)^2+(bd)^2 \\ &= (ac)^2-(ad)^2-(bc)^2+(bd)^2+2abcd-2abcd \\ &= (ac)^2+2abcd+(bd)^2-\left[(ad)^2+2abcd+(bd)^2\right] &= (ac+bd)^2 - (ad+bc)^2 \\ &= (ac)^2-2abcd+(bd)^2-\left[(ad)^2-2abcd+(bd)^2\right] &= (ac-bd)^2 - (ad-bc)^2. \\ \end{array}\]

## Problem Solving

The examples and problems in this sections are a bit harder for enhancing the problem solving skills. Let's give them a try.

Here are the examples to go through.

Simplify

\[\left(1-\frac{1}{2^2}\right)\left(1-\frac{1}{3^2}\right)\left(1-\frac{1}{4^2}\right)\cdots\left(1-\frac{1}{n^2}\right).\]

This is a very direct application of the identity mentioned in this text. We have

\[\begin{align*} \left(1-\frac{1}{2^2}\right)\left(1-\frac{1}{3^2}\right)\cdots\left(1-\frac{1}{n^2}\right) &=\left(1-\frac{1}{2}\right)\left(1+\frac{1}{2}\right)\left(1-\frac{1}{3}\right)\left(1+\frac{1}{3}\right)\cdots\left(1-\frac{1}{n}\right)\left(1+\frac{1}{n}\right)\\ &=\frac{1}{2}\cdot\frac{3}{2}\cdot\frac{2}{3}\cdot\frac{4}{3}\cdots\frac{n-1}{n}\cdot\frac{n+1}{n}. \end{align*}\]

Notice that the product from the second term to the \((n-1)^\text{th}\) term is equal to 1, and therefore the final product is \(\frac{n+1}{2n}\). \(_\square\)

Simplify \(\left(\sqrt5+\sqrt6+\sqrt7\right)\left(\sqrt5+\sqrt6-\sqrt7\right)\left(\sqrt5-\sqrt6+\sqrt7\right)\left(-\sqrt5+\sqrt6+\sqrt7\right).\)

We may choose to expand it out, but that is time intensive and very error prone. Let's have the identity tackle this problem. We have

\[\begin{align*}\big(\sqrt5+\sqrt6+\sqrt7\big)\big(\sqrt5+\sqrt6-\sqrt7\big)&=\big(\sqrt5+\sqrt6\big)^2-\big(\sqrt7\big)^2\\&=5+6+2\sqrt{30}-7\\&=4+2\sqrt{30}.\end{align*}\]

Likewise, the product of the last two terms is

\[ \begin{align} \big(\sqrt5-\sqrt6+\sqrt7\big)\big(-\sqrt5+\sqrt6+\sqrt7\big) &= \left(\sqrt7+\big(\sqrt5-\sqrt6\big)\right)\left(\sqrt7-\big(\sqrt5-\sqrt6\big)\right) \\ &=-4+2\sqrt{30}. \end{align} \]

The final product is \(\left(4+2\sqrt{30}\right)\left(-4+2\sqrt{30}\right)=4(30)-16=104.\) \(_\square\)

Try the following problems at your own.

\[ \begin{eqnarray} \large \color{blue}2^{\color{brown}x} - \color{blue}2^{\color{brown}y} & = & \large 1 \\ \\ \large \color{green}4^{\color{brown}x}- \color{green}4^{\color{brown}y} & = & \large { \frac 5 3} \\ \\ \\ \large {\color{brown}x} - {\color{brown}y} & = & \large \, ? \end{eqnarray} \]

**Details and Assumptions:**

- \(x\) and \(y\) are real numbers.

## See Also

**Cite as:**Difference Of Squares.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/applying-the-difference-of-two-squares-identity/