Samjhake
Introduction to Probability
Notes›Introduction to Probability›Lectures 7–9: Random Variables

MTH-PROB · Page 3 of 10

Lectures 7–9: Random Variables

Visual learning guide

See the logic before reading the proof

Use this map with the full English notes below. Every chapter’s definitions, formulas, examples, and solution method are represented as a visual route.

Lecture 7

Random variable: outcomes become numbers

X: Ω → ℝ; PMF collects probability at each output, CDF accumulates it

Outcome ω
Value X(ω)
PMF pX(x)
CDF FX(x)
Discrete support

Read this visual

  1. Different outcomes can map to the same X value.
  2. PMF values add to 1.
  3. CDF is non-decreasing, right-continuous, and ends at 1.

Hinglish: Random variable outcome ko number mein convert karta hai; CDF x tak jama probability dikhata hai.

Lecture 7: Random Variable
Definition: Random variable

Suppose \(|\Omega| < \infty\). Then a function \(X : \Omega \rightarrow \mathbb{R}\) is called a random variable.
In general, a random variable \(X\) is a "measurable" function \(X : \Omega \rightarrow \mathbb{R}\).


💡 Hinglish Concept:

  • Random Variable kya hai? Asal mein ye koi "variable" nahi, ek function hai! Jo kisi outcome ko ek number de deta hai.
  • Socho tumne coin uchaala aur Head aaya. Ab Maths ko "Head" shabd samajh nahi aata. Toh tum ek rule banate ho: "Agar Head aaya toh main usko 1 bolunga". Ye rule hi tumhara Random Variable \(X\) hai! (Jahan \(X(\text{Head}) = 1\)).
  • In short: Ye random experiments ki angrezi/hindi ko numbers mein translate karta hai taaki hum un par maths laga sakein.
Example 1: Coin toss

\(\Omega = \{H,T\}\), \(P(\{H\}) = p\), \(P(\{T\}) = 1-p\).

  1. (a) Define \[ X_1(\omega) = \begin{cases} 1 & \text{if } \omega = H \\ 0 & \text{if } \omega = T \end{cases} \] \(X_1\) is a random variable, where \[ P(\{X_1 = 1\}) := P(\{\omega \mid X_1(\omega) = 1\}) = P(\{H\}) = p. \] \[ P(\{X_1 = 0\}) = 1-p. \]
  2. (b) Define \[ X_2(\omega) = \begin{cases} 1 & \text{if } \omega = H \\ -1 & \text{if } \omega = T \end{cases} \] \[ P(\{X_2 = 1\}) = P(\{\omega \mid X_2(\omega) = 1\}) = p. \] \[ P(\{X_2 = -1\}) = 1-p. \]

💡 Hinglish Concept:

  • Ek hi game, alag-alag rules: Tumhare paas ek coin hai, par tum apni marzi se alag-alag random variables (RV) bana sakte ho.
  • (a) Pehla RV (\(X_1\)): Tumne decide kiya ki Head pe 1 point aur Tail pe 0 point. Ab \(X_1 = 1\) hone ka chance utna hi hoga jitna Head aane ka chance (yani \(p\)).
  • (b) Dusra RV (\(X_2\)): Tumne naya game banaya. Head aane pe +1 aur Tail aane pe -1. Ab \(X_2 = -1\) hone ka chance hoga Tails aane ke chance ke barabar (yani \(1-p\)).
  • Summary: Random Variable humari marzi par depend karta hai, par chances us event ke hisaab se hi rehte hain.
Example 2: Roll a die

\(\Omega = \{1,2,3,4,5,6\}\).
Define \[ X(\omega) = \begin{cases} 1 & \text{if } \omega \text{ is odd} \\ 0 & \text{if } \omega \text{ is even} \end{cases} \] Then \(X\) is a random variable, with \[ P(\{X = 1\}) := P(\{\omega \mid X(\omega) = 1\}) = P(\{1,3,5\}) = \frac{1}{2}. \] \[ P(\{X = 0\}) := P(\{\omega \mid X(\omega) = 0\}) = P(\{2,4,6\}) = \frac{1}{2}. \]

💡 Hinglish Concept:

  • Indicator RV: Ye ek special type ka RV hai jo sirf 1 ya 0 deta hai. Jaise ek switch! 1 matlab "ON" aur 0 matlab "OFF".
  • Yahan hamne switch ON (\(X = 1\)) tab kiya jab odd number aaya \(\{1, 3, 5\}\). Aur OFF (\(X = 0\)) tab kiya jab even aaya \(\{2, 4, 6\}\).
  • Odd aane ka chance kya hai? 3 numbers hain total 6 mein se, toh \(3/6 = 1/2\). Toh \(P(X = 1)\) seedha \(1/2\) ho gaya!
Example 3: Room allocation

