Enter integers a and b between −1,000 and 1,000. The calculator returns the two factors a² − 2ab + 2b² and a² + 2ab + 2b², together with their product a⁴ + 4b⁴. Negative integers and zero are supported. These factors are not necessarily prime.
Add and subtract 4a²b² to complete a square:
a⁴ + 4b⁴ = (a² + 2b²)² − (2ab)².
Apply the difference-of-squares rule, X² − Y² = (X − Y)(X + Y), with X = a² + 2b² and Y = 2ab. This gives the two factors shown above.
Each factor is also a sum of squares: the first is (a − b)² + b², and the second is (a + b)² + b². Both are positive unless a and b are both zero.
| a | b | a² − 2ab + 2b² | a² + 2ab + 2b² | a⁴ + 4b⁴ |
|---|---|---|---|---|
| 3 | 2 | 5 | 29 | 145 = 5 × 29 |
| 1 | 1 | 1 | 5 | 5 = 1 × 5 |
| 0 | 2 | 8 | 8 | 64 = 8 × 8 |
| -3 | 2 | 29 | 5 | 145 = 29 × 5 |
| 2 | 0 | 4 | 4 | 16 = 4 × 4 |
| 0 | 0 | 0 | 0 | 0 = 0 × 0 |
Use whole numbers within the stated bounds. The inputs use a step of 1, and results are displayed with no decimal places; fractional inputs are outside this calculator’s intended use. For valid integer inputs, the expression is at most 5,000,000,000,000, keeping all integer intermediate values and results within the exact integer range of standard double-precision arithmetic.
The product is calculated from the two factors; it is not a separate numerical verification of the identity. This tool does not perform prime factorization or primality testing. If both factors exceed 1, their product is composite. A factor of 1 alone does not establish whether the product is prime. An unavailable result is not zero.

