Euler’s four-square identity expresses the product of two sums of four squares as another sum of four squares. Enter the four components of each group below. The calculator returns four components of the product, both sides of the identity, and their numerical difference.
Enter four numbers in each group, including zeros where needed. Use integers when you want an integer representation of the product as four squares; negative numbers and decimals are also valid. Read c₁ through c₄ as the numbers to square, rather than as the squares themselves. Compare the product A × B with the sum of their squares.
Expand the four squares on the right. Their mixed terms cancel in pairs, leaving each term aᵢ²bⱼ² exactly once. These are precisely the sixteen terms obtained by expanding A × B. This proves the identity algebraically for real inputs. For integer inputs, each c component is an integer, so the formula constructs an integer four-square representation of the product.
| Quantity | Calculation | Result |
|---|---|---|
| First sum A | 1² + 2² + 3² + 4² | 30 |
| Second sum B | 5² + 6² + 7² + 8² | 174 |
| Product A × B | 30 × 174 | 5220 |
| c₁ | 1 × 5 − 2 × 6 − 3 × 7 − 4 × 8 | −60 |
| c₂ | 1 × 6 + 2 × 5 + 3 × 8 − 4 × 7 | 12 |
| c₃ | 1 × 7 − 2 × 8 + 3 × 5 + 4 × 6 | 30 |
| c₄ | 1 × 8 + 2 × 7 − 3 × 6 + 4 × 5 | 24 |
| Sum of component squares | (−60)² + 12² + 30² + 24² | 5220 |
| Difference | 5220 − 5220 | 0 |
The identity is exact algebraically, but numerical calculations use finite precision. Decimal inputs, large magnitudes, and cancellation can introduce rounding error. A small nonzero difference can therefore occur, and a displayed zero may conceal rounding below eight decimal places. This numerical check is not an exact-arithmetic proof. Values outside the supported numeric range can make a result and its dependent outputs unavailable; unavailable does not mean zero.
Why can a product component be negative?
The components are signed combinations of products. Their squares are nonnegative, so a negative component is valid. You may replace a component by its absolute value without changing the sum of squares.
Is the resulting representation unique?
No. Changing component signs or order preserves the sum of squares, and a number may have other four-square representations. This calculator returns the representation specified by the displayed formulas.
Can I enter only the two totals to find their four-square representations?
This calculator requires four components for each total. It combines representations you already have; it does not search for a representation of an arbitrary integer.
What happens if one group contains four zeros?
That group’s sum of squares is zero. All four product components and the product are then zero for finite inputs within the supported numeric range.