Problem: Assigning \(n\) rooms to \(n\) students randomly.
Define for \(i=1,2,\dots,n\):
\(X(\omega) = i\) if \(\omega_i = 1\) (i.e., \(i\)-th student gets the room \#1). \[ P(\{X = i\}) = P(\{\omega \mid X(\omega) = i\}) = P(\{\omega \mid \omega_i = 1\}) = \frac{1}{n} \] \(X\) is a random variable with \(P(\{X = i\}) = \frac{1}{n}\) for \(i=1,2,\dots,n\).

💡 Hinglish Concept:

  • Room Allocation ko Number dena: \(n\) students aur \(n\) rooms hain. Humne poocha: "Room #1 kisko mila?". Jo bhi student us room mein jayega, uska roll number hi hamara Random Variable \(X\) ban jayega!
  • Maan lo \(X = 3\) matlab 3rd student ko Room #1 mila.
  • Ab kisi bhi specific student (jaise 3rd student) ko Room #1 milne ka chance kya hai? Kyunki sab randomly baante gaye hain, har ek student ka chance brabar hoga, jo ki \(1/n\) hai!
Example 4

Independent trials consisting of flipping a coin having probability \(p\) of coming up heads are continually performed until either a head occurs or a total of \(n\) flips is made. If we let \(X\) denote the number of times the coin is flipped.

Observe that \(X \in \{1,2,\dots,n\}\). The probabilities are as follows:

\begin{align*} P(\{X = 1\}) &= P(\{H\}) = p. \\ P(\{X = 2\}) &= P(\{T,H\}) = (1-p)p. \\ P(\{X = 3\}) &= P(\{T,T,H\}) = (1-p)^2 p. \\ &\dots \\ P(\{X = n\}) &= P(\{T, \dots, T, H\}) + P(\{T, \dots, T\}) \\ &= (1-p)^{n-1}p + (1-p)^n = (1-p)^{n-1}(p + 1 - p) = (1-p)^{n-1}. \end{align*}

Note,

\begin{align*} P\left(\bigcup_{i=1}^{n}\{X = i\}\right) &= \sum_{i=1}^{n} P(\{X = i\}) \\ &= \sum_{i=1}^{n-1} (1-p)^{i-1}p + (1-p)^{n-1} \\ &= \left[ 1 - (1-p)^{n-1} \right] + (1-p)^{n-1} = 1. \end{align*}

💡 Hinglish Concept:

  • Game: Jab tak Head na aaye, coin uchalte raho (Max \(n\) baar).
  • \(X\) yahan batata hai ki total kitne tosses hue.
  • Agar pehli baari mein Head aa gaya (\(X=1\)), toh game wahi khatam! Chance hai \(p\).
  • Agar dusri baari mein game khatam hua (\(X=2\)), iska matlab pehli baar Tails (\(1-p\)) aaya hoga, aur dusri baar Head (\(p\)). Chance = \((1-p)p\).
  • Lekin agar game aakhiri round (\(n\)-th toss) tak chala gaya (\(X=n\)), toh do baatein ho sakti hain: Ya toh aakhiri mein Head aake game finish hua, YA phir \(n\) baari pure ho gaye isliye game rokna pada (chahe Tails hi kyun na aaya ho). Isi vajah se aakhiri chance bas \((1-p)^{n-1}\) ban jata hai!
Definition: Discrete random variable
  1. (1) A random variable that can take on at most a countable number of possible values is said to be discrete.
  2. (2) For a discrete random variable \(X\), we denote the probability mass function (p.m.f.) \(p(a)\) of \(X\) by \[ p(a) = P(\{X = a\}) \] If \(X\) assumes one of the values \(x_1, x_2, \dots\) then \[ p(x_i) \ge 0 \quad \text{for } i=1,2,\dots \] \[ p(x) = 0 \quad \text{for all other values of } x. \] \[ \sum_{i=1}^{\infty} p(x_i) = 1 \]

💡 Hinglish Concept:

  • Discrete RV: "Discrete" ka matlab hai jise tum ungliyo par gin sako (jaise 1, 2, 3...). Jaise Ludo ke dice par 1.5 nahi aa sakta.
  • PMF (Probability Mass Function): Ye koi dariyawali cheez nahi hai. Ye bas ek list/table hai jo batati hai ki: "Number 1 aane ka kya chance hai?", "Number 2 aane ka kya chance hai?".
  • Rules of PMF:
    1. Chance kabhi negative nahi ho sakta (\(p(x_i) \ge 0\)).
    2. Agar saare possible numbers ke chances ko jod do, toh total hamesha 1 (100%) aayega (\(\sum p(x_i) = 1\)).
Examples of Discrete RVs
  1. Bernoulli random variable: is a discrete R.V. with \(X \in \{1,0\}\) where \(P(\{X = 1\}) = p\) and \(P(\{X = 0\}) = 1-p\).
  2. Binomial random variable: \(X \in \{0,1,\dots,n\}\) with p.m.f. \[ P(\{X = k\}) = \binom{n}{k} p^k (1-p)^{n-k}. \] (\(X = \text{\# heads in } n \text{ independent flipping of a coin}\)).
  3. Geometric random variable: \(X \in \{1,2,\dots\}\). The p.m.f. is given by \[ P(\{X = k\}) = (1-p)^{k-1}p, \quad k=1,2,\dots \] (Toss a coin until get the first head).
  4. Poisson random variable: \(X \in \{0,1,2,\dots\}\). The p.m.f. is given by \[ P(\{X = k\}) = e^{-\lambda} \frac{\lambda^k}{k!} \quad \text{for } k=0,1,\dots \]
  5. Negative Binomial random variable: \(X \in \{r, r+1, \dots\}\). The p.m.f. is given by \[ P(\{X = k\}) = \binom{k-1}{r-1} p^r (1-p)^{k-r}. \] (\# trials required to get heads \(r\) times).

💡 Hinglish Concept:

Ye Probability ki duniya ke "Superstars" hain!

  • Bernoulli: Bas ek coin toss! Head (1) ya Tail (0).
  • Binomial: Tumne coin ko \(n\) baar uchaala aur pucha "Batao kitne Heads aaye?".
  • Geometric: "Jab tak pehla Head na aa jaye, tab tak uchaalte raho." (Bina kisi limit ke). Iska formula batata hai ki kitne tosses lag gaye pehle Head ke liye.
  • Negative Binomial: Geometric ka bada bhai! Ye puchta hai "Jab tak \(r\) Heads na mil jaye, tab tak uchaalte raho."
  • Poisson: Ye time par depend karta hai. Jaise: "Agle 1 ghante mein kitne log call karenge?" (Count of events in a time interval).
Definition: Cumulative distribution function (CDF)

The cumulative distribution function (CDF) of a real valued random variable \(X\) is the function \(F_X : \mathbb{R} \rightarrow [0,1]\) defined as

\[ F_X(t) := P(\{X \le t\}) \quad \forall t \in \mathbb{R}. \]

Example: Suppose \(X \sim \text{Ber}(p)\). Then

\[ F_X(t) = \begin{cases} 0 & \text{if } t < 0 \\ 1-p & \text{if } 0 \le t < 1 \\ 1 & \text{if } t \ge 1 \end{cases} \]
t F_X(t) 1-p 1 1

💡 Hinglish Concept:

  • CDF (Cumulative Distribution Function): "Cumulative" matlab jodte jana. Ye function ek specific limit (\(t\)) set karta hai aur puchta hai: "Tumhara answer \(t\) ya usse chota aane ka total chance kya hai?".
  • (1) Agar \(t < 0\) (jaise -1): Coin toss mein -1 aa hi nahi sakta, toh chance seedha 0.
  • (2) Agar \(0 \le t < 1\) (jaise 0.5): Ab hume "0.5 ya usse chote" outcomes dhundne hain. Sirf '0' (Tail) qualify karega! Jiska chance \(1-p\) hai.
  • (3) Agar \(t \ge 1\) (jaise 2): Ab toh '0' aur '1' dono hi 2 se chote hain. Toh dono ke chances jod do. Total chance 1 (100%) ban gaya!
Lecture 8: Continuous Random Variables
Problem 1

The probability mass function of a random variable \(X\) is given by \(p(i) = \frac{c \lambda^i}{i!}\) where \(c\) is some positive value. Find:

  1. (1) \(c\)
  2. (2) \(P(\{X = 0\})\) and \(P(\{X > 2\})\).

Solution:
(1) Since \(\sum_{i=0}^{\infty} p(i) = 1\), we have

\[ c \sum_{i=0}^{\infty} \frac{\lambda^i}{i!} = 1 \implies c \cdot e^{\lambda} = 1 \implies c = e^{-\lambda}. \]

(2)

\[ P(\{X = 0\}) = e^{-\lambda} \cdot \frac{\lambda^0}{0!} = e^{-\lambda}. \]

For \(i=0,1,2,\dots\):

\begin{align*} P(\{X > 2\}) &= 1 - P(\{X = 0\}) - P(\{X = 1\}) - P(\{X = 2\}) \\ &= 1 - e^{-\lambda} - \lambda e^{-\lambda} - \frac{\lambda^2 e^{-\lambda}}{2}. \end{align*}

💡 Hinglish Concept:

  • Missing Puzzle Piece (c): Humein \(p(i)\) ka formula diya hai, par usme ek unknown \(c\) hai. Hum jaante hain ki PMF ke saare chances ka sum hamesha 1 hota hai. Toh bas sum ko 1 ke barabar rakho, aur wahan se \(c\) nikal aayega (jo ki \(e^{-\lambda}\) hoga).
  • "Kam se Kam" vs "Usse Jyada": (2) mein \(P(X > 2)\) poocha hai. Iska matlab hai 3, 4, 5... se infinity tak sabka sum! Ye toh bohot mushkil hai. Isliye hum shortcut lagate hain: 1 (Total) mein se \(X=0, 1, 2\) ko ghata (subtract) dete hain. Simple!
Problem 2

Toss a coin 100 times. Find the probability that the \#Heads appeared 40 to 60 times.


Solution:
Let \(X \sim Bin(n,p)\). Then

\[ P(\{40 \le X \le 60\}) = \sum_{k=40}^{60} \binom{100}{k} p^k (1-p)^{100-k}. \]

💡 Hinglish Concept:

  • Binomial Range: 100 baar coin fekna aur check karna ki Head kitni baar aaya. Isme \(X\) hamara "Number of Heads" hai.
  • Hume chahiye ki Head 40 se 60 ke beech (inclusive) aaye. Iska matlab hume pehle 40 Heads ka chance nikalna hoga, fir 41 ka, fir 42 ka... aur aise hi 60 tak!
  • Isiliye final formula mein ek sum (\(\Sigma\)) laga hai jahan limit 40 se 60 tak ja rahi hai, aur andar Binomial ka formula baitha hai.
Definition: Continuous random variable

A random variable \(X\) is said to be a continuous random variable if its cumulative distribution function (CDF) \(F_X(t)\) is continuous, that is,

\[ F_X(t) = P(\{X \le t\}) \quad \text{is continuous on } \mathbb{R}. \]

A function \(f\) is said to be the probability density function (pdf) of a continuous random variable \(X\) if

\[ P(\{a \le X \le b\}) = \int_{a}^{b} f(x)dx \quad \text{for all } a \le b. \]

💡 Hinglish Concept:

  • Continuous RV kya hai? Abhi tak hum un cheezon ki baat kar rahe the jinhe gina ja sake (1, 2, 3). Par kya tum apni height exactly gin sakte ho? Kya wo 170.000000... cm hai? Continuous RV me decimals ki koi limit nahi hoti.
  • PDF (Probability Density Function): Ye list ya table nahi hai, ek curve (graph) hai. Jab tumhe continuous RV me probability nikalni hoti hai, toh tum curve ke neeche ka Area (Integral) nikalte ho!
  • Jaise \(P(a \le X \le b)\) ka matlab hai \(a\) aur \(b\) ke beech curve ka Area.
Remarks
  1. (1) In particular, if \(X\) is a continuous random variable, then \(P(\{X = a\}) = 0\).
  2. (2) \(F_X(t) = P(\{X \le t\}) = \int_{-\infty}^{t} f(x)dx \implies F_X'(t) = f(t)\).
  3. (3) \(P(\{X \in \mathbb{R}\}) = 1 \implies \int_{-\infty}^{\infty} f(x)dx = 1\).

💡 Hinglish Concept:

Continuous maths ke 3 golden rules:

  • (1) "Exact" ki value hamesha ZERO hoti hai! Jaise barish EXACTLY 5.00000... mm hone ka chance practically zero hai. Hamesha range mein baat karni padti hai.
  • (2) Agar tum PDF curve ka area nikaloge toh wo CDF deta hai. Aur agar CDF ko differentiate (todoge) karoge, toh waapis PDF mil jayega. Ye Integration aur Differentiation ka magic hai.
  • (3) Curve ke neeche ka Total Area hamesha 1 hota hai. Kyunki 1 ka matlab hai 100% chance (ki kuch na kuch toh jaroor hoga).
Examples of Continuous RVs

1. Uniform random variable: \(X \sim \text{Unif}[0,1]\).
The pdf is given by

\[ f(x) = \begin{cases} 1 & \text{if } 0 \le x \le 1 \\ 0 & \text{otherwise} \end{cases} \]

2. Let \(a,b \in \mathbb{R}\) and \(X \sim \text{Unif}[a,b]\). The pdf is given by

\[ f(x) = \begin{cases} \frac{1}{b-a} & \text{if } a \le x \le b \\ 0 & \text{otherwise} \end{cases} \]

Problem: Suppose \(X \sim \text{Unif}[0,10]\). Find:
(a) \(P(\{X > 7\})\)   (b) \(P(\{X \le 4\})\)   (c) \(P(\{1 < X < 3\})\)

Solution:
Here \(f(x) = \frac{1}{10}\) if \(0 \le x \le 10\), and 0 otherwise.

  1. (a) \(P(\{X > 7\}) = \int_{7}^{\infty} f(x)dx = \int_{7}^{10} \frac{1}{10}dx = \frac{3}{10}\).
  2. (b) \(P(\{X \le 4\}) = \int_{-\infty}^{4} f(x)dx = \int_{0}^{4} \frac{1}{10}dx = \frac{4}{10} = \frac{2}{5}\).
  3. (c) \(P(\{1 < X < 3\}) = \int_{1}^{3} \frac{1}{10}dx = \frac{2}{10} = \frac{1}{5}\).

3. Exponential random variable: \(X \sim \exp(\lambda)\) for some \(\lambda > 0\). The pdf is given by

\[ f(x) = \begin{cases} \lambda e^{-\lambda x} & \text{if } x \ge 0 \\ 0 & \text{if } x < 0 \end{cases} \]

CDF: \(F_X(t) = \int_{0}^{t} \lambda e^{-\lambda x}dx = 1 - e^{-\lambda t}\) if \(t \ge 0\), and 0 if \(t < 0\).


4. Gamma random variable: \(X \sim \text{Gamma}(\alpha, \lambda)\), \(\lambda > 0, \alpha > 0\). The pdf is given by

\[ f(x) = \begin{cases} \frac{\lambda e^{-\lambda x} (\lambda x)^{\alpha-1}}{\Gamma(\alpha)} & \text{if } x \ge 0 \\ 0 & \text{if } x < 0 \end{cases} \]

where \(\Gamma(\alpha) = \int_{0}^{\infty} e^{-x} x^{\alpha-1}dx\) (Gamma function).


5. Beta random variable: \(X \sim \text{Beta}(\alpha, \beta)\), \(\alpha, \beta > 0\). The pdf is given by

\[ f(x) = \begin{cases} \frac{x^{\alpha-1} (1-x)^{\beta-1}}{B(\alpha, \beta)} & \text{if } 0 \le x \le 1 \\ 0 & \text{otherwise} \end{cases} \]

where \(B(\alpha, \beta) = \int_{0}^{1} x^{\alpha-1} (1-x)^{\beta-1}dx = \frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)}\).


6. Normal random variable: \(X \sim \mathcal{N}(\mu, \sigma^2)\), \(\mu \in \mathbb{R}, \sigma > 0\). The pdf is given by

\[ f(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x-\mu)^2}{2\sigma^2}}, \quad -\infty < x < \infty. \]

Problem: Suppose \(X \sim \mathcal{N}(0,1)\). Find (1) \(P(X > 0)\) (2) \(P(\{1 < X < 2.0\})\).

Solution:
(1) \(P(X > 0) = \frac{1}{\sqrt{2\pi}} \int_{0}^{\infty} e^{-\frac{x^2}{2}}dx = \frac{1}{2}\).
(2) \(P(\{1 < X < 2.0\}) = \frac{1}{\sqrt{2\pi}} \int_{1}^{2.0} e^{-\frac{x^2}{2}}dx\).


💡 Hinglish Concept:

  • Continuous Superstars: Ye kuch famous continuous RVs hain.
  • Uniform: Sab kuch equally likely! Jaise \([0, 10]\) ke beech koi bhi real number aane ka chance. Iska graph ek flat rectangle banta hai. Area 1 rakhne ke liye height \(1/10\) karni padti hai.
  • Exponential: Ye Wait Time batata hai (jaise agla customer kab aayega). Shuru mein aane ka chance jyada hota hai (\(\lambda e^{-\lambda x}\)), fir time ke sath dhire-dhire kam hota jata hai.
  • Gamma & Beta: Ye thode advance hain aur probabilities ke probabilities ko model karne mein kaam aate hain.
  • Normal (Gaussian): Duniya ki sabse important distribution! Famous Bell Curve. Standard Normal mein average (mean) 0 hota hai aur variance 1. Ye symmetric hota hai, matlab adha area (0.5) 0 ke left mein aur adha right mein hota hai.
Definition: Expectation

Let \(X\) be a discrete random variable with p.m.f \(p_k = P(\{X = x_k\})\) for \(k=1,2,\dots\). Then the expectation of \(X\) is denoted by \(E[X]\) and defined as

\[ E[X] = \sum_{k=1}^{\infty} x_k P(\{X = x_k\}) = \sum_{k=1}^{\infty} x_k p_k. \]

Similarly, \(E[g(X)] = \sum_{k=1}^{\infty} g(x_k) P(\{X = x_k\}) = \sum_{k=1}^{\infty} g(x_k) p_k\).

Let \(X\) be a continuous random variable with the pdf \(f\), then the expectation of \(X\) is defined as

\[ E[X] = \int_{-\infty}^{\infty} x f(x)dx. \]

More generally, \(E[g(X)] = \int_{-\infty}^{\infty} g(x) f(x)dx\).


💡 Hinglish Concept:

  • Expectation (Mean/Average): Ye batata hai ki "Agar main ye experiment baar-baar karu, toh on-average mujhe kya value milegi?".
  • Discrete mein: Har value ko uske aane ke chance (probability) se multiply karo aur sabko jod do (Sum). Jaise: \(1 \times P(1) + 2 \times P(2) \dots\)
  • Continuous mein: Summation (\(\Sigma\)) ban jata hai Integration (\(\int\))! Yahan hum value \(x\) ko uske PDF \(f(x)\) se multiply karke area nikalte hain.
Examples of Expectation

1. Suppose \(X \sim \text{Ber}(p)\). Then

\[ E[X] = 1 \times p + 0 \times (1-p) = p. \]

In particular if \(p = \frac{1}{2}\), \(E[X] = \frac{1}{2}\) (average of \(0\) and \(1\)).


2. Roll a die: Define a R.V. \(X\) such that \(P(X = k) = \frac{1}{6}\) for \(k=1,\dots,6\). Then

\[ E[X] = 1 \times \frac{1}{6} + 2 \times \frac{1}{6} + \dots + 6 \times \frac{1}{6} = \frac{1+2+\dots+6}{6} = \frac{21}{6} = 3.5 \quad \text{(mean/average)}. \]

3. Suppose \(X \sim \mathcal{N}(\mu, \sigma^2)\). Then

\begin{align*} E[X] &= \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} x e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx \\ &= \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} (\sigma t + \mu) e^{-t^2/2} \sigma dt \quad \text{(Substitute } x = \sigma t + \mu, dx = \sigma dt \text{)} \\ &= \frac{\sigma}{\sqrt{2\pi}} \int_{-\infty}^{\infty} t e^{-t^2/2} dt + \mu \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-t^2/2} dt \\ &= 0 + \mu = \mu. \end{align*}

