Metamath Proof Explorer


Theorem mul4sq

Description: Euler's four-square identity: The product of two sums of four squares is also a sum of four squares. This is usually quoted as an explicit formula involving eight real variables; we save some time by working with complex numbers (gaussian integers) instead, so that we only have to work with four variables, and also hiding the actual formula for the product in the proof of mul4sqlem . (For the curious, the explicit formula that is used is ( | a | ^ 2 + | b | ^ 2 ) ( | c | ^ 2 + | d | ^ 2 ) = | a * x. c + b x. d * | ^ 2 + | a * x. d - b x. c * | ^ 2 .) (Contributed by Mario Carneiro, 14-Jul-2014)

Ref Expression
Hypothesis 4sq.1 S = n | x y z w n = x 2 + y 2 + z 2 + w 2
Assertion mul4sq A S B S A B S

Proof

Step Hyp Ref Expression
1 4sq.1 S = n | x y z w n = x 2 + y 2 + z 2 + w 2
2 1 4sqlem4 A S a i b i A = a 2 + b 2
3 1 4sqlem4 B S c i d i B = c 2 + d 2
4 reeanv a i c i b i A = a 2 + b 2 d i B = c 2 + d 2 a i b i A = a 2 + b 2 c i d i B = c 2 + d 2
5 reeanv b i d i A = a 2 + b 2 B = c 2 + d 2 b i A = a 2 + b 2 d i B = c 2 + d 2
6 simpll a i c i b i d i a i
7 gzabssqcl a i a 2 0
8 6 7 syl a i c i b i d i a 2 0
9 simprl a i c i b i d i b i
10 gzabssqcl b i b 2 0
11 9 10 syl a i c i b i d i b 2 0
12 8 11 nn0addcld a i c i b i d i a 2 + b 2 0
13 12 nn0cnd a i c i b i d i a 2 + b 2
14 13 div1d a i c i b i d i a 2 + b 2 1 = a 2 + b 2
15 simplr a i c i b i d i c i
16 gzabssqcl c i c 2 0
17 15 16 syl a i c i b i d i c 2 0
18 simprr a i c i b i d i d i
19 gzabssqcl d i d 2 0
20 18 19 syl a i c i b i d i d 2 0
21 17 20 nn0addcld a i c i b i d i c 2 + d 2 0
22 21 nn0cnd a i c i b i d i c 2 + d 2
23 22 div1d a i c i b i d i c 2 + d 2 1 = c 2 + d 2
24 14 23 oveq12d a i c i b i d i a 2 + b 2 1 c 2 + d 2 1 = a 2 + b 2 c 2 + d 2
25 eqid a 2 + b 2 = a 2 + b 2
26 eqid c 2 + d 2 = c 2 + d 2
27 1nn 1
28 27 a1i a i c i b i d i 1
29 gzsubcl a i c i a c i
30 29 adantr a i c i b i d i a c i
31 gzcn a c i a c
32 30 31 syl a i c i b i d i a c
33 32 div1d a i c i b i d i a c 1 = a c
34 33 30 eqeltrd a i c i b i d i a c 1 i
35 gzsubcl b i d i b d i
36 35 adantl a i c i b i d i b d i
37 gzcn b d i b d
38 36 37 syl a i c i b i d i b d
39 38 div1d a i c i b i d i b d 1 = b d
40 39 36 eqeltrd a i c i b i d i b d 1 i
41 14 12 eqeltrd a i c i b i d i a 2 + b 2 1 0
42 1 6 9 15 18 25 26 28 34 40 41 mul4sqlem a i c i b i d i a 2 + b 2 1 c 2 + d 2 1 S
43 24 42 eqeltrrd a i c i b i d i a 2 + b 2 c 2 + d 2 S
44 oveq12 A = a 2 + b 2 B = c 2 + d 2 A B = a 2 + b 2 c 2 + d 2
45 44 eleq1d A = a 2 + b 2 B = c 2 + d 2 A B S a 2 + b 2 c 2 + d 2 S
46 43 45 syl5ibrcom a i c i b i d i A = a 2 + b 2 B = c 2 + d 2 A B S
47 46 rexlimdvva a i c i b i d i A = a 2 + b 2 B = c 2 + d 2 A B S
48 5 47 syl5bir a i c i b i A = a 2 + b 2 d i B = c 2 + d 2 A B S
49 48 rexlimivv a i c i b i A = a 2 + b 2 d i B = c 2 + d 2 A B S
50 4 49 sylbir a i b i A = a 2 + b 2 c i d i B = c 2 + d 2 A B S
51 2 3 50 syl2anb A S B S A B S