Metamath Proof Explorer


Theorem sqrtcval2

Description: Explicit formula for the complex square root in terms of the square root of nonnegative reals. The right side is slightly more compact than sqrtcval . (Contributed by RP, 18-May-2024)

Ref Expression
Assertion sqrtcval2 AA=A+A2+ifA<0iiAA2

Proof

Step Hyp Ref Expression
1 sqrtcval AA=A+A2+iifA<011AA2
2 ovif2 iifA<011=ifA<0i-1i1
3 neg1cn 1
4 ax-icn i
5 4 mulm1i -1i=i
6 3 4 5 mulcomli i-1=i
7 4 mulid1i i1=i
8 ifeq12 i-1=ii1=iifA<0i-1i1=ifA<0ii
9 6 7 8 mp2an ifA<0i-1i1=ifA<0ii
10 2 9 eqtr2i ifA<0ii=iifA<011
11 10 a1i AifA<0ii=iifA<011
12 11 oveq1d AifA<0iiAA2=iifA<011AA2
13 4 a1i Ai
14 neg1rr 1
15 1re 1
16 14 15 ifcli ifA<011
17 16 a1i AifA<011
18 17 recnd AifA<011
19 sqrtcvallem3 AAA2
20 19 recnd AAA2
21 13 18 20 mulassd AiifA<011AA2=iifA<011AA2
22 12 21 eqtrd AifA<0iiAA2=iifA<011AA2
23 22 oveq2d AA+A2+ifA<0iiAA2=A+A2+iifA<011AA2
24 1 23 eqtr4d AA=A+A2+ifA<0iiAA2