As \(t e^{-t^2/2}\) is an odd function, its integral over \((-\infty, \infty)\) is 0, and \(\frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-t^2/2} dt = 1\) (Probability Measure of \(\mathcal{N}(0,1)\)).

H.W. Find \(E[X]\) if \(X \sim \text{Poi}(\lambda)\), \(\text{Exp}(\lambda)\), \(\text{Bin}(n,p)\).


💡 Hinglish Concept:

  • Expectation Examples:
  • 1. Bernoulli: Head aane pe 1 rupe, Tail aane pe 0. Agar Head ka chance \(p\) hai, toh on-average tum \(1 \times p + 0 \times (1-p) = p\) rupe hi kamaoge!
  • 2. Dice Roll: 1 se 6 tak sabka chance \(1/6\) hai. Sabka weighted average nikaloge toh \(3.5\) aayega. (Dhyan do: 3.5 dice pe hota hi nahi hai, par ye mathematical average hai!)
  • 3. Normal: Bell curve bilkul beech-o-beech (symmetric) hota hai. Toh uska average balance point wahi beech ka Center (\(\mu\)) hoga. Calculus (integration) karke bhi hum yahi prove karte hain.
Lecture 9: Moments and MGF
Definition: Variance

The variance of a random variable \(X\) is defined as

