# 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

Also, since the two factors are different by \(2b\), the factors 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.

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

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

Similarly we re-write this with \(w,x,y,z:\)

\[\begin{align} (w^2-x^2)(y^2-z^2) &= (wy+xz)^2-(wz+xy)^2 = a^2-b^2 \\ &= (wy-xz)^2 - (wz-xy)^2 = c^2-d^2. \end{align}\]

So, \(wy+xz =a,\) \(wz+xy =b,\) \(wy-xz = c,\) \(wz-xy = d,\) and if we assume \(a=b+1, \) then

\[ a-b = wy+xz-wz-xy=(w-x)(y-z) = 1.\]

When \(w>x\) and \(y>z,\) we can set

\[w-x = 1, y-z=1 \implies w=x+1, y=z+1,\]

which implies

\[\begin{align} a &= wy+xz = (x+1)(z+1) +xz = 2xz+x+z+1 \\ b &= wz+xy = (x+1)(z) + x(z+1) = 2xz + x + z \\ c &= wy-xz = (x+1)(z+1) - xz = x + z + 1 \\ d &= wz-xy = (x+1)z - x(z+1) = z- x. \end{align}\]

If we have \( n = a^2 - b^2 = c^2-d^2 ,\) and \(n\) is assumed odd,

\[ \begin{align} n & = \big( (x+1)^2-x^2 \big) \big( (z+1)^2 - z^2\big) \\ & = ( 2x+1 )( 2z+1 ), \end{align} \]

which is accurate since \(n\) is odd, and thus it cannot have even factors. This also tells us that

\[\begin{align} a^2 - c^2 &= (a-c)(a+c) \\&= (2xz)(2wy) \\&= 4(x+1)(z+1)xz \\&= b^2 - d^2\\ \Rightarrow a^2+d^2 &= b^2+c^2 \\&= (w^2+x^2)(y^2+z^2). \end{align}\]

Because the product of two sums of two squares is the sum of two squares in two different ways,

\[ a^2+d^2 = (2x^2+2x+1)(2z^2+2z+1). \]

## 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/