Ma · Mathematics

If the Sum of Two Squares Is Zero, Are Both Numbers Zero?

Published By the 9to5Science editorial team

At a glance

  1. 1. Check the number system

    Over the real numbers, squares are nonnegative; over the complex numbers, nonzero squares can cancel.

  2. 2. Use nonnegativity

    If real a² + b² = 0, neither square can be positive, so both squares equal zero.

  3. 3. Take square roots

    Since a² = 0 and b² = 0, it follows that a = 0 and b = 0.

  4. 4. Check the domain

    For complex numbers or modular arithmetic, test the claim separately; the real-number argument may not apply.

If aa and bb are real numbers and a2+b2=0a^2+b^2=0, then both numbers must be zero. The reason is that the square of a real number is never negative, so two real squares cannot cancel each other out.

The number system matters, however. The same statement is false for complex numbers, and it can also fail in arithmetic modulo an integer. Here is the real-number proof and how to recognize those alternatives.

The real-number proof

For real aa and bb, we know

a2≥0andb2≥0.a^2\geq 0 \quad\text{and}\quad b^2\geq 0.

Suppose their sum is zero:

a2+b2=0.a^2+b^2=0.

Rearrange to get a2=−b2a^2=-b^2. The left side is nonnegative, while the right side is nonpositive. The only number that is both nonnegative and nonpositive is zero. Thus a2=0a^2=0 and b2=0b^2=0, which gives a=b=0a=b=0.

You can also see this directly: if either number were nonzero, its square would be positive. Adding the other nonnegative square would make the sum positive, contradicting the assumption that the sum is zero.

A worked example

Suppose xx and yy are real and x2+y2=25x^2+y^2=25. This is not the zero-sum case, but it illustrates the same nonnegativity principle: each square is at most 25, since neither can exceed the sum.

If instead x2+y2=0x^2+y^2=0, then x2x^2 and y2y^2 are both at least zero and add to zero. For instance, if x=3x=3, then x2=9x^2=9, so the sum would be at least 9, not zero. Therefore xx cannot be 3—or any other nonzero real number. The only possibility is x=y=0x=y=0.

For integers, the conclusion is identical. Every integer is real, so the same proof applies. It also applies to rational numbers, since they too are real.

Why the number system matters

In the complex numbers, squares need not be nonnegative real numbers. The imaginary unit ii satisfies i2=−1i^2=-1, so

12+i2=1−1=0.1^2+i^2=1-1=0.

Thus a sum of two complex squares can be zero even when neither term is zero. More generally, if aa and bb are complex, the equation a2+b2=0a^2+b^2=0 factors as

(a+ib)(a−ib)=0.(a+ib)(a-ib)=0.

Because the complex numbers have no zero divisors, this means a=iba=ib or a=−iba=-ib. These possibilities include nonzero solutions, such as (a,b)=(1,i)(a,b)=(1,i).

There is another caution in modular arithmetic. Modulo 5, for example, 22+12=4+1=5≡0(mod5)2^2+1^2=4+1=5\equiv 0\pmod 5, even though neither 2 nor 1 is congruent to zero modulo 5. Modular arithmetic does not have the ordering property that says every square is nonnegative, so the real-number proof does not carry over.

A useful general rule

The conclusion holds in any number system where squares are nonnegative and a sum of nonnegative elements can be zero only if every summand is zero. This includes the real numbers and their subsets such as the rational numbers and integers.

For a sum of more than two real squares, the same argument gives

x12+x22+⋯+xn2=0⟹x1=x2=⋯=xn=0.x_1^2+x_2^2+\cdots+x_n^2=0 \quad\Longrightarrow\quad x_1=x_2=\cdots=x_n=0.

Each term is nonnegative, so none can be positive if the total is zero.

Common mistakes

  • Forgetting to specify the number system. The claim is true for real numbers but false for complex numbers and can be false modulo an integer.
  • Assuming one square can cancel another over the reals. A real square is never negative, so cancellation is impossible unless both squares are zero.
  • Dividing by one of the variables. If you divide by aa or bb, you first assume it is nonzero. That assumption is exactly what the proof must rule out; nonnegativity avoids this issue.

When the variables are stated to be real—or are integers or rationals—the result follows immediately from the nonnegativity of squares.

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.