A Formula That Shows Up Wherever Distances Do
Every time you measure the diagonal of a rectangle, the hypotenuse of a right triangle, or the magnitude of a 2D vector, this identity is doing the work.
The a square plus b square formula rewrites a sum of two squares in two equivalent ways:
Both forms are useful — pick whichever matches the data you have.
The Formula
For any real numbers and :
Equivalently:
Quick facts.
Type: algebraic identity (true for all real ).
Reads as: "sum of squares equals the square of the sum minus twice the product."
Grade introduced: CCSS-M HSA-SSE.A.2; NCERT Class 8 Chapter 9 — Algebraic Expressions and Identities.
Geometric meaning: when are the legs of a right triangle, — the Pythagorean theorem.
Does not factor over the reals. Unlike , the sum of two real squares has no real factoring (over the complex numbers, ).
Two Quick Proofs
Proof 1 — Subtract from .
Start with the binomial-square identity:
Subtract from both sides:
Done.
Proof 2 — Add to .
Start with the other binomial-square identity:
Add to both sides:
The two proofs give the two equivalent forms.
Three Worked Examples, From Quick to Stretch
Quick. Find .
Cross-check using the formula: . ✓
Final answer: . (And, not coincidentally, — this is the famous -- right triangle.)
Standard (Wrong-Path-First). If and , find .
Wrong path. A student in our McKinney TX Grade 8 cohort once wrote: " so and ; then ." That works by luck — the values happen to fit — but the method generalises badly. If and , and are no longer integers; guessing fails.
Correct. Apply the formula directly:
Final answer: .
The method works for any and , integer or not. That's the value of using the formula instead of solving for and individually.
Stretch. A right triangle has legs in the ratio and hypotenuse . Find the legs.
Let the legs be and . By Pythagoras:
So the legs are and .
Final answer: Legs are and .
Cross-check: . ✓ The triangle is a Pythagorean triple — times the primitive .
Where the Formula Lives — From Right Triangles to Complex Numbers
The sum-of-two-squares identity is the algebraic shadow of distance in the plane.
Pythagorean theorem. For a right triangle with legs and hypotenuse : . Every distance computation in 2D Cartesian geometry collapses to this identity.
Complex numbers. The squared modulus of is . Over the complex numbers the identity does factor: . This is the gateway to factoring quadratics whose discriminant is negative.
Vector magnitude in 2D. A vector has length . The formula tells you how to evaluate without knowing individually — only their sum and product.
Pythagorean triples. Triples like satisfy with all three integers. Number theorists generated these systematically — there are infinitely many primitive ones.
Sum-of-two-squares theorem (Fermat). A prime can be written as if and only if or . Primes like , , qualify; do not.
The identity is small. Its mathematical descendants span four centuries of number theory.
Three Habits That Lose Marks on a² + b²
1. Confusing with .
Where it slips in: Problems where the parentheses look similar.
Don't do this: Write .
The correct way: — bigger than by the cross-term . The sum-of-squares does not equal the square-of-sum unless .
2. Trying to factor over the real numbers.
Where it slips in: Polynomial factorization problems on test paper.
Don't do this: Write — which is the difference-of-squares formula, not the sum.
The correct way: does not factor over the real numbers. Its only real form is the identity . Over complex numbers, . Don't force a real factorization that doesn't exist. Roughly five out of every ten Grade 8 students in our Bhanzu cohorts try to factor as on the first attempt — the fix is to memorise sum is irreducible over the reals, difference factors.
3. Forgetting the in .
Where it slips in: Substitution problems given and .
Don't do this: Write .
The correct way: . The factor of comes from the binomial-square expansion's cross-term . Forgetting it is the same error class as forgetting the in .
4. Using the formula on or .
Where it slips in: Problems that look similar but involve different operations or powers.
Don't do this: Apply the sum-of-squares formula to factor or .
The correct way: — difference of squares, does factor. — sum of cubes, factors. — sum of squares, does not factor over the reals. Each identity is its own object. A real-world version of this error class: the 1996 Ariane 5 rocket failed because reused software applied a formula valid for one rocket (Ariane 4) to a different one with different parameters. The math worked — but for a system the formula was no longer modeling.
The Mathematician Behind a² + b²
The Pythagorean theorem — the geometric face of the identity — is named for Pythagoras of Samos (c. 570–c. 495 BCE, Greece), the philosopher-mathematician whose school taught geometry as a path to spiritual purification.
The historical record is messier than the school version. Babylonian clay tablets (notably Plimpton 322, c. 1800 BCE) list Pythagorean triples a millennium before Pythagoras was born — the result was known to surveyors and astronomers across Mesopotamia, India, and Egypt. The Indian mathematician Baudhāyana (c. 800 BCE) stated the theorem in Baudhāyana Śulbasūtra roughly years before Pythagoras. What Pythagoras's school may have contributed is the first systematic proof — though even that is uncertain, since the school's texts were oral and were destroyed.
The sum-of-two-squares identity in algebraic form — — is too elementary to attribute to a single discoverer. It was implicit in Euclid's Elements (Book II, Propositions 4 and 7, c. 300 BCE) as a geometric identity about square areas, and was used as a symbolic identity by every algebraist from al-Khwarizmi onward.
Conclusion
The a square plus b square formula is , equivalently .
It does not factor over the real numbers — unlike its cousin .
It is the algebraic form of the Pythagorean theorem when are the legs of a right triangle.
The most common mistake is treating as equal to — it's smaller by .
Over the complex numbers, — the gateway to factoring negative-discriminant quadratics.
Practice These Three Before Moving On
Try these before continuing. If you slip on vs , come back to Mistake 1.
Given and , find .
A right triangle has legs and . Find the hypotenuse.
Verify that and find a similar two-square representation of .
Want a live Bhanzu trainer to walk through more a square plus b square formula problems with your child? Book a free demo class — online globally.
Was this article helpful?
Your feedback helps us write better content
