Difference of Squares
AlgebraThe difference of squares pattern states that a^2 - b^2 factors as (a + b)(a - b), applicable whenever a polynomial is a perfect square minus a perfect square.
Formula
a^2 - b^2 = (a + b)(a - b)
Definition
The difference of squares pattern says: whenever you have a perfect square minus a perfect square, it factors into two binomials with a plus and a minus.
Example
$x^2 - 9 = (x + 3)(x - 3)$ because $9 = 3^2$. Check: $(x+3)(x-3) = x^2 - 3x + 3x - 9 = x^2 - 9$. The middle terms cancel.
Key Insight
The middle terms always cancel because they are opposites. This works because $(a+b)(a-b)$ uses the same two terms with just a sign change.
Definition
The difference of squares identity states $a^2 - b^2 = (a + b)(a - b)$ for any expressions $a$ and $b$. To apply it, both terms must be perfect squares and separated by subtraction (not addition). A sum of squares $a^2 + b^2$ does NOT factor over the real numbers.
Example
$25x^2 - 16 = (5x)^2 - 4^2 = (5x + 4)(5x - 4)$. Also: $4x^4 - 9y^2 = (2x^2 + 3y)(2x^2 - 3y)$.
Key Insight
A sum of two squares, like $x^2 + 16$, cannot be factored over the real numbers. This is why the difference (subtraction) is required. Over complex numbers, $x^2 + b^2 = (x + bi)(x - bi)$.
Definition
The difference of squares identity $a^2 - b^2 = (a+b)(a-b)$ follows from the ring axioms and holds in any commutative ring. Over $\mathbb{R}$, $a^2 + b^2$ is irreducible (no real roots). Over $\mathbb{C}$, $a^2 + b^2 = (a + bi)(a - bi)$, the factors being complex conjugates. In $\mathbb{Z}_p[x]$ (polynomials over a prime field), whether $x^2 + b^2$ factors depends on whether $-b^2$ is a quadratic residue mod $p$.
Example
In $\mathbb{Z}_5$: $x^2 + 1 = x^2 - 4 = (x-2)(x+2)$ since $-1 = 4 \pmod{5}$ and $4 = 2^2$. The "sum of squares" factors in $\mathbb{Z}_5$ because $-1$ is a quadratic residue mod $5$.
Key Insight
Whether $-1$ is a quadratic residue mod $p$ determines if $x^2 + 1$ factors in $\mathbb{Z}_p[x]$. This is connected to quadratic reciprocity and the study of which primes split in the Gaussian integers $\mathbb{Z}[i]$.