\[ Var(X) = E[(X - E[X])^2]. \]

💡 Hinglish Concept:

  • Variance (Failaav): Expectation (Mean) batata hai ki center kahan hai. Par data us center se kitna door faila hua hai? Ye Variance batata hai.
  • Hum check karte hain ki har ek value, Mean se kitna door hai \((X - E[X])\). Phir un sabka square karke (taaki negative aur positive aapas mein cancel na hon), unka average nikal lete hain.
  • Jitna bada Variance, matlab values Mean se utni hi zyada bikhri (scattered) hui hain.

Example 1: \(X \sim Ber(p)\).

\begin{align*} Var(X) &= E[(X - p)^2] = (1-p)^2 p + (0-p)^2 (1-p) \\ &= p(1-p)(1-p + p) = p(1-p). \end{align*}

Example 2: \(X \sim \mathcal{N}(\mu, \sigma^2)\), that is, its pdf is given by

\[ f(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x-\mu)^2}{2\sigma^2}}, \quad -\infty < x < \infty. \] \begin{align*} Var(X) &= E[(X - E[X])^2] = \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} (x-\mu)^2 e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx. \end{align*}

Let \(t = \frac{x-\mu}{\sigma} \implies dt = \frac{dx}{\sigma}\).

\begin{align*} Var(X) &= \frac{\sigma^2}{\sqrt{2\pi}} \int_{-\infty}^{\infty} t^2 e^{-\frac{t^2}{2}}dt \\ &= \frac{2\sigma^2}{\sqrt{2\pi}} \int_{0}^{\infty} t^2 e^{-t^2/2}dt \quad (\text{even function}) \end{align*}

