Random Variable
Random Variable: Definition, Types and 10 Solved Examples
Definition of Random Variable
A random variable is a real-valued function defined on the sample space of a random experiment.
\( X:S\rightarrow \mathbb{R} \)
It assigns a numerical value to every possible outcome of a random experiment.
Example
Suppose two coins are tossed. The sample space is
\( S=\{HH,HT,TH,TT\}. \)
Let \(X\) denote the number of heads obtained. Then
\(X(HH)=2,\quad X(HT)=1,\quad X(TH)=1,\quad X(TT)=0.\)
Therefore,
\(X\in\{0,1,2\}.\)
Types of Random Variables
1. Discrete Random Variable
A random variable is called discrete if it takes a finite or countably infinite number of values.
Its probability mass function (PMF) is
\(p_X(x)=P(X=x)\)
and it satisfies
\(p_X(x)\geq 0,\qquad \sum_x p_X(x)=1.\)
2. Continuous Random Variable
A random variable is called continuous if it can take any value in an interval of the real line.
It is described by a probability density function \(f_X(x)\) satisfying
\(f_X(x)\geq0\)
\(\displaystyle \int_{-\infty}^{\infty}f_X(x)\,dx=1.\)
For a continuous random variable,
\(\displaystyle P(a<X<b)=\int_a^b f_X(x)\,dx.\)
Also,
\(P(X=x)=0.\)
10 University-Level Solved Examples
Question 1: Number of Heads in Three Coin Tosses
Three fair coins are tossed. Let \(X\) denote the number of heads obtained.
Find:
- The probability distribution of \(X\)
- \(E(X)\)
- \(\operatorname{Var}(X)\)
Show Solution
The possible values of \(X\) are
\(X=0,1,2,3.\)
Since three fair coins are tossed, the total number of equally likely outcomes is
\(2^3=8.\)
The probability of obtaining \(x\) heads is
\[ P(X=x)=\frac{\binom{3}{x}}{8}. \]
| \(x\) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| \(P(X=x)\) | \(1/8\) | \(3/8\) | \(3/8\) | \(1/8\) |
Now,
\[ E(X)=\sum xP(X=x). \]
\[ E(X) =0\left(\frac18\right) +1\left(\frac38\right) +2\left(\frac38\right) +3\left(\frac18\right). \]
\[ \boxed{E(X)=\frac32}. \]
Since \(X\sim Binomial(3,1/2)\),
\[ \operatorname{Var}(X)=np(1-p). \]
\[ =3\left(\frac12\right)\left(\frac12\right) =\boxed{\frac34}. \]
Type: Discrete Random Variable.
Question 2: Random Variable Defined on a Die
A fair die is rolled once. Define
\[ X= \begin{cases} 0,&\text{if the result is odd},\\ 2,&\text{if the result is even}. \end{cases} \]
Find the probability distribution, mean and variance of \(X\).
Show Solution
There are three odd numbers and three even numbers on a die.
\[ P(X=0)=\frac36=\frac12. \]
\[ P(X=2)=\frac36=\frac12. \]
Therefore,
\[ E(X)=0\left(\frac12\right) +2\left(\frac12\right)=1. \]
Next,
\[ E(X^2)=0^2\left(\frac12\right) +2^2\left(\frac12\right)=2. \]
Hence,
\[ \operatorname{Var}(X) =E(X^2)-[E(X)]^2. \]
\[ =2-1^2=1. \]
\[ \boxed{E(X)=1,\qquad \operatorname{Var}(X)=1}. \]
Type: Discrete Random Variable.
Question 3: Find the Unknown Constant in a PMF
A random variable \(X\) has probability mass function
\[ P(X=x)=kx,\qquad x=1,2,3,4. \]
Find:
- \(k\)
- \(P(X\geq3)\)
- \(E(X)\)
Show Solution
Since the total probability must equal 1,
\[ \sum_{x=1}^{4}kx=1. \]
\[ k(1+2+3+4)=1. \]
\[ 10k=1. \]
\[ \boxed{k=\frac1{10}}. \]
Now,
\[ P(X\geq3) =P(X=3)+P(X=4). \]
\[ =\frac3{10}+\frac4{10} =\boxed{\frac7{10}}. \]
For the expectation,
\[ E(X)=\sum xP(X=x). \]
\[ E(X) =\frac1{10}(1^2+2^2+3^2+4^2). \]
\[ =\frac{30}{10}=3. \]
\[ \boxed{E(X)=3}. \]
Type: Discrete Random Variable.
Question 4: Binomial Random Variable
A component has probability \(0.2\) of being defective. Five independently selected components are inspected.
Let \(X\) be the number of defective components. Find \(P(X=2)\), \(E(X)\), and \(\operatorname{Var}(X)\).
Show Solution
Here,
\[ X\sim Binomial(5,0.2). \]
Using
\[ P(X=x)=\binom{n}{x}p^x(1-p)^{n-x}, \]
we obtain
\[ P(X=2) =\binom52(0.2)^2(0.8)^3. \]
\[ =10(0.04)(0.512) =\boxed{0.2048}. \]
The mean is
\[ E(X)=np=5(0.2)=\boxed{1}. \]
The variance is
\[ \operatorname{Var}(X)=np(1-p). \]
\[ =5(0.2)(0.8)=\boxed{0.8}. \]
Type: Discrete Random Variable.
Question 5: Geometric Random Variable
The probability that a machine produces an acceptable item is \(0.8\). Items are inspected independently until the first acceptable item appears.
Let \(X\) denote the number of inspections required. Find \(P(X=4)\), \(E(X)\), and \(\operatorname{Var}(X)\).
Show Solution
Success probability is
\[ p=0.8. \]
Therefore, failure probability is
\[ 1-p=0.2. \]
For the first success to occur on the fourth trial, the first three trials must fail.
\[ P(X=4)=(0.2)^3(0.8). \]
\[ \boxed{P(X=4)=0.0064}. \]
For a geometric random variable,
\[ E(X)=\frac1p. \]
\[ E(X)=\frac1{0.8}=\boxed{1.25}. \]
Also,
\[ \operatorname{Var}(X) =\frac{1-p}{p^2}. \]
\[ =\frac{0.2}{0.8^2} =\boxed{0.3125}. \]
Type: Discrete Random Variable.
Question 6: Find the Constant in a Probability Density Function
A continuous random variable \(X\) has density
\[ f_X(x)= \begin{cases} kx,&0<x<2,\\ 0,&\text{otherwise}. \end{cases} \]
Find \(k\) and \(P(0.5<X<1.5)\).
Show Solution
Since the total area under the density must be 1,
\[ \int_0^2 kx\,dx=1. \]
\[ k\left[\frac{x^2}{2}\right]_0^2=1. \]
\[ 2k=1. \]
\[ \boxed{k=\frac12}. \]
Therefore,
\[ f_X(x)=\frac{x}{2},\qquad0<x<2. \]
Now,
\[ P(0.5<X<1.5) = \int_{0.5}^{1.5}\frac{x}{2}\,dx. \]
\[ = \left[\frac{x^2}{4}\right]_{0.5}^{1.5}. \]
\[ =\frac{2.25-0.25}{4} =\boxed{\frac12}. \]
Type: Continuous Random Variable.
Question 7: Mean and Variance from a PDF
Let
\[ f_X(x)= \begin{cases} 2x,&0<x<1,\\ 0,&\text{otherwise}. \end{cases} \]
Find \(E(X)\) and \(\operatorname{Var}(X)\).
Show Solution
The expectation is
\[ E(X)=\int_0^1 x(2x)\,dx. \]
\[ =2\int_0^1x^2\,dx =2\left[\frac{x^3}{3}\right]_0^1. \]
\[ \boxed{E(X)=\frac23}. \]
Next,
\[ E(X^2) =\int_0^1x^2(2x)\,dx. \]
\[ =2\int_0^1x^3\,dx =\frac12. \]
Therefore,
\[ \operatorname{Var}(X) = E(X^2)-[E(X)]^2. \]
\[ =\frac12-\left(\frac23\right)^2. \]
\[ =\frac12-\frac49 =\boxed{\frac1{18}}. \]
Type: Continuous Random Variable.
Question 8: Uniform Random Variable
A waiting time \(X\), measured in minutes, is uniformly distributed over the interval \([2,10]\).
Find \(P(4<X<7)\), \(E(X)\), and \(\operatorname{Var}(X)\).
Show Solution
Since
\[ X\sim U(2,10), \]
the density is
\[ f_X(x)=\frac{1}{10-2}=\frac18. \]
Therefore,
\[ P(4<X<7) = \int_4^7\frac18\,dx. \]
\[ =\frac{7-4}{8} =\boxed{\frac38}. \]
The mean of a uniform random variable is
\[ E(X)=\frac{a+b}{2}. \]
\[ =\frac{2+10}{2} =\boxed{6}. \]
Its variance is
\[ \operatorname{Var}(X) =\frac{(b-a)^2}{12}. \]
\[ =\frac{(10-2)^2}{12} =\boxed{\frac{16}{3}}. \]
Type: Continuous Random Variable.
Question 9: Exponential Random Variable
The lifetime \(X\) of an electronic device, measured in years, has probability density function
\[ f_X(x)=2e^{-2x},\qquad x\geq0. \]
Find \(P(X>2)\), \(E(X)\), and \(\operatorname{Var}(X)\).
Show Solution
We have
\[ P(X>2) = \int_2^\infty2e^{-2x}\,dx. \]
Since
\[ \int2e^{-2x}\,dx=-e^{-2x}, \]
therefore
\[ P(X>2) = \left[-e^{-2x}\right]_2^\infty. \]
\[ =e^{-4}. \]
\[ \boxed{P(X>2)\approx0.0183}. \]
Here the exponential rate is
\[ \lambda=2. \]
Therefore,
\[ E(X)=\frac1{\lambda} =\boxed{\frac12}. \]
Also,
\[ \operatorname{Var}(X) =\frac1{\lambda^2} =\boxed{\frac14}. \]
Type: Continuous Random Variable.
Question 10: Transformation of a Random Variable
Let \(X\) have probability density
\[ f_X(x)= \begin{cases} 2x,&0<x<1,\\ 0,&\text{otherwise}. \end{cases} \]
Define
\[ Y=X^2. \]
Find the probability density function of \(Y\).
Show Solution
Since
\[ 0<X<1, \]
we have
\[ 0<Y<1. \]
Since
\[ Y=X^2, \]
we obtain
\[ X=\sqrt{Y}. \]
The transformation formula is
\[ f_Y(y) = f_X(x) \left|\frac{dx}{dy}\right|. \]
Since
\[ x=\sqrt y, \]
we get
\[ \frac{dx}{dy} = \frac1{2\sqrt y}. \]
Therefore,
\[ f_Y(y) = 2\sqrt y \left(\frac1{2\sqrt y}\right). \]
\[ \boxed{f_Y(y)=1,\qquad0<y<1}. \]
Hence,
\[ \boxed{Y\sim U(0,1)}. \]
Type: Continuous Random Variable.
Important Formulas
Discrete Random Variable
\[ \boxed{E(X)=\sum_x xP(X=x)} \]
\[ \boxed{E(X^2)=\sum_xx^2P(X=x)} \]
\[ \boxed{\operatorname{Var}(X)=E(X^2)-[E(X)]^2} \]
Continuous Random Variable
\[ \boxed{ E(X)=\int_{-\infty}^{\infty}xf_X(x)\,dx } \]
\[ \boxed{ E(X^2)=\int_{-\infty}^{\infty}x^2f_X(x)\,dx } \]
\[ \boxed{ \operatorname{Var}(X)=E(X^2)-[E(X)]^2 } \]
Cumulative Distribution Function
For both discrete and continuous random variables,
\[ \boxed{F_X(x)=P(X\leq x)} \]
For a continuous random variable,
\[ F_X(x) = \int_{-\infty}^{x}f_X(t)\,dt. \]
Comments
Post a Comment