# Factoring the Sum of Squares

Copyright © 2009–2016 by Stan Brown

Copyright © 2009–2016 by Stan Brown

**Summary:**
The commonest algebra mistake is probably rewriting
A²+B² as (A+B)². “You can’t factor the sum
of two squares on the reals!” your teacher tells you. While
that’s generally true, there are some interesting
exceptions.

Since Euler’s time at least, generations of students have
tried to “factor” A²+B² as (A+B)². The lure
of this siren song is so strong that I see even calculus students
commit this blunder.
Generations of teachers have sighed despairingly and tried to
get students to remember that
**a sum of two squares can’t be factored on the reals**.

When explaining Solving Polynomial Equations, I myself made that bare statement. But in correspondence in September 2009, Steve Schwartzman convinced me that I should say more. He proposed a sentence or two, but on the principle that a thing worth doing is worth overdoing, ...

It’s true that you can’t factor A²+B²
on the reals —
meaning, with real-number coefficients —
if A and B are just simple
variables. But if A and B have **internal structure**, the expression
may be factorable after all, if you can find some other pattern.
So it’s still true that a sum of squares
can’t be factored *as* a sum of squares on the reals.

This page looks at some of the cases where a sum of squares can be factored using other techniques.

The counterexample that Steve Schwartzman sent me in September 2009 is, as he told me, a form of Sophie Germain’s identity:

x^{4} + 4y^{4} =
(x² + 2y² + 2xy)
(x² + 2y² − 2xy)

Can you generalize this to a class of factorable sums of squares? Yes, you can.

Notice that the factors have the form of (P+Q)(P−Q),
which of course multiplies to P²−Q². This suggests
that, for factoring A²+B², it might be fruitful to look at
(A+B)² minus something. That’s all well and good, but minus
*what*?

The key is that (A+B)² = A²+2AB+B². Comparing that to A²+B², you see that there’s an extra term of 2AB. So you have

A² + B² = (A+B)² − 2AB

That right-hand side is factorable as a difference of squares,
*if* 2AB is a perfect square. And that’s our
factorization:

A² + B² = (A + B + √(2AB)) (A + B − √(2AB))

This identity is always true, but it’s useful for
factoring only **when 2AB is a perfect square**.

More specifically, 2AB must be a perfect square if
you want your factors to have
*rational coefficients*. If you allow non-rational factors, you
can factor more sums of squares, and if you allow
complex factors you can factor *any* sum
of squares.

**Example 1**: Factor 4x^{4} + 625y^{4}.

Solution: Let A = 2x² and B = 25y²; then 2AB = 100x²y² is a perfect square and √(2AB) = 10xy.

4x^{4} + 625y^{4} =
(2x² + 25y² + 10xy) (2x² + 25y² −
10xy)

If A and B are themselves odd powers, you can use a common pattern to factor A²+B².

**Example 2**: (u³)² + (v³)² =
u^{6} + v^{6}. Can anything be done?

The answer is yes.
As you may know, A^{n}+B^{n} can be factored on
the reals if n is an odd integer:

A^{n}+B^{n} =
(A+B) (A^{n-1} − A^{n-2}B +
A^{n-3}B^{2} ... − AB^{n-2} +
B^{n-1}) for n odd

You’ve probably learned the simplest case, n = 3:

A³+B³ = (A+B) (A² − AB + B²)

So the solution is to rewrite u^{6}+v^{6} as
the sum of two cubes:

u^{6}+v^{6} =
(u²)³+(v²)³ =
(u²+v²) ( (u²)² − u²v² +
(v²)² ) =
(u²+v²) (u^{4} − u²v² + v^{4})

**Example 3**: x^{10}+1024y^{10} is a sum of squares,
(x^{5})^{2} + (32y^{5})^{2}.
But it’s also a sum of fifth powers,
x^{10}+1024y^{10} =
(x^{2})^{5} + (4y^{2})^{5}

Use the above factorization for the sum of fifth powers:

A^{5}+B^{5} =
(A+B) (A^{4} − A^{3}B +
A^{2}B^{2} − AB^{3} +
B^{4})

x^{10}+1024y^{10} =
(x^{2})^{5} + (4y^{2})^{5}

=(x^{2}+4y^{2})
( (x^{2})^{4} −
(x^{2})^{3}(4y^{2}) +
(x^{2})^{2}(4y^{2})^{2} −
(x^{2})(4y^{2})^{3} +
(4y^{2})^{4} )

