Technique explanation

The algebraic identity a² - b² = (a+b)(a-b) allows us to represent integers as the difference of two squares. This method applies to every odd number and every multiple of 4. For an integer N, we find a factor pair (p, q) such that N = p × q. If p and q have the same parity (both odd or both even), we calculate a = (p+q)/2 and b = (p-q)/2.

Additionally, the Gaussian identity (a² + b²)(c² + d²) = (ac ∓ bd)² + (ad ± bc)² expresses the product of two sums of squares as a sum of two squares in two distinct ways. Standard fallback: Conventional algebraic expansion of factor pairs and trial-and-error search for integer square sums.

Worked examples

Example 1: Difference of Squares
Represent N = 3703 as a difference of squares.
1. Find factor pair: 3703 = 529 × 7.
2. Calculate a = (529 + 7) / 2 = 268.
3. Calculate b = (529 - 7) / 2 = 261.
4. Result: 268² - 261² = 3703.
Check: 268² - 261² = 71824 - 68121 = 3703. Verified.

Example 2: Sum of Squares
Represent 65 as a sum of squares using 5 = 1² + 2² and 13 = 2² + 3².
1. Identify a=1, b=2, c=2, d=3.
2. Form 1: (1·2 - 2·3)² + (1·3 + 2·2)² = (-4)² + 7² = 16 + 49 = 65.
3. Form 2: (1·2 + 2·3)² + (1·3 - 2·2)² = 8² + (-1)² = 64 + 1 = 65.
Check: For Form 1, 4² + 7² = 16 + 49 = 65; for Form 2, 8² + 1² = 64 + 1 = 65. Verified.