Let \(y = \frac{t^2}{2} \implies dy = t dt \implies dt = \frac{dy}{\sqrt{2y}}\).

\begin{align*} Var(X) &= \frac{2\sigma^2}{\sqrt{2\pi}} \int_{0}^{\infty} (2y) e^{-y} \frac{dy}{\sqrt{2y}} \\ &= \frac{2\sigma^2}{\sqrt{\pi}} \int_{0}^{\infty} y^{1/2} e^{-y}dy \\ &= \frac{2\sigma^2}{\sqrt{\pi}} \Gamma\left(\frac{3}{2}\right) \\ &= \frac{2\sigma^2}{\sqrt{\pi}} \cdot \frac{1}{2} \Gamma\left(\frac{1}{2}\right) \quad \text{as } \Gamma\left(\frac{1}{2}\right) = \sqrt{\pi} \\ &= \sigma^2. \end{align*}

💡 Hinglish Concept:

  • Variance ke Examples:
  • Bernoulli: Iska variance \(p(1-p)\) aata hai. (Maximum variance tab hota hai jab \(p=0.5\), yani fair coin, kyunki uncertainty sabse zyada hoti hai).
  • Normal: Normal distribution ke symbol \(\mathcal{N}(\mu, \sigma^2)\) mein jo \(\sigma^2\) likha hota hai, wo actually uska Variance hi hai! Usko integration karke (gamma function ki madad se) mathematically prove kiya gaya hai ki Variance = \(\sigma^2\) hi aata hai.
