# How to Factor the Sum of Squares

Copyright © 2009–2020 by Stan Brown

Copyright © 2009–2020 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 How to Solve 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} + 4*y*^{4} =
(*x*² + 2*y*² + 2*x**y*)
(*x*² + 2*y*² − 2*x**y*)

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*²+2*A**B*+*B*².
Comparing that to *A*²+*B*², you see that there’s an extra
term of 2*A**B*. So you have

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

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

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

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

More specifically, 2*A**B* 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 4*x*^{4} + 625*y*^{4}.

Solution: Let *A* = 2*x*² and
*B* = 25*y*²; then
2*A** B* = 100

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

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 it be factored?

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} ... − *A**B*^{n−2} +
*B*^{n−1}) for *n* odd

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

*A*³+*B*³ = (*A*+*B*) (*A*² − *A**B* + *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}+1024*y*^{10} is a sum of squares,
(*x*^{5})^{2} + (32*y*^{5})^{2}.
But it’s also a sum of fifth powers,
(*x*^{2})^{5} + (4*y*^{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} − *A**B*^{3} +
*B*^{4})

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

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

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

Usually when you factor, you’re 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*+4i) (*x*−4i)

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

**Example 6**: 16*x*^{4}+81*y*^{4} =
(4*x*²)² + (9*y*²)² =
(4*x*²+9i*y*²) (4*x*²−9i*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 9i*y*² as
(3 √i *y*)² =
(3 ((1+i)/√2) *y*)² =
((3+3i)*y*/√2)², so you have a sum of squares and a
difference of squares:

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

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

=
[ 2*x* + i(3+3i)*y*/√2 ]
[ 2*x* − i(3+3i)*y*/√2 ]
[ 2*x* + (3+3i)*y*/√2 ]
[ 2*x* − (3+3i)*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:

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

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

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

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

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

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

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

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

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

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

**19 Oct 2020**: Converted from HTML 4.01 to HTML5. Made a few small changes here and there for clarity. Italicized all the variables, and un-italicized the imaginary number i.**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: https://BrownMath.com/alge/