Metamath Proof Explorer


Theorem stirlinglem3

Description: Long but simple algebraic transformations are applied to show that V , the Wallis formula for π , can be expressed in terms of A , the Stirling's approximation formula for the factorial, up to a constant factor. This will allow (in a later theorem) to determine the right constant factor to be put into the A , in order to get the exact Stirling's formula. (Contributed by Glauco Siliprandi, 29-Jun-2017)

Ref Expression
Hypotheses stirlinglem3.1 A = n n ! 2 n n e n
stirlinglem3.2 D = n A 2 n
stirlinglem3.3 E = n 2 n n e n
stirlinglem3.4 V = n 2 4 n n ! 4 2 n ! 2 2 n + 1
Assertion stirlinglem3 V = n A n 4 D n 2 n 2 n 2 n + 1

Proof

Step Hyp Ref Expression
1 stirlinglem3.1 A = n n ! 2 n n e n
2 stirlinglem3.2 D = n A 2 n
3 stirlinglem3.3 E = n 2 n n e n
4 stirlinglem3.4 V = n 2 4 n n ! 4 2 n ! 2 2 n + 1
5 nnnn0 n n 0
6 faccl n 0 n !
7 nncn n ! n !
8 5 6 7 3syl n n !
9 2cnd n 2
10 nncn n n
11 9 10 mulcld n 2 n
12 11 sqrtcld n 2 n
13 ere e
14 13 recni e
15 14 a1i n e
16 epos 0 < e
17 13 16 gt0ne0ii e 0
18 17 a1i n e 0
19 10 15 18 divcld n n e
20 19 5 expcld n n e n
21 12 20 mulcld n 2 n n e n
22 2rp 2 +
23 22 a1i n 2 +
24 nnrp n n +
25 23 24 rpmulcld n 2 n +
26 25 sqrtgt0d n 0 < 2 n
27 26 gt0ne0d n 2 n 0
28 nnne0 n n 0
29 10 15 28 18 divne0d n n e 0
30 nnz n n
31 19 29 30 expne0d n n e n 0
32 12 20 27 31 mulne0d n 2 n n e n 0
33 8 21 32 divcld n n ! 2 n n e n
34 1 fvmpt2 n n ! 2 n n e n A n = n ! 2 n n e n
35 33 34 mpdan n A n = n ! 2 n n e n
36 35 oveq1d n A n 4 = n ! 2 n n e n 4
37 3 fvmpt2 n 2 n n e n E n = 2 n n e n
38 21 37 mpdan n E n = 2 n n e n
39 38 oveq1d n E n 4 = 2 n n e n 4
40 36 39 oveq12d n A n 4 E n 4 = n ! 2 n n e n 4 2 n n e n 4
41 4nn0 4 0
42 41 a1i n 4 0
43 8 21 32 42 expdivd n n ! 2 n n e n 4 = n ! 4 2 n n e n 4
44 43 oveq1d n n ! 2 n n e n 4 2 n n e n 4 = n ! 4 2 n n e n 4 2 n n e n 4
45 8 42 expcld n n ! 4
46 21 42 expcld n 2 n n e n 4
47 42 nn0zd n 4
48 21 32 47 expne0d n 2 n n e n 4 0
49 45 46 48 divcan1d n n ! 4 2 n n e n 4 2 n n e n 4 = n ! 4
50 40 44 49 3eqtrd n A n 4 E n 4 = n ! 4
51 50 eqcomd n n ! 4 = A n 4 E n 4
52 51 oveq2d n 2 4 n n ! 4 = 2 4 n A n 4 E n 4
53 2nn0 2 0
54 53 a1i n 2 0
55 54 5 nn0mulcld n 2 n 0
56 faccl 2 n 0 2 n !
57 nncn 2 n ! 2 n !
58 55 56 57 3syl n 2 n !
59 58 sqcld n 2 n ! 2
60 9 11 mulcld n 2 2 n
61 60 sqrtcld n 2 2 n
62 11 15 18 divcld n 2 n e
63 62 55 expcld n 2 n e 2 n
64 61 63 mulcld n 2 2 n 2 n e 2 n
65 64 sqcld n 2 2 n 2 n e 2 n 2
66 23 25 rpmulcld n 2 2 n +
67 66 sqrtgt0d n 0 < 2 2 n
68 67 gt0ne0d n 2 2 n 0
69 23 rpne0d n 2 0
70 9 10 69 28 mulne0d n 2 n 0
71 11 15 70 18 divne0d n 2 n e 0
72 2z 2
73 72 a1i n 2
74 73 30 zmulcld n 2 n
75 62 71 74 expne0d n 2 n e 2 n 0
76 61 63 68 75 mulne0d n 2 2 n 2 n e 2 n 0
77 64 76 73 expne0d n 2 2 n 2 n e 2 n 2 0
78 59 65 77 divcan1d n 2 n ! 2 2 2 n 2 n e 2 n 2 2 2 n 2 n e 2 n 2 = 2 n ! 2
79 58 64 76 54 expdivd n 2 n ! 2 2 n 2 n e 2 n 2 = 2 n ! 2 2 2 n 2 n e 2 n 2
80 79 eqcomd n 2 n ! 2 2 2 n 2 n e 2 n 2 = 2 n ! 2 2 n 2 n e 2 n 2
81 80 oveq1d n 2 n ! 2 2 2 n 2 n e 2 n 2 2 2 n 2 n e 2 n 2 = 2 n ! 2 2 n 2 n e 2 n 2 2 2 n 2 n e 2 n 2
82 78 81 eqtr3d n 2 n ! 2 = 2 n ! 2 2 n 2 n e 2 n 2 2 2 n 2 n e 2 n 2
83 fveq2 n = m n ! = m !
84 oveq2 n = m 2 n = 2 m
85 84 fveq2d n = m 2 n = 2 m
86 oveq1 n = m n e = m e
87 id n = m n = m
88 86 87 oveq12d n = m n e n = m e m
89 85 88 oveq12d n = m 2 n n e n = 2 m m e m
90 83 89 oveq12d n = m n ! 2 n n e n = m ! 2 m m e m
91 90 cbvmptv n n ! 2 n n e n = m m ! 2 m m e m
92 1 91 eqtri A = m m ! 2 m m e m
93 fveq2 m = 2 n m ! = 2 n !
94 oveq2 m = 2 n 2 m = 2 2 n
95 94 fveq2d m = 2 n 2 m = 2 2 n
96 oveq1 m = 2 n m e = 2 n e
97 id m = 2 n m = 2 n
98 96 97 oveq12d m = 2 n m e m = 2 n e 2 n
99 95 98 oveq12d m = 2 n 2 m m e m = 2 2 n 2 n e 2 n
100 93 99 oveq12d m = 2 n m ! 2 m m e m = 2 n ! 2 2 n 2 n e 2 n
101 2nn 2
102 101 a1i n 2
103 id n n
104 102 103 nnmulcld n 2 n
105 58 64 76 divcld n 2 n ! 2 2 n 2 n e 2 n
106 92 100 104 105 fvmptd3 n A 2 n = 2 n ! 2 2 n 2 n e 2 n
107 106 oveq1d n A 2 n 2 = 2 n ! 2 2 n 2 n e 2 n 2
108 107 eqcomd n 2 n ! 2 2 n 2 n e 2 n 2 = A 2 n 2
109 108 oveq1d n 2 n ! 2 2 n 2 n e 2 n 2 2 2 n 2 n e 2 n 2 = A 2 n 2 2 2 n 2 n e 2 n 2
110 eqidd n m 2 m m e m = m 2 m m e m
111 99 adantl n m = 2 n 2 m m e m = 2 2 n 2 n e 2 n
112 110 111 104 64 fvmptd n m 2 m m e m 2 n = 2 2 n 2 n e 2 n
113 112 oveq1d n m 2 m m e m 2 n 2 = 2 2 n 2 n e 2 n 2
114 113 eqcomd n 2 2 n 2 n e 2 n 2 = m 2 m m e m 2 n 2
115 114 oveq2d n A 2 n 2 2 2 n 2 n e 2 n 2 = A 2 n 2 m 2 m m e m 2 n 2
116 82 109 115 3eqtrd n 2 n ! 2 = A 2 n 2 m 2 m m e m 2 n 2
117 89 cbvmptv n 2 n n e n = m 2 m m e m
118 117 a1i n n 2 n n e n = m 2 m m e m
119 118 fveq1d n n 2 n n e n 2 n = m 2 m m e m 2 n
120 119 eqcomd n m 2 m m e m 2 n = n 2 n n e n 2 n
121 120 oveq1d n m 2 m m e m 2 n 2 = n 2 n n e n 2 n 2
122 121 oveq2d n A 2 n 2 m 2 m m e m 2 n 2 = A 2 n 2 n 2 n n e n 2 n 2
123 106 105 eqeltrd n A 2 n
124 2 fvmpt2 n A 2 n D n = A 2 n
125 123 124 mpdan n D n = A 2 n
126 125 eqcomd n A 2 n = D n
127 126 oveq1d n A 2 n 2 = D n 2
128 3 a1i n E = n 2 n n e n
129 128 fveq1d n E 2 n = n 2 n n e n 2 n
130 129 eqcomd n n 2 n n e n 2 n = E 2 n
131 130 oveq1d n n 2 n n e n 2 n 2 = E 2 n 2
132 127 131 oveq12d n A 2 n 2 n 2 n n e n 2 n 2 = D n 2 E 2 n 2
133 116 122 132 3eqtrd n 2 n ! 2 = D n 2 E 2 n 2
134 52 133 oveq12d n 2 4 n n ! 4 2 n ! 2 = 2 4 n A n 4 E n 4 D n 2 E 2 n 2
135 134 oveq1d n 2 4 n n ! 4 2 n ! 2 2 n + 1 = 2 4 n A n 4 E n 4 D n 2 E 2 n 2 2 n + 1
136 135 mpteq2ia n 2 4 n n ! 4 2 n ! 2 2 n + 1 = n 2 4 n A n 4 E n 4 D n 2 E 2 n 2 2 n + 1
137 42 5 nn0mulcld n 4 n 0
138 9 137 expcld n 2 4 n
139 50 45 eqeltrd n A n 4 E n 4
140 138 139 mulcomd n 2 4 n A n 4 E n 4 = A n 4 E n 4 2 4 n
141 140 oveq1d n 2 4 n A n 4 E n 4 D n 2 E 2 n 2 = A n 4 E n 4 2 4 n D n 2 E 2 n 2
142 141 oveq1d n 2 4 n A n 4 E n 4 D n 2 E 2 n 2 2 n + 1 = A n 4 E n 4 2 4 n D n 2 E 2 n 2 2 n + 1
143 125 123 eqeltrd n D n
144 143 sqcld n D n 2
145 128 118 eqtrd n E = m 2 m m e m
146 145 111 104 64 fvmptd n E 2 n = 2 2 n 2 n e 2 n
147 146 64 eqeltrd n E 2 n
148 147 sqcld n E 2 n 2
149 nnne0 2 n ! 2 n ! 0
150 55 56 149 3syl n 2 n ! 0
151 58 64 150 76 divne0d n 2 n ! 2 2 n 2 n e 2 n 0
152 106 151 eqnetrd n A 2 n 0
153 125 152 eqnetrd n D n 0
154 143 153 73 expne0d n D n 2 0
155 146 76 eqnetrd n E 2 n 0
156 147 155 73 expne0d n E 2 n 2 0
157 139 144 138 148 154 156 divmuldivd n A n 4 E n 4 D n 2 2 4 n E 2 n 2 = A n 4 E n 4 2 4 n D n 2 E 2 n 2
158 157 eqcomd n A n 4 E n 4 2 4 n D n 2 E 2 n 2 = A n 4 E n 4 D n 2 2 4 n E 2 n 2
159 158 oveq1d n A n 4 E n 4 2 4 n D n 2 E 2 n 2 2 n + 1 = A n 4 E n 4 D n 2 2 4 n E 2 n 2 2 n + 1
160 35 33 eqeltrd n A n
161 160 42 expcld n A n 4
162 39 46 eqeltrd n E n 4
163 161 162 144 154 div23d n A n 4 E n 4 D n 2 = A n 4 D n 2 E n 4
164 163 oveq1d n A n 4 E n 4 D n 2 2 4 n E 2 n 2 = A n 4 D n 2 E n 4 2 4 n E 2 n 2
165 164 oveq1d n A n 4 E n 4 D n 2 2 4 n E 2 n 2 2 n + 1 = A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1
166 161 144 154 divcld n A n 4 D n 2
167 138 148 156 divcld n 2 4 n E 2 n 2
168 166 162 167 mulassd n A n 4 D n 2 E n 4 2 4 n E 2 n 2 = A n 4 D n 2 E n 4 2 4 n E 2 n 2
169 168 oveq1d n A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1 = A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1
170 162 167 mulcld n E n 4 2 4 n E 2 n 2
171 1cnd n 1
172 11 171 addcld n 2 n + 1
173 0red n 0
174 104 nnred n 2 n
175 2re 2
176 175 a1i n 2
177 nnre n n
178 176 177 remulcld n 2 n
179 1red n 1
180 178 179 readdcld n 2 n + 1
181 104 nngt0d n 0 < 2 n
182 174 ltp1d n 2 n < 2 n + 1
183 173 174 180 181 182 lttrd n 0 < 2 n + 1
184 183 gt0ne0d n 2 n + 1 0
185 166 170 172 184 divassd n A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1 = A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1
186 162 138 148 156 div12d n E n 4 2 4 n E 2 n 2 = 2 4 n E n 4 E 2 n 2
187 12 20 42 mulexpd n 2 n n e n 4 = 2 n 4 n e n 4
188 61 63 sqmuld n 2 2 n 2 n e 2 n 2 = 2 2 n 2 2 n e 2 n 2
189 187 188 oveq12d n 2 n n e n 4 2 2 n 2 n e 2 n 2 = 2 n 4 n e n 4 2 2 n 2 2 n e 2 n 2
190 146 oveq1d n E 2 n 2 = 2 2 n 2 n e 2 n 2
191 39 190 oveq12d n E n 4 E 2 n 2 = 2 n n e n 4 2 2 n 2 n e 2 n 2
192 12 42 expcld n 2 n 4
193 61 sqcld n 2 2 n 2
194 20 42 expcld n n e n 4
195 63 sqcld n 2 n e 2 n 2
196 61 68 73 expne0d n 2 2 n 2 0
197 63 75 73 expne0d n 2 n e 2 n 2 0
198 192 193 194 195 196 197 divmuldivd n 2 n 4 2 2 n 2 n e n 4 2 n e 2 n 2 = 2 n 4 n e n 4 2 2 n 2 2 n e 2 n 2
199 189 191 198 3eqtr4d n E n 4 E 2 n 2 = 2 n 4 2 2 n 2 n e n 4 2 n e 2 n 2
200 199 oveq2d n 2 4 n E n 4 E 2 n 2 = 2 4 n 2 n 4 2 2 n 2 n e n 4 2 n e 2 n 2
201 66 rprege0d n 2 2 n 0 2 2 n
202 resqrtth 2 2 n 0 2 2 n 2 2 n 2 = 2 2 n
203 201 202 syl n 2 2 n 2 = 2 2 n
204 203 oveq2d n 2 n 4 2 2 n 2 = 2 n 4 2 2 n
205 2t2e4 2 2 = 4
206 205 eqcomi 4 = 2 2
207 206 a1i n 4 = 2 2
208 207 oveq2d n 2 n 4 = 2 n 2 2
209 12 54 54 expmuld n 2 n 2 2 = 2 n 2 2
210 25 rprege0d n 2 n 0 2 n
211 resqrtth 2 n 0 2 n 2 n 2 = 2 n
212 210 211 syl n 2 n 2 = 2 n
213 212 oveq1d n 2 n 2 2 = 2 n 2
214 208 209 213 3eqtrd n 2 n 4 = 2 n 2
215 9 9 10 mulassd n 2 2 n = 2 2 n
216 205 a1i n 2 2 = 4
217 216 oveq1d n 2 2 n = 4 n
218 215 217 eqtr3d n 2 2 n = 4 n
219 214 218 oveq12d n 2 n 4 2 2 n = 2 n 2 4 n
220 9 10 sqmuld n 2 n 2 = 2 2 n 2
221 sq2 2 2 = 4
222 221 a1i n 2 2 = 4
223 222 oveq1d n 2 2 n 2 = 4 n 2
224 220 223 eqtrd n 2 n 2 = 4 n 2
225 224 oveq1d n 2 n 2 4 n = 4 n 2 4 n
226 4cn 4
227 4ne0 4 0
228 226 227 dividi 4 4 = 1
229 228 a1i n 4 4 = 1
230 10 sqvald n n 2 = n n
231 230 oveq1d n n 2 n = n n n
232 10 10 28 divcan4d n n n n = n
233 231 232 eqtrd n n 2 n = n
234 229 233 oveq12d n 4 4 n 2 n = 1 n
235 42 nn0cnd n 4
236 10 sqcld n n 2
237 227 a1i n 4 0
238 235 235 236 10 237 28 divmuldivd n 4 4 n 2 n = 4 n 2 4 n
239 10 mulid2d n 1 n = n
240 234 238 239 3eqtr3d n 4 n 2 4 n = n
241 225 240 eqtrd n 2 n 2 4 n = n
242 204 219 241 3eqtrd n 2 n 4 2 2 n 2 = n
243 10 235 mulcomd n n 4 = 4 n
244 243 oveq2d n n e n 4 = n e 4 n
245 19 42 5 expmuld n n e n 4 = n e n 4
246 10 15 18 137 expdivd n n e 4 n = n 4 n e 4 n
247 244 245 246 3eqtr3d n n e n 4 = n 4 n e 4 n
248 9 10 9 mul32d n 2 n 2 = 2 2 n
249 248 217 eqtrd n 2 n 2 = 4 n
250 249 oveq2d n 2 n e 2 n 2 = 2 n e 4 n
251 62 54 55 expmuld n 2 n e 2 n 2 = 2 n e 2 n 2
252 11 15 18 137 expdivd n 2 n e 4 n = 2 n 4 n e 4 n
253 250 251 252 3eqtr3d n 2 n e 2 n 2 = 2 n 4 n e 4 n
254 247 253 oveq12d n n e n 4 2 n e 2 n 2 = n 4 n e 4 n 2 n 4 n e 4 n
255 247 194 eqeltrrd n n 4 n e 4 n
256 11 137 expcld n 2 n 4 n
257 15 137 expcld n e 4 n
258 47 30 zmulcld n 4 n
259 11 70 258 expne0d n 2 n 4 n 0
260 15 18 258 expne0d n e 4 n 0
261 255 256 257 259 260 divdiv2d n n 4 n e 4 n 2 n 4 n e 4 n = n 4 n e 4 n e 4 n 2 n 4 n
262 10 137 expcld n n 4 n
263 262 257 260 divcan1d n n 4 n e 4 n e 4 n = n 4 n
264 263 oveq1d n n 4 n e 4 n e 4 n 2 n 4 n = n 4 n 2 n 4 n
265 9 10 137 mulexpd n 2 n 4 n = 2 4 n n 4 n
266 265 oveq2d n n 4 n 2 n 4 n = n 4 n 2 4 n n 4 n
267 138 262 mulcomd n 2 4 n n 4 n = n 4 n 2 4 n
268 267 oveq2d n n 4 n 2 4 n n 4 n = n 4 n n 4 n 2 4 n
269 10 28 258 expne0d n n 4 n 0
270 9 69 258 expne0d n 2 4 n 0
271 262 262 138 269 270 divdiv1d n n 4 n n 4 n 2 4 n = n 4 n n 4 n 2 4 n
272 262 269 dividd n n 4 n n 4 n = 1
273 272 oveq1d n n 4 n n 4 n 2 4 n = 1 2 4 n
274 268 271 273 3eqtr2d n n 4 n 2 4 n n 4 n = 1 2 4 n
275 264 266 274 3eqtrd n n 4 n e 4 n e 4 n 2 n 4 n = 1 2 4 n
276 254 261 275 3eqtrd n n e n 4 2 n e 2 n 2 = 1 2 4 n
277 242 276 oveq12d n 2 n 4 2 2 n 2 n e n 4 2 n e 2 n 2 = n 1 2 4 n
278 277 oveq2d n 2 4 n 2 n 4 2 2 n 2 n e n 4 2 n e 2 n 2 = 2 4 n n 1 2 4 n
279 138 270 reccld n 1 2 4 n
280 138 10 279 mul12d n 2 4 n n 1 2 4 n = n 2 4 n 1 2 4 n
281 10 mulid1d n n 1 = n
282 138 270 recidd n 2 4 n 1 2 4 n = 1
283 282 oveq2d n n 2 4 n 1 2 4 n = n 1
284 281 283 233 3eqtr4d n n 2 4 n 1 2 4 n = n 2 n
285 278 280 284 3eqtrd n 2 4 n 2 n 4 2 2 n 2 n e n 4 2 n e 2 n 2 = n 2 n
286 186 200 285 3eqtrd n E n 4 2 4 n E 2 n 2 = n 2 n
287 286 oveq1d n E n 4 2 4 n E 2 n 2 2 n + 1 = n 2 n 2 n + 1
288 236 10 172 28 184 divdiv1d n n 2 n 2 n + 1 = n 2 n 2 n + 1
289 287 288 eqtrd n E n 4 2 4 n E 2 n 2 2 n + 1 = n 2 n 2 n + 1
290 289 oveq2d n A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1 = A n 4 D n 2 n 2 n 2 n + 1
291 185 290 eqtrd n A n 4 D n 2 E n 4 2 4 n E 2 n 2 2 n + 1 = A n 4 D n 2 n 2 n 2 n + 1
292 165 169 291 3eqtrd n A n 4 E n 4 D n 2 2 4 n E 2 n 2 2 n + 1 = A n 4 D n 2 n 2 n 2 n + 1
293 142 159 292 3eqtrd n 2 4 n A n 4 E n 4 D n 2 E 2 n 2 2 n + 1 = A n 4 D n 2 n 2 n 2 n + 1
294 293 mpteq2ia n 2 4 n A n 4 E n 4 D n 2 E 2 n 2 2 n + 1 = n A n 4 D n 2 n 2 n 2 n + 1
295 4 136 294 3eqtri V = n A n 4 D n 2 n 2 n 2 n + 1