Remarks
  1. (1) \(Var(X) \ge 0\).
  2. (2) \(Var(X) = 0\) iff \(X\) is a constant r.v., i.e., \(P(X = c) = 1\).
  3. (3) \(E[g_1(X) + g_2(X)] = E[g_1(X)] + E[g_2(X)]\).
  4. (4) \(E[c g(X)] = c E[g(X)]\). Follows from the definition of expectation.
  5. (5) \(Var(X) = E[X^2] - (E[X])^2\).
    Proof: \begin{align*} Var(X) &= E[(X - E[X])^2] \\ &= E[X^2 - 2XE[X] + (E[X])^2] \\ &= E[X^2] - 2(E[X])^2 + (E[X])^2 \\ &= E[X^2] - (E[X])^2. \end{align*}

Hinglish anuvaad

Variance ke basic properties aur shortcut formula diye hain. Neeche \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\) ka algebraic proof hai.

📌 Formula: Variance shortcut

\[\operatorname{Var}(X)=E[X^2]-(E[X])^2\]

English content ka matlab, step by step

(1) Squared deviation nonnegative, so expectation bhi \(\ge 0\). (2) Variance zero matlab squared deviation almost surely zero, yani \(X\) koi constant \(c\) probability 1 se leta hai.

(3)–(4) Expectation linear hai: sum aur constant ko bahar le sakte hain, independence ki requirement nahi. (5) Proof mein \((X-\mu)^2 = X^2 - 2\mu X + \mu^2\) with \(\mu = E[X]\); expectation lene par \(\mu\) constant hai, so \(E[-2\mu X] = -2\mu^2\) aur \(E[\mu^2] = \mu^2\).

