4.9.25 · HinglishProbability Theory & Statistics

Monte Carlo simulation — law of large numbers basis

1,731 words8 min readRead in English

4.9.25 · Maths › Probability Theory & Statistics


Monte Carlo kaam karta hi KYUN hai?

KYA chahiye humein: kai quantities secretly expectations hoti hain.

  • Ek integral jahan .
  • Ek probability (ek indicator ki expectation).
  • , option prices, particle-physics cross-sections — sab randomness par averages hain.

KYUN hum inhe estimate kar sakte hain: agar koi quantity ke barabar hai, aur hum ke independent copies draw karte hain, toh sample mean ko par "settle" ho jaana chahiye. Yahi "settle down" karna hai Law of Large Numbers.

KAISE use karte hain: random samples generate karo → har ek ko function mein daalo → average karo. Ho gaya.


Law of Large Numbers (derived, not dumped)

Ise first principles se derive karna

Step 1 — Sample mean ka Mean. Kyun? Yeh jaanne ke liye ki yeh kis par centered hai. Yeh step kyun? Expectation linear hai, isliye yeh sum mein se pass ho jaati hai. Estimator unbiased hai.

Step 2 — Sample mean ka Variance. Kyun? Spread ko shrink hota dekhne ke liye. Yeh step kyun? Independence ki wajah se sum ka variance, variances ke sum ke barabar hota hai (cross-covariances zero ho jaate hain). bahar nikalna use karta hai.

Step 3 — Chebyshev's inequality. Kyun? Yeh "mean se kitni baar door" ko sirf variance use karke bound karta hai. Yeh step kyun? Chebyshev kehta hai ki se bade deviations rare hote hain jab variance chhota ho.

Step 4 — Limit lo. Jaise , . Squeeze probability ko 0 force karta hai.


Monte Carlo estimator aur uska error

kyun important hai: ek aur decimal digit ki accuracy paane ke liye (10× chhota error) aapko 100× zyada samples chahiye. Dimension-independence iska faayda hai: yeh tab bhi hold karta hai chahe 1-D ho ya 1000-D, isliye Monte Carlo high dimensions mein grid methods ko peeche chhod deta hai.

Figure — Monte Carlo simulation — law of large numbers basis

Worked Example 1 — Estimate karna

KYA: Unit square mein random darts pheenko. Andar girne wale darts ka fraction jo quarter-circle () ke andar hai, area estimate karta hai.

  • Maano jahan .
  • Kyun? Uniform points → probability = area ratio.

Estimator: . ×4 kyun? Kyunki , isliye recover karne ke liye 4 se multiply karo.

Error: Bernoulli() hai, isliye . Toh . ke liye, SE — yani ~2 decimals tak sahi. Itna slow kyun? Woh fatal .


Worked Example 2 — Ek 1-D Integral

estimate karo (koi elementary antiderivative nahi hai).

  • Likho , . Kyun? kyunki Uniform density par 1 hai.
  • draw karo, compute karo . Kyun? Yeh ka sample mean hai; LLN ⇒ .
  • Standard error: samples se estimate karo, report karo. Kyun? CLT interval deta hai; imaandaari ke liye error bars zaroori hain.

Worked Example 3 — Forecast-then-Verify

Forecast: Main estimate aur phir ke saath run karta hoon. Error kitna shrink hona chahiye? ka ratio 100 hai, isliye . Prediction: error ~10× kam hoga.

Verify (typical run): error ; error . ✔ law se match karta hai. Yeh kyun matter karta hai: yeh aapko kuch bhi run karne se pehle compute budget plan karne deta hai.


Common Mistakes (Steel-manned)


Recall Feynman: ek 12-saal ke bachche ko samjhao

Socho tum jaanna chahte ho ki ek giant pizza ka kitna hissa pepperoni hai, lekin tum poora pizza nahi dekh sakte. Tum aankhein band karke use toothpick se bahut baar poke karte ho aur har baar "pepperoni / not pepperoni" likhte ho. Bahut pokes ke baad, pepperoni pokes ka fraction real answer ke paas hoga. Jitne zyada pokes, utna paas — lekin do guna sure hone ke liye chaar guna pokes chahiye. Yahi Monte Carlo hai, aur "kai pokes se paas pohoncho" ki guarantee Law of Large Numbers hai.


Active Recall

Weak Law of Large Numbers kya kehta hai?
I.i.d. variables ka sample mean probability mein true mean par converge karta hai: jaise .
Monte Carlo estimator unbiased kyun hai?
Expectation ki linearity se, , isliye uski expected value target ke barabar hoti hai.
Sample mean ka variance derive karo.
, independence aur use karke.
Monte Carlo estimate ka standard error kya hai?
, jahan .
10× chhota Monte Carlo error paane ke liye kitne zyada samples chahiye?
100× zyada (kyunki error ).
WLLN proof ko kaun si inequality power karti hai aur yeh kya bound karti hai?
Chebyshev's inequality: .
Monte Carlo se kaise estimate karte hain?
mein uniform points pheenko, fraction jo ke andar hai (= ) lo, 4 se multiply karo: .
Integral ko expectation mein kaise likha jaata hai?
ke roop mein jahan , kyunki Uniform density par 1 hoti hai.
Monte Carlo / LLN kab fail ho sakta hai?
Jab samples independent nahi hote, ya integrand ka mean/variance infinite ho (heavy tails), toh sample mean theek se converge nahi karta.
High dimensions mein Monte Carlo kyun prefer kiya jaata hai?
Uska error dimension se independent hai, unlike grid methods jinka cost dimension ke saath explode karta hai.

Connections

  • Central Limit Theorem — confidence interval / error bars deta hai.
  • Chebyshev's Inequality — WLLN proof ka engine.
  • Strong Law of Large Numbers — almost-sure convergence (WLLN se stronger).
  • Variance and Covariance — kyun independence variance ko add karne deti hai.
  • Importance Sampling reduce karta hai wall ko beat karne ke liye.
  • Numerical Integration — deterministic alternative jisse Monte Carlo compete karta hai.
  • Bernoulli Distribution — indicator-based estimates jaise ke liye model.

Concept Map

integral = E[g(U)]

P(A) = E[indicator]

averages n samples

justified by

derived from

derived from

uses independence

derived from

take limit n to infinity

guarantees

error scales

governs

Quantities as expectations

Monte Carlo estimator

Sample mean X-bar

Weak Law of Large Numbers

Step 1 mean = mu, unbiased

Step 2 variance = sigma^2 / n

Step 3 Chebyshev inequality

Convergence in probability

Accuracy like 1 over sqrt n

Deep Dive