→ Algebra → Factoring A²+B²
Updated 16 Aug 2015 (What’s New?)

Factoring the Sum of Squares

Copyright © 2009–2015 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 if A and B are just simple variables, but if A and B have internal structure then 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.

Sophie Germain’s Identity

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

x4 + 4y4 = (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 4x4 + 625y4.

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

4x4 + 625y4 = (2x² + 25y² + 10xy) (2x² + 25y² − 10xy)

Higher Powers

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

Example 2:  (u³)² + (v³)² = u6 + v6. Can anything be done?

The answer is yes. As you may know, An+Bn can be factored on the reals if n is an odd integer:

An+Bn = (A+B) (An-1 − An-2B + An-3B2 ... − ABn-2 + Bn-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 u6+v6 as the sum of two cubes:

u6+v6 = (u²)³+(v²)³ = (u²+v²) ( (u²)² − u²v² + (v²)² ) = (u²+v²) (u4 − u²v² + v4)

Example 3: x10+1024y10 is a sum of squares, (x5)2 + (32y5)2. But it’s also a sum of fifth powers, x10+1024y10 = (x2)5 + (4y2)5

Use the above factorization for the sum of fifth powers:

A5+B5 = (A+B) (A4 − A3B + A2B2 − AB3 + B4)

x10+1024y10 = (x2)5 + (4y2)5

    =(x2+4y2) ( (x2)4 − (x2)3(4y2) + (x2)2(4y2)2 − (x2)(4y2)3 + (4y2)4 )

    =(x2+4y2) ( x8 − 4x6y2 + 16x4y4 − 64x2y6 + 256y8)

Complex Numbers

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² − (iB)² = (A+iB) (A−iB)

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

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

Example 6:  16x4+81y4 = (4x²)² + (9y²)² = (4x²+9iy²) (4x²−9iy²)

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 9iy² 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:

16x4+81y4 = [4x²+9iy²] [4x²−9iy²]

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

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

Why are there no new is 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+3i)y/√2 ] [ 2x − i(3+3i)y/√2 ] [ 2x + (3+3i)y/√2 ] [ 2x − (3+3i)y/√2 ]

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

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

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


    = (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 − 3y + 3iy) (2√2 x + 3y − 3iy) (2√2 x + 3y + 3iy) (2√2 x − 3y − 3iy)

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


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

What’s New

Site Map | Home Page | Contact

Updates and new info:

button for donations Want to show your appreciation? Please donate a few bucks to the author.