Metamath Proof Explorer


Theorem sqrtcval

Description: Explicit formula for the complex square root in terms of the square root of nonnegative reals. The right-hand side is decomposed into real and imaginary parts in the format expected by crrei and crimi . This formula can be found in section 3.7.27 of Handbook of Mathematical Functions, ed. M. Abramowitz and I. A. Stegun (1965, Dover Press). (Contributed by RP, 18-May-2024)

Ref Expression
Assertion sqrtcval AA=A+A2+iifA<011AA2

Proof

Step Hyp Ref Expression
1 sqrtcvallem5 AA+A2
2 1 recnd AA+A2
3 ax-icn i
4 3 a1i Ai
5 neg1rr 1
6 1re 1
7 5 6 ifcli ifA<011
8 7 a1i AifA<011
9 sqrtcvallem3 AAA2
10 8 9 remulcld AifA<011AA2
11 10 recnd AifA<011AA2
12 4 11 mulcld AiifA<011AA2
13 2 12 addcld AA+A2+iifA<011AA2
14 id AA
15 binom2 A+A2iifA<011AA2A+A2+iifA<011AA22=A+A22+2A+A2iifA<011AA2+iifA<011AA22
16 2 12 15 syl2anc AA+A2+iifA<011AA22=A+A22+2A+A2iifA<011AA2+iifA<011AA22
17 abscl AA
18 recl AA
19 17 18 readdcld AA+A
20 19 rehalfcld AA+A2
21 20 recnd AA+A2
22 21 sqsqrtd AA+A22=A+A2
23 4 11 sqmuld AiifA<011AA22=i2ifA<011AA22
24 i2 i2=1
25 24 a1i Ai2=1
26 8 recnd AifA<011
27 9 recnd AAA2
28 26 27 sqmuld AifA<011AA22=ifA<0112AA22
29 ovif ifA<0112=ifA<01212
30 neg1sqe1 12=1
31 sq1 12=1
32 ifeq12 12=112=1ifA<01212=ifA<011
33 30 31 32 mp2an ifA<01212=ifA<011
34 ifid ifA<011=1
35 29 33 34 3eqtri ifA<0112=1
36 35 a1i AifA<0112=1
37 17 18 resubcld AAA
38 37 rehalfcld AAA2
39 38 recnd AAA2
40 39 sqsqrtd AAA22=AA2
41 36 40 oveq12d AifA<0112AA22=1AA2
42 39 mullidd A1AA2=AA2
43 28 41 42 3eqtrd AifA<011AA22=AA2
44 25 43 oveq12d Ai2ifA<011AA22=-1AA2
45 39 mulm1d A-1AA2=AA2
46 23 44 45 3eqtrd AiifA<011AA22=AA2
47 22 46 oveq12d AA+A22+iifA<011AA22=A+A2+AA2
48 21 39 negsubd AA+A2+AA2=A+A2AA2
49 17 recnd AA
50 18 recnd AA
51 49 50 50 pnncand AA+A-AA=A+A
52 50 2timesd A2A=A+A
53 51 52 eqtr4d AA+A-AA=2A
54 53 oveq1d AA+A-AA2=2A2
55 19 recnd AA+A
56 37 recnd AAA
57 2cnd A2
58 2ne0 20
59 58 a1i A20
60 55 56 57 59 divsubdird AA+A-AA2=A+A2AA2
61 50 57 59 divcan3d A2A2=A
62 54 60 61 3eqtr3d AA+A2AA2=A
63 47 48 62 3eqtrd AA+A22+iifA<011AA22=A
64 57 2 mulcld A2A+A2
65 64 4 11 mul12d A2A+A2iifA<011AA2=i2A+A2ifA<011AA2
66 57 2 12 mulassd A2A+A2iifA<011AA2=2A+A2iifA<011AA2
67 57 2 11 mulassd A2A+A2ifA<011AA2=2A+A2ifA<011AA2
68 2 26 27 mul12d AA+A2ifA<011AA2=ifA<011A+A2AA2
69 sqrtcvallem4 A0A+A2
70 halfnneg2 A+A0A+A0A+A2
71 19 70 syl A0A+A0A+A2
72 69 71 mpbird A0A+A
73 2rp 2+
74 73 a1i A2+
75 19 72 74 sqrtdivd AA+A2=A+A2
76 sqrtcvallem2 A0AA2
77 halfnneg2 AA0AA0AA2
78 37 77 syl A0AA0AA2
79 76 78 mpbird A0AA
80 37 79 74 sqrtdivd AAA2=AA2
81 75 80 oveq12d AA+A2AA2=A+A2AA2
82 19 72 resqrtcld AA+A
83 82 recnd AA+A
84 2re 2
85 84 a1i A2
86 0le2 02
87 86 a1i A02
88 85 87 resqrtcld A2
89 88 recnd A2
90 37 79 resqrtcld AAA
91 90 recnd AAA
92 sqrt00 2022=02=0
93 84 86 92 mp2an 2=02=0
94 93 necon3bii 2020
95 58 94 mpbir 20
96 95 a1i A20
97 83 89 91 89 96 96 divmuldivd AA+A2AA2=A+AAA22
98 18 resqcld AA2
99 98 recnd AA2
100 imcl AA
101 100 resqcld AA2
102 101 recnd AA2
103 absvalsq2 AA2=A2+A2
104 99 102 103 mvrladdd AA2A2=A2
105 subsq AAA2A2=A+AAA
106 49 50 105 syl2anc AA2A2=A+AAA
107 104 106 eqtr3d AA2=A+AAA
108 107 fveq2d AA2=A+AAA
109 100 absred AA=A2
110 reabsifneg AA=ifA<0AA
111 100 110 syl AA=ifA<0AA
112 109 111 eqtr3d AA2=ifA<0AA
113 19 72 37 79 sqrtmuld AA+AAA=A+AAA
114 108 112 113 3eqtr3rd AA+AAA=ifA<0AA
115 remsqsqrt 20222=2
116 84 86 115 mp2an 22=2
117 116 a1i A22=2
118 114 117 oveq12d AA+AAA22=ifA<0AA2
119 81 97 118 3eqtrd AA+A2AA2=ifA<0AA2
120 119 oveq2d AifA<011A+A2AA2=ifA<011ifA<0AA2
121 68 120 eqtrd AA+A2ifA<011AA2=ifA<011ifA<0AA2
122 121 oveq2d A2A+A2ifA<011AA2=2ifA<011ifA<0AA2
123 100 renegcld AA
124 123 100 ifcld AifA<0AA
125 124 recnd AifA<0AA
126 26 125 57 59 divassd AifA<011ifA<0AA2=ifA<011ifA<0AA2
127 ovif12 ifA<011ifA<0AA=ifA<0-1A1A
128 5 a1i A1
129 128 recnd A1
130 100 recnd AA
131 129 129 130 mulassd A-1-1A=-1-1A
132 neg1mulneg1e1 -1-1=1
133 132 a1i A-1-1=1
134 133 oveq1d A-1-1A=1A
135 130 mullidd A1A=A
136 134 135 eqtrd A-1-1A=A
137 130 mulm1d A-1A=A
138 137 oveq2d A-1-1A=-1A
139 131 136 138 3eqtr3rd A-1A=A
140 139 adantr AA<0-1A=A
141 135 adantr A¬A<01A=A
142 140 141 ifeqda AifA<0-1A1A=A
143 127 142 eqtrid AifA<011ifA<0AA=A
144 143 oveq1d AifA<011ifA<0AA2=A2
145 126 144 eqtr3d AifA<011ifA<0AA2=A2
146 145 oveq2d A2ifA<011ifA<0AA2=2A2
147 130 57 59 divcan2d A2A2=A
148 146 147 eqtrd A2ifA<011ifA<0AA2=A
149 67 122 148 3eqtrd A2A+A2ifA<011AA2=A
150 149 oveq2d Ai2A+A2ifA<011AA2=iA
151 65 66 150 3eqtr3d A2A+A2iifA<011AA2=iA
152 63 151 oveq12d AA+A22+iifA<011AA22+2A+A2iifA<011AA2=A+iA
153 1 resqcld AA+A22
154 153 recnd AA+A22
155 2 12 mulcld AA+A2iifA<011AA2
156 57 155 mulcld A2A+A2iifA<011AA2
157 12 sqcld AiifA<011AA22
158 154 156 157 add32d AA+A22+2A+A2iifA<011AA2+iifA<011AA22=A+A22+iifA<011AA22+2A+A2iifA<011AA2
159 replim AA=A+iA
160 152 158 159 3eqtr4d AA+A22+2A+A2iifA<011AA2+iifA<011AA22=A
161 16 160 eqtrd AA+A2+iifA<011AA22=A
162 20 69 sqrtge0d A0A+A2
163 1 10 crred AA+A2+iifA<011AA2=A+A2
164 162 163 breqtrrd A0A+A2+iifA<011AA2
165 reim A+A2+iifA<011AA2A+A2+iifA<011AA2=iA+A2+iifA<011AA2
166 13 165 syl AA+A2+iifA<011AA2=iA+A2+iifA<011AA2
167 166 163 eqtr3d AiA+A2+iifA<011AA2=A+A2
168 167 eqeq1d AiA+A2+iifA<011AA2=0A+A2=0
169 cnsqrt00 A+A2A+A2=0A+A2=0
170 21 169 syl AA+A2=0A+A2=0
171 half0 A+AA+A2=0A+A=0
172 55 171 syl AA+A2=0A+A=0
173 49 50 addcomd AA+A=A+A
174 173 eqeq1d AA+A=0A+A=0
175 addeq0 AAA+A=0A=A
176 50 49 175 syl2anc AA+A=0A=A
177 172 174 176 3bitrd AA+A2=0A=A
178 168 170 177 3bitrd AiA+A2+iifA<011AA2=0A=A
179 olc A=AA=AA=A
180 eqcom A2=A2A2=A2
181 180 a1i AA2=A2A2=A2
182 sqeqor AAA2=A2A=AA=A
183 50 49 182 syl2anc AA2=A2A=AA=A
184 103 eqeq1d AA2=A2A2+A2=A2
185 addid0 A2A2A2+A2=A2A2=0
186 99 102 185 syl2anc AA2+A2=A2A2=0
187 sqeq0 AA2=0A=0
188 130 187 syl AA2=0A=0
189 184 186 188 3bitrd AA2=A2A=0
190 181 183 189 3bitr3d AA=AA=AA=0
191 179 190 imbitrid AA=AA=0
192 191 ancld AA=AA=AA=0
193 178 192 sylbid AiA+A2+iifA<011AA2=0A=AA=0
194 simp2 AA=AA=0A=A
195 194 oveq2d AA=AA=0A+A=A+A
196 49 3ad2ant1 AA=AA=0A
197 196 negidd AA=AA=0A+A=0
198 195 197 eqtrd AA=AA=0A+A=0
199 198 oveq1d AA=AA=0A+A2=02
200 2cn 2
201 200 58 div0i 02=0
202 199 201 eqtrdi AA=AA=0A+A2=0
203 202 fveq2d AA=AA=0A+A2=0
204 sqrt0 0=0
205 203 204 eqtrdi AA=AA=0A+A2=0
206 simp3 AA=AA=0A=0
207 0red AA=AA=00
208 207 ltnrd AA=AA=0¬0<0
209 206 208 eqnbrtrd AA=AA=0¬A<0
210 209 iffalsed AA=AA=0ifA<011=1
211 194 oveq2d AA=AA=0AA=AA
212 49 49 subnegd AAA=A+A
213 49 2timesd A2A=A+A
214 212 213 eqtr4d AAA=2A
215 214 3ad2ant1 AA=AA=0AA=2A
216 211 215 eqtrd AA=AA=0AA=2A
217 216 oveq1d AA=AA=0AA2=2A2
218 49 57 59 divcan3d A2A2=A
219 218 3ad2ant1 AA=AA=02A2=A
220 217 219 eqtrd AA=AA=0AA2=A
221 220 fveq2d AA=AA=0AA2=A
222 210 221 oveq12d AA=AA=0ifA<011AA2=1A
223 absge0 A0A
224 17 223 resqrtcld AA
225 224 recnd AA
226 225 mullidd A1A=A
227 226 3ad2ant1 AA=AA=01A=A
228 222 227 eqtrd AA=AA=0ifA<011AA2=A
229 228 oveq2d AA=AA=0iifA<011AA2=iA
230 205 229 oveq12d AA=AA=0A+A2+iifA<011AA2=0+iA
231 4 225 mulcld AiA
232 231 3ad2ant1 AA=AA=0iA
233 232 addlidd AA=AA=00+iA=iA
234 230 233 eqtrd AA=AA=0A+A2+iifA<011AA2=iA
235 234 oveq2d AA=AA=0iA+A2+iifA<011AA2=iiA
236 ixi ii=1
237 236 a1i Aii=1
238 237 oveq1d AiiA=-1A
239 4 4 225 mulassd AiiA=iiA
240 225 mulm1d A-1A=A
241 238 239 240 3eqtr3d AiiA=A
242 241 3ad2ant1 AA=AA=0iiA=A
243 235 242 eqtrd AA=AA=0iA+A2+iifA<011AA2=A
244 243 fveq2d AA=AA=0iA+A2+iifA<011AA2=A
245 224 renegcld AA
246 245 rered AA=A
247 246 3ad2ant1 AA=AA=0A=A
248 244 247 eqtrd AA=AA=0iA+A2+iifA<011AA2=A
249 17 223 sqrtge0d A0A
250 224 le0neg2d A0AA0
251 249 250 mpbid AA0
252 251 3ad2ant1 AA=AA=0A0
253 248 252 eqbrtrd AA=AA=0iA+A2+iifA<011AA20
254 253 3expib AA=AA=0iA+A2+iifA<011AA20
255 193 254 syld AiA+A2+iifA<011AA2=0iA+A2+iifA<011AA20
256 4 13 mulcld AiA+A2+iifA<011AA2
257 256 sqrtcvallem1 AiA+A2+iifA<011AA2=0iA+A2+iifA<011AA20¬iA+A2+iifA<011AA2+
258 255 257 mpbid A¬iA+A2+iifA<011AA2+
259 13 14 161 164 258 eqsqrtd AA+A2+iifA<011AA2=A
260 259 eqcomd AA=A+A2+iifA<011AA2