Metamath Proof Explorer


Theorem subsq

Description: Factor the difference of two squares. (Contributed by NM, 21-Feb-2008)

Ref Expression
Assertion subsq A B A 2 B 2 = A + B A B

Proof

Step Hyp Ref Expression
1 simpl A B A
2 simpr A B B
3 subcl A B A B
4 1 2 3 adddird A B A + B A B = A A B + B A B
5 subdi A A B A A B = A A A B
6 5 3anidm12 A B A A B = A A A B
7 sqval A A 2 = A A
8 7 adantr A B A 2 = A A
9 8 oveq1d A B A 2 A B = A A A B
10 6 9 eqtr4d A B A A B = A 2 A B
11 2 1 2 subdid A B B A B = B A B B
12 mulcom A B A B = B A
13 sqval B B 2 = B B
14 13 adantl A B B 2 = B B
15 12 14 oveq12d A B A B B 2 = B A B B
16 11 15 eqtr4d A B B A B = A B B 2
17 10 16 oveq12d A B A A B + B A B = A 2 A B + A B - B 2
18 sqcl A A 2
19 18 adantr A B A 2
20 mulcl A B A B
21 sqcl B B 2
22 21 adantl A B B 2
23 19 20 22 npncand A B A 2 A B + A B - B 2 = A 2 B 2
24 4 17 23 3eqtrrd A B A 2 B 2 = A + B A B