Isliye \(\operatorname{Var}(X)=E[X^2]-(E[X])^2\).

Definition: Moments & MGF
  1. (1) Moments: If \(g(X) = X^k\) for \(k \in \mathbb{N}\). Then \[ m_k = E[g(X)] = E[X^k] \quad \leftarrow \text{known as } k\text{-th moment of } X. \]
  2. (2) Moment generating function (MGF): If \(g(X) = e^{tX}\), then \[ M_X(t) = E[g(X)] = E[e^{tX}] \quad \leftarrow \text{known as the moment generating fn of } X. \]

💡 Hinglish Concept:

  • Moments (\(m_k\)): Moments ka matlab hai Data ka shape kaisa hai. Jaise 1st moment (Mean) batata hai Center kahan hai. 2nd moment batata hai Failav (Variance) kitna hai. 3rd moment batata hai ki graph kitna jhuka hua hai (Skewness).
  • MGF (Moment Generating Function): Ye ek jaadui function hai! Jaise ek ATM se paise nikalte hain, is function se tum koi bhi Moment (1st, 2nd, 3rd) nikal sakte ho bas isko differentiate (derivative nikalna) karke aur \(t=0\) daal ke.
Remarks
  1. (1) \(M_X(t)\) generates moments. \[ M_X(t) = E[e^{tX}] = \sum_{k=0}^{\infty} \frac{t^k}{k!} E[X^k] \implies M_X(0) = 1. \] \[ M_X'(t) = \sum_{k=1}^{\infty} \frac{t^{k-1}}{(k-1)!} E[X^k] \implies M_X'(0) = E[X]. \] \[ M_X''(t) = \sum_{k=2}^{\infty} \frac{t^{k-2}}{(k-2)!} E[X^k] \implies M_X''(0) = E[X^2]. \] Thus, we can recover all the moments from MGF.
  2. (2) The Pareto distribution with parameter \(\alpha > 0\). Its pdf is given by \[ f_\alpha(x) = \begin{cases} (\alpha-1)x^{-\alpha} & x \ge 1 \\ 0 & \text{otherwise} \end{cases} \] Note: \(E[X] = \int_{1}^{\infty} (\alpha-1)x^{-(\alpha-1)}dx < \infty\) if \(\alpha > 2\).
    \(E[X^2] = (\alpha-1) \int_{1}^{\infty} x^{-(\alpha-2)}dx < \infty\) if \(\alpha > 3\).
    In particular, MGF does not exist for any \(t > 0\).
  3. (3) The existence of all moments does not ensure the existence of MGF.

