Metamath Proof Explorer


Theorem lcmgcd

Description: The product of two numbers' least common multiple and greatest common divisor is the absolute value of the product of the two numbers. In particular, that absolute valueis the least common multiple of two coprime numbers, for which ( M gcd N ) = 1 .

Multiple methods exist for proving this, and it is often proven either as a consequence of the fundamental theorem of arithmetic 1arith or of Bézout's identity bezout ; see e.g., https://proofwiki.org/wiki/Product_of_GCD_and_LCM and https://math.stackexchange.com/a/470827 . This proof uses the latter to first confirm it for positive integers M and N (the "Second Proof" in the above Stack Exchange page), then shows that implies it for all nonzero integer inputs, then finally uses lcm0val to show it applies when either or both inputs are zero. (Contributed by Steve Rodriguez, 20-Jan-2020)

Ref Expression
Assertion lcmgcd
|- ( ( M e. ZZ /\ N e. ZZ ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( abs ` ( M x. N ) ) )

Proof

Step Hyp Ref Expression
1 gcdcl
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( M gcd N ) e. NN0 )
2 1 nn0cnd
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( M gcd N ) e. CC )
3 2 mul02d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( 0 x. ( M gcd N ) ) = 0 )
4 0z
 |-  0 e. ZZ
5 lcmcom
 |-  ( ( N e. ZZ /\ 0 e. ZZ ) -> ( N lcm 0 ) = ( 0 lcm N ) )
6 4 5 mpan2
 |-  ( N e. ZZ -> ( N lcm 0 ) = ( 0 lcm N ) )
7 lcm0val
 |-  ( N e. ZZ -> ( N lcm 0 ) = 0 )
8 6 7 eqtr3d
 |-  ( N e. ZZ -> ( 0 lcm N ) = 0 )
9 8 adantl
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( 0 lcm N ) = 0 )
10 9 oveq1d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( 0 lcm N ) x. ( M gcd N ) ) = ( 0 x. ( M gcd N ) ) )
11 zcn
 |-  ( N e. ZZ -> N e. CC )
12 11 adantl
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> N e. CC )
13 12 mul02d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( 0 x. N ) = 0 )
14 13 abs00bd
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` ( 0 x. N ) ) = 0 )
15 3 10 14 3eqtr4d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( 0 lcm N ) x. ( M gcd N ) ) = ( abs ` ( 0 x. N ) ) )
16 15 adantr
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> ( ( 0 lcm N ) x. ( M gcd N ) ) = ( abs ` ( 0 x. N ) ) )
17 simpr
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> M = 0 )
18 17 oveq1d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> ( M lcm N ) = ( 0 lcm N ) )
19 18 oveq1d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( ( 0 lcm N ) x. ( M gcd N ) ) )
20 17 oveq1d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> ( M x. N ) = ( 0 x. N ) )
21 20 fveq2d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> ( abs ` ( M x. N ) ) = ( abs ` ( 0 x. N ) ) )
22 16 19 21 3eqtr4d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ M = 0 ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( abs ` ( M x. N ) ) )
23 lcm0val
 |-  ( M e. ZZ -> ( M lcm 0 ) = 0 )
24 23 adantr
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( M lcm 0 ) = 0 )
25 24 oveq1d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( M lcm 0 ) x. ( M gcd N ) ) = ( 0 x. ( M gcd N ) ) )
26 zcn
 |-  ( M e. ZZ -> M e. CC )
27 26 adantr
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> M e. CC )
28 27 mul01d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( M x. 0 ) = 0 )
29 28 abs00bd
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` ( M x. 0 ) ) = 0 )
30 3 25 29 3eqtr4d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( M lcm 0 ) x. ( M gcd N ) ) = ( abs ` ( M x. 0 ) ) )
31 30 adantr
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> ( ( M lcm 0 ) x. ( M gcd N ) ) = ( abs ` ( M x. 0 ) ) )
32 simpr
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> N = 0 )
33 32 oveq2d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> ( M lcm N ) = ( M lcm 0 ) )
34 33 oveq1d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( ( M lcm 0 ) x. ( M gcd N ) ) )
35 32 oveq2d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> ( M x. N ) = ( M x. 0 ) )
36 35 fveq2d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> ( abs ` ( M x. N ) ) = ( abs ` ( M x. 0 ) ) )
37 31 34 36 3eqtr4d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ N = 0 ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( abs ` ( M x. N ) ) )
38 22 37 jaodan
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ ( M = 0 \/ N = 0 ) ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( abs ` ( M x. N ) ) )
39 neanior
 |-  ( ( M =/= 0 /\ N =/= 0 ) <-> -. ( M = 0 \/ N = 0 ) )
40 nnabscl
 |-  ( ( M e. ZZ /\ M =/= 0 ) -> ( abs ` M ) e. NN )
41 nnabscl
 |-  ( ( N e. ZZ /\ N =/= 0 ) -> ( abs ` N ) e. NN )
