WHAT we want: many quantities are secretly expectations.
An integral ∫01g(x)dx=E[g(U)] where U∼Uniform(0,1).
A probability P(A)=E[1A] (expectation of an indicator).
π, option prices, particle-physics cross-sections — all are averages over randomness.
WHY we can estimate them: if a quantity equals E[X], and we draw independent copies X1,…,Xn of X, the sample meanXˉn=n1∑Xi should "settle down" to E[X]. That settling-down is the Law of Large Numbers.
HOW we use it: generate random samples → plug each into the function → average. Done.
Step 1 — Mean of the sample mean. Why? To know what it's centered on.
E[Xˉn]=n1∑i=1nE[Xi]=n1⋅nμ=μ.Why this step? Expectation is linear, so it passes through the sum. The estimator is unbiased.
Step 2 — Variance of the sample mean. Why? To measure spread shrinking.
Var(Xˉn)=n21Var(∑i=1nXi)=n21∑i=1nVar(Xi)=n21⋅nσ2=nσ2.Why this step?Independence lets variance of a sum equal the sum of variances (cross-covariances vanish). Pulling out n21 uses Var(aY)=a2Var(Y).
Step 3 — Chebyshev's inequality. Why? It bounds "how often far from the mean" using only variance.
P(∣Xˉn−μ∣≥ε)≤ε2Var(Xˉn)=nε2σ2.Why this step? Chebyshev says deviations bigger than ε are rare when variance is small.
Step 4 — Take the limit. As n→∞, nε2σ2→0. The squeeze forces the probability to 0. ■
WHY 1/n matters: to get one more decimal digit of accuracy (10× smaller error) you need 100× more samples. Dimension-independence is the payoff: this 1/n holds whether X is 1-D or 1000-D, which is why Monte Carlo crushes grid methods in high dimensions.
WHAT: Throw random darts in the unit square [0,1]2. Fraction landing inside the quarter-circle (x2+y2≤1) estimates the area π/4.
Let X=1{U12+U22≤1} with U1,U2∼Unif(0,1).
E[X]=P(inside)=area of squarearea of quarter disk=1π/4=4π.Why? Uniform points → probability = area ratio.
Estimator:π^=4Xˉn. Why ×4? Because Xˉn→π/4, multiply by 4 to recover π.
Error:X is Bernoulli(p=π/4≈0.785), so σg2=p(1−p)≈0.169. Then SE(π^)=4⋅0.169/n. For n=104, SE ≈0.016 — so π^ good to ~2 decimals. Why so slow? The fatal 1/n.
Forecast: I run the π estimate with n=100 then n=10000. How much should the error shrink? Ratio of n is 100, so 100=10. Predict: error drops by ~10×.
Verify (typical run):n=100⇒ error ∼0.16; n=10000⇒ error ∼0.016. ✔ Matches the 1/n law. Why this matters: it lets you plan compute budget before running anything.
Imagine you want to know what fraction of a giant pizza is pepperoni, but you can't see the whole thing. You blindly poke it with a toothpick lots of times and write down "pepperoni / not pepperoni" each time. After many pokes, the fraction of pepperoni pokes is close to the real answer. The more pokes, the closer — but to be twice as sure you need four times the pokes. That's Monte Carlo, and the "many pokes get you close" guarantee is the Law of Large Numbers.
Dekho, Monte Carlo ka idea bahut simple hai: jab kisi cheez ka average ya integral seedha calculate nahi kar paate, to hum usko randomly simulate karke, bahut saare samples ka average le lete hain. Maths ki guarantee yeh hai ki agar samples i.i.d. hain, to sample mean Xˉn dheere-dheere true mean μ ke paas pahunch jaata hai. Isi guarantee ko Law of Large Numbers kehte hain.
Proof ki feel samajh lo: sample mean ka expectation exactly μ hota hai (matlab unbiased), aur uska variance σ2/n hota hai. Jaise-jaise n badhta hai, variance gir jaata hai, to estimate spread chhota hota jaata hai. Chebyshev inequality lagao aur n→∞ par probability of "far from mean" zero ho jaati hai. Bas yahi pura khel hai.
Sabse important practical baat: error 1/n ki tarah girta hai, 1/n ki tarah nahi. Iska matlab — agar 10 guna zyada accuracy chahiye, to 100 guna zyada samples lagenge. Isliye Monte Carlo thoda slow hota hai, par high-dimensional problems mein ekdum zabardast, kyunki yeh 1/n dimension par depend nahi karta.
Example yaad rakho: π nikalne ke liye square mein random points daalo, jo quarter-circle ke andar girein unki fraction π/4 deti hai, 4 se multiply karke π mil jaata hai. Aur haan — answer ke saath hamesha error bar (±1.96σ^/n) likhna, kyunki Monte Carlo ka result random hota hai, sirf ek number likhna galti hai.