💡 Hinglish Concept:

  • ATM Machine (MGF) kaise kaam karti hai?
  • Agar tum MGF ka 1 baar derivative nikal ke \(t=0\) rakhoge, toh tumhe 1st moment (Mean) milega.
  • Agar 2 baar derivative nikal ke \(t=0\) rakhoge, toh 2nd moment (\(E[X^2]\)) milega.
  • Warning! (Pareto case): Har RV ke paas ye jaadui ATM (MGF) nahi hota! Pareto distribution jaisi kuch cases mein, hum limits calculate nahi kar paate (infinity tak chala jata hai). Toh Moments (Mean, Variance) toh ho sakte hain, par MGF ka hona zaroori nahi hai.
Examples of MGF

1. \(X \sim Ber(p)\). Then

\[ m_k = E[X^k] = 1^k \cdot p + 0^k \cdot (1-p) = p \quad \text{for } k \in \mathbb{N}. \] \[ M_X(t) = E[e^{tX}] = e^t \cdot p + e^0 (1-p) = 1 - p + p e^t. \]

EX: Find \(M_X(t)\) when \(X \sim Bin(n,p)\), \(X \sim Geo(p)\), \(X \sim Poiss(\lambda)\).


2. \(X \sim \exp(\lambda)\), that is, its pdf is given by

\[ f(x) = \begin{cases} \lambda e^{-\lambda x} & ; 0 \le x < \infty \\ 0 & ; \text{otherwise} \end{cases} \] \begin{align*} M_X(t) &= E[e^{tX}] \\ &= \int_{0}^{\infty} e^{tx} \lambda e^{-\lambda x}dx \\ &= \lambda \int_{0}^{\infty} e^{-(\lambda-t)x}dx \\ &= \lambda \left[ \frac{e^{-(\lambda-t)x}}{-(\lambda-t)} \right]_{0}^{\infty} \\ &= \frac{\lambda}{\lambda-t} \quad \text{if } \lambda - t > 0 \implies t < \lambda. \end{align*}

3. \(X \sim \mathcal{N}(\mu, \sigma^2)\), pdf \(f(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x-\mu)^2}{2\sigma^2}} \ ; \ -\infty < x < \infty.\)

\begin{align*} M_X(t) &= E[e^{tX}] \\ &= \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} e^{tx} e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx \\ &= \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} e^{-\frac{x^2 - 2\mu x + \mu^2 - 2t\sigma^2 x}{2\sigma^2}}dx \\ &= \frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} e^{-\frac{(x-(\mu+t\sigma^2))^2 + \mu^2 - (\mu+t\sigma^2)^2}{2\sigma^2}}dx \\ &= \frac{1}{\sqrt{2\pi}\sigma} e^{\frac{(\mu+t\sigma^2)^2 - \mu^2}{2\sigma^2}} \int_{-\infty}^{\infty} e^{-\frac{(x-(\mu+t\sigma^2))^2}{2\sigma^2}}dx \\ &= e^{\frac{2\mu t\sigma^2 + t^2\sigma^4}{2\sigma^2}} \cdot 1 \\ &= e^{\mu t + \frac{t^2\sigma^2}{2}} \end{align*}

(As \(\frac{1}{\sqrt{2\pi}\sigma} \int_{-\infty}^{\infty} e^{-\frac{(x-(\mu+t\sigma^2))^2}{2\sigma^2}}dx = 1\), since it's the integral of a Normal pdf with mean \(\mu+t\sigma^2\) and variance \(\sigma^2\)).

In particular, if \(X \sim \mathcal{N}(0,1)\) then \(M_X(t) = e^{t^2/2}\).

EX: Find \(M_X(t)\) when \(X \sim \text{Gamma}(\alpha, \lambda)\), \(X \sim \text{Unif}[a,b]\).

💡 Hinglish Concept:

  • Kuch Famous MGFs:
  • 1. Bernoulli: Head (1) pe \(e^t\) aur Tail (0) pe \(e^0=1\) milega. Toh MGF hoga: \((1-p) \times 1 + p \times e^t\). Simple!
  • 2. Exponential: Integration karne ke baad, iska MGF \(\lambda / (\lambda - t)\) aata hai. Par dhyan rahe, ye tabhi kaam karega jab \(t < \lambda\) ho, warna area infinity chala jayega (blast ho jayega!).
  • 3. Normal: Iska MGF integration me complete square ka trick lagake nikalte hain. Standard normal ke liye ye \(e^{t^2/2}\) ban jata hai.