42 40 41 anim12i
 |-  ( ( ( M e. ZZ /\ M =/= 0 ) /\ ( N e. ZZ /\ N =/= 0 ) ) -> ( ( abs ` M ) e. NN /\ ( abs ` N ) e. NN ) )
43 42 an4s
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ ( M =/= 0 /\ N =/= 0 ) ) -> ( ( abs ` M ) e. NN /\ ( abs ` N ) e. NN ) )
44 39 43 sylan2br
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ -. ( M = 0 \/ N = 0 ) ) -> ( ( abs ` M ) e. NN /\ ( abs ` N ) e. NN ) )
45 lcmgcdlem
 |-  ( ( ( abs ` M ) e. NN /\ ( abs ` N ) e. NN ) -> ( ( ( ( abs ` M ) lcm ( abs ` N ) ) x. ( ( abs ` M ) gcd ( abs ` N ) ) ) = ( abs ` ( ( abs ` M ) x. ( abs ` N ) ) ) /\ ( ( 0 e. NN /\ ( ( abs ` M ) || 0 /\ ( abs ` N ) || 0 ) ) -> ( ( abs ` M ) lcm ( abs ` N ) ) || 0 ) ) )
46 45 simpld
 |-  ( ( ( abs ` M ) e. NN /\ ( abs ` N ) e. NN ) -> ( ( ( abs ` M ) lcm ( abs ` N ) ) x. ( ( abs ` M ) gcd ( abs ` N ) ) ) = ( abs ` ( ( abs ` M ) x. ( abs ` N ) ) ) )
47 44 46 syl
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ -. ( M = 0 \/ N = 0 ) ) -> ( ( ( abs ` M ) lcm ( abs ` N ) ) x. ( ( abs ` M ) gcd ( abs ` N ) ) ) = ( abs ` ( ( abs ` M ) x. ( abs ` N ) ) ) )
48 lcmabs
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( abs ` M ) lcm ( abs ` N ) ) = ( M lcm N ) )
49 gcdabs
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( abs ` M ) gcd ( abs ` N ) ) = ( M gcd N ) )
50 48 49 oveq12d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( ( abs ` M ) lcm ( abs ` N ) ) x. ( ( abs ` M ) gcd ( abs ` N ) ) ) = ( ( M lcm N ) x. ( M gcd N ) ) )
51 50 adantr
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ -. ( M = 0 \/ N = 0 ) ) -> ( ( ( abs ` M ) lcm ( abs ` N ) ) x. ( ( abs ` M ) gcd ( abs ` N ) ) ) = ( ( M lcm N ) x. ( M gcd N ) ) )
52 absidm
 |-  ( M e. CC -> ( abs ` ( abs ` M ) ) = ( abs ` M ) )
53 absidm
 |-  ( N e. CC -> ( abs ` ( abs ` N ) ) = ( abs ` N ) )
54 52 53 oveqan12d
 |-  ( ( M e. CC /\ N e. CC ) -> ( ( abs ` ( abs ` M ) ) x. ( abs ` ( abs ` N ) ) ) = ( ( abs ` M ) x. ( abs ` N ) ) )
55 26 11 54 syl2an
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( abs ` ( abs ` M ) ) x. ( abs ` ( abs ` N ) ) ) = ( ( abs ` M ) x. ( abs ` N ) ) )
56 nn0abscl
 |-  ( M e. ZZ -> ( abs ` M ) e. NN0 )
57 56 nn0cnd
 |-  ( M e. ZZ -> ( abs ` M ) e. CC )
58 57 adantr
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` M ) e. CC )
59 nn0abscl
 |-  ( N e. ZZ -> ( abs ` N ) e. NN0 )
60 59 nn0cnd
 |-  ( N e. ZZ -> ( abs ` N ) e. CC )
61 60 adantl
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` N ) e. CC )
62 58 61 absmuld
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` ( ( abs ` M ) x. ( abs ` N ) ) ) = ( ( abs ` ( abs ` M ) ) x. ( abs ` ( abs ` N ) ) ) )
63 27 12 absmuld
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` ( M x. N ) ) = ( ( abs ` M ) x. ( abs ` N ) ) )
64 55 62 63 3eqtr4d
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( abs ` ( ( abs ` M ) x. ( abs ` N ) ) ) = ( abs ` ( M x. N ) ) )
65 64 adantr
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ -. ( M = 0 \/ N = 0 ) ) -> ( abs ` ( ( abs ` M ) x. ( abs ` N ) ) ) = ( abs ` ( M x. N ) ) )
66 47 51 65 3eqtr3d
 |-  ( ( ( M e. ZZ /\ N e. ZZ ) /\ -. ( M = 0 \/ N = 0 ) ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( abs ` ( M x. N ) ) )
67 38 66 pm2.61dan
 |-  ( ( M e. ZZ /\ N e. ZZ ) -> ( ( M lcm N ) x. ( M gcd N ) ) = ( abs ` ( M x. N ) ) )