=(x^{2}+4y^{2})
( x^{8} −
4x^{6}y^{2} +
16x^{4}y^{4} −
64x^{2}y^{6} +
256y^{8})

Usually when you factor, you are looking for real factors. But if you allow complex factors then you can always factor A²+B², like this:

A² + B² =
A² − (−1·B²) =
A² − (*i*B)² =
(A+*i*B) (A−*i*B)

**Example 4**: x²+16 = (x+4*i*) (x−4*i*)

**Example 5**: 25p²+49q² =
(5p)² + (7q)² =
(5p+7*i*q) (5p−7*i*q)

**Example 6**: 16x^{4}+81y^{4} =
(4x²)² + (9y²)² =
(4x²+9*i*y²) (4x²−9*i*y²)

This one’s interesting because you can go further.
(If not interested, feel free to skip this.)
If only you can write *i* as a square—in other words,
if you can find the square
root of *i*—then the two factors become a
sum of squares and a difference of squares.
√*i* is covered in some trig classes: the
principal square root is (1+*i*)/√2, and the other square
root is minus that.

Therefore, you can rewrite 9*i*y² as
(3 √i y)² =
(3 ((1+*i*)/√2) y)² =
((3+3*i*)y/√2)², so you have a sum of squares and a
difference of squares:

16x^{4}+81y^{4} =
[4x²+9*i*y²] [4x²−9*i*y²]

=
[ (2x)² + ((3+3*i*)y/√2)² ]
[ (2x)² − ((3+3*i*)y/√2)² ]

=
[ 2x + *i*(3+3*i*)y/√2 ]
[ 2x − *i*(3+3*i*)y/√2 ]
[ 2x + (3+3*i*)y/√2 ]
[ 2x − (3+3*i*)y/√2 ]

Why are there no new *i*s in the second pair of factors?
Because that’s good old A²−B² =
(A+B)(A−B). The first pair of factors can be simplified a
bit:

[ 2x + *i*(3+3*i*)y/√2 ]
[ 2x − *i*(3+3*i*)y/√2 ]
[ 2x + (3+3*i*)y/√2 ]
[ 2x − (3+3*i*)y/√2 ]

=
[ 2x + (3*i*−3)y/√2 ]
[ 2x − (3*i*−3)y/√2 ]
[ 2x + (3+3*i*)y/√2 ]
[ 2x − (3+3*i*)y/√2 ]

=
[ 2x − (3−3*i*)y/√2 ]
[ 2x + (3−3*i*)y/√2 ]
[ 2x + (3+3*i*)y/√2 ]
[ 2x − (3+3*i*)y/√2 ]

You can factor out the 1/√2 and get rid of the inner parentheses:

16x^{4}+81y^{4}

=
(1/√2)
[2√2 x − (3−3*i*)y]
[2√2 x + (3−3*i*)y]
[2√2 x + (3+3*i*)y]
[2√2 x − (3+3*i*)y]

=
(1/√2)
(2√2 x − 3y + 3*i*y)
(2√2 x + 3y − 3*i*y)
(2√2 x + 3y + 3*i*y)
(2√2 x − 3y − 3*i*y)

And finally you can reorder the four trinomials to show the combinations of plus and minus signs:

16x^{4}+81y^{4}

=
(1/√2)
(2√2 x + 3y + 3*i*y)
(2√2 x + 3y − 3*i*y)
(2√2 x − 3y + 3*i*y)
(2√2 x − 3y − 3*i*y)

**15 Sept 2016**: Steve Kish questioned “on the reals”, so I added an explanation.**16 Aug 2015**: Moved from OakRoadSystems.com to BrownMath.com.**20 July 2015**: Pete Hepple pointed out that 2²+3² = (2+3+√12)(2+3−√12), even though 2·2·3 = 12 isn’t a perfect square. I realized I had nowhere made it explicit that by “factoring” I meant “factoring on the rationals”, so I added that.- (intervening changes suppressed)
**13 Sept 2009**: New article, inspired by correspondence with Steve Schwartzman.

Because this article helps you,

please click to donate!Because this article helps you,

please donate at

BrownMath.com/donate.

please click to donate!Because this article helps you,

please donate at

BrownMath.com/donate.

Updates and new info: http://BrownMath.com/alge/