Probability and Random Variables: Numerical
Problems
Dr. Prabhat Sharma
Problem 1: Basic Probability
A fair six-sided die is rolled once. Let X represent the number showing on the
die.
i
1. What is the probability that X is greater than 4?
I
2. What is the probability that X is less than or equal to 2?
Solution:
12 46 35s
yet
j 1. The possible outcomes of rolling a die are {1, 2, 3, 4, 5, 6}.
4643
• X > 4 means X can be either 5 or 6.
14146
• Therefore, the number of favorable outcomes is 2.
• The total number of outcomes is 6.
O
• Probability P (X > 4) = 2
6 = 1
3 ⇡ 0.333.
2. X 2 means X can be either 1 or 2.
• Therefore, the number of favorable outcomes is 2.
• Probability P (X 2) = 2
6 = 1
3 ⇡ 0.333.
Problem 2: Expected Value of a Discrete Random
Variable pros
A game involves tossing a fair coin. If heads appear, you win $5. If tails appear,
you lose $2. Let the random variable Y represent your earnings.
t
1. Define the probability distribution for Y .
u
2. Calculate the expected value of Y .
y
Solution:
1. There are two possible outcomes: Heads or Tails.
1
• Probability of Heads: P (H) = 0.5.
• Probability of Tails: P (T ) = 0.5.
• If Heads, Y = 5.
• If Tails, Y = 2.
Therefore, the probability distribution is:
• P (Y = 5) = 0.5
• P (Y = 2) = 0.5 I
re feed
2. Expected Value (E[Y ]):
E[Y ] =
X
y
q
y · P (Y = y)
= (5 ⇥ 0.5) + ( 2 ⇥ 0.5)
= 2.5 1 = 1.5
The expected value of your earnings is $1.5.
Problem 3: Variance of a Random Variable
Consider the random variable Y from Problem 2. Calculate the variance of
Y. Moment
Solution: SecondCentral
1. Mean of Y (already calculated): E[Y ] = 1.5.
Extra
2. Values of Y : 5 and 2.
3. Calculating E[Y 2 ]:
X
E[Y 2 ] = y 2 · P (Y = y)
y
= (52 ⇥ 0.5) + (( 2)2 ⇥ 0.5)
= (25 ⇥ 0.5) + (4 ⇥ 0.5)
= 12.5 + 2 = 14.5
K
4. Variance of Y (Var(Y )):
Var(Y ) = E[Y 2 ]
u v
(E[Y ])2
a
2ndcm = 14.5 (1.5)2
= 14.5 2.25 = 12.25
The variance of Y is 12.25.
2
it
Problem 4: Continuous Random Variable
The random variable X is uniformly distributed between 0 and 10. Find the
expected value and variance of X.
Solution:
1. Probability Density Function (f (x)):
• Since X is uniformly distributed between 0 and 10,
1
f (x) = , 0 x 10
10
2. Expected Value (E[X]):
Z 10
E[X] = x · f (x) dx
0
Z 10
1
= x· dx
0 10
Z 10
1
= x dx
10 0
2 10
1 x
= ·
10 2 0
I
1 102
= · =5
10 2
The expected value of X is 5.
3. Variance (Var(X)):
Z 10
E[X 2 ] = x2 · f (x) dx
0
Z 10
Y
1 2
= x dx
10 0
3 10
1 x
= ·
10 3 0
1 103 1000 100
= · = =
10 3 30 3
Var(X) = E[X 2 ] (E[X])2
100
= 52
3
100 100 75 25
= 25 = = ⇡ 8.33
3 3 3
The variance of X is approximately 8.33. K
3
I
Problem 5: Binomial Random Variable
A biased coin has a probability of 0.7 of showing heads. The coin is flipped 5
I
times. Let X represent the number of heads obtained.
1. What is the probability mass function of X?
2. Calculate the expected value and variance of X.
Solution:
1. Probability Mass Function:
• X follows a binomial distribution with parameters n = 5 and
p = 0.7.
• The probability mass function is given by:
✓ ◆
n k
P (X = k) = p (1 p)n k , k = 0, 1, 2, 3, 4, 5
k
5
• For example, P (X = 3) = 3 (0.7)3 (0.3)2 .
2. Expected Value (E[X]):
• For a binomial random variable, E[X] = n ⇥ p.
E[X] = 5 ⇥ 0.7 = 3.5
The expected number of heads is 3.5.
3. Variance (Var(X)): x
• For a binomial random variable, Var(X) = n ⇥ p ⇥ (1 p).
Var(X) = 5 ⇥ 0.7 ⇥ 0.3 = 1.05
The variance of X is 1.05. x
Problem 6: Properties of a Gaussian Random
Variable
Russian
Let X be a random variable that is normally distributed with mean µ = 10 and
variance 2 = 4.
L
1. What is the probability that X is less than 12?
2. What is the probability that 8 X 14? t
I
I
3. Find P (X > 16).
[Link]
4
n
PrExam
I de
M8 Solution:
1. Since X ⇠ N (µ,
Htyd
2
) = N (10, 4), the standard deviation =
p
4 = 2.
To find P (X < 12), we standardize X:
X µ X 10
Z= =
2
Now, we calculate:
✓ ◆
12 10
P (X < 12) = P Z< = P (Z < 1)
2
From the standard normal distribution table, P (Z < 1) ⇡ 0.8413.
2. To find P (8 X 14), we standardize X:
✓ ◆
8 10 14 10
P (8 X 14) = P Z
2 2
= P ( 1 Z 2)
From the standard normal table:
P (Z < 2) ⇡ 0.9772, P (Z < 1) ⇡ 0.1587
P ( 1 Z 2) = 0.9772 0.1587 = 0.8185
3. To find P (X > 16):
✓ ◆
16 10
P (X > 16) = P Z> = P (Z > 3)
2
From the standard normal table:
P (Z > 3) ⇡ 1 0.9987 = 0.0013
Problem 7: Expectation and Variance of a Func-
tion of a Gaussian Random Variable
Let Y be a random variable such that Y ⇠ N (5, 9). Define a new random
variable Z = 3Y + 2. Find the expected value E[Z] and the variance Var(Z).
Solution:
1. The expectation of Z can be calculated as:
E[Z] = E[3Y + 2] = 3E[Y ] + 2
Since Y ⇠ N (5, 9), E[Y ] = 5.
E[Z] = 3 ⇥ 5 + 2 = 15 + 2 = 17
2. The variance of Z can be calculated as:
Var(Z) = Var(3Y + 2) = 32 · Var(Y ) = 9 · 9 = 81
p 5
b
axt
way
y
YnNCantharf
standard
GE
f
Problem 8: Probability Calculations with a Stan-
dard Normal Distribution
Let Z be a standard normal random variable (Z ⇠ N (0, 1)).
1. Find P (Z > 1.5).
2. Find P ( 1 < Z < 2.5).
3. Determine the value a such that P (Z < a) = 0.95.
Y
Solution:
1. To find P (Z > 1.5):
P (Z > 1.5) = 1 P (Z < 1.5)
From the standard normal table:
P (Z < 1.5) ⇡ 0.9332
P (Z > 1.5) = 1 0.9332 = 0.0668
2. To find P ( 1 < Z < 2.5):
P ( 1 < Z < 2.5) = P (Z < 2.5) P (Z < 1)
From the standard normal table:
P (Z < 2.5) ⇡ 0.9938, P (Z < 1) ⇡ 0.1587
P ( 1 < Z < 2.5) = 0.9938 0.1587 = 0.8351
3. To determine the value a such that P (Z < a) = 0.95:
• From the standard normal table, P (Z < 1.645) ⇡ 0.95.
• Therefore, a = 1.645.
Problem 9: Sum of Independent Gaussian Ran-
dom Variables
Let X1 ⇠ N (3, 4) and X2 ⇠ N (5, 9) be two independent Gaussian random
variables. Define S = X1 + X2 .
1. What is the distribution of S?
2. Calculate P (S > 10).
Solution:
6
Chi rig Gaussian
Xian all
É
Truefor
1. Since X1 and X2 are independent and normally distributed:
2 2
S = X1 + X2 ⇠ N (µ1 + µ2 , 1 + 2)
S ⇠ N (3 + 5, 4 + 9) = N (8, 13)
2. To calculate P (S > 10), we standardize S:
S 8
Z= p
13
✓ ◆ ✓ ◆
10 8 2
P (S > 10) = P Z > p =P Z> p ⇡ P (Z > 0.5547)
13 13
From the standard normal table:
P (Z > 0.5547) ⇡ 1 0.7108 = 0.2892 e
Problem 10: Gaussian Noise in Linear Regression
In a linear regression model, the response variable Y is given by:
Y = 3X + 5 + ✏
where X is the input variable, and ✏ ⇠ N (0, 1) represents Gaussian noise.
Introduction to Linear Regression: Linear regression is a method to
model the relationship between a dependent variable Y and an independent
variable X using a straight line. In the above model, Y = 3X + 5 + ✏, 3X + 5
represents the deterministic part (a line) and ✏ represents random noise that
É
captures the variability in Y not explained by X. The coefficients 3 and 5 are
parameters that define the slope and intercept of the line.
1. What is the distribution of Y when X = 4?
2. Calculate P (Y > 17) when X = 4.
Solution:
1. Substitute X = 4 into the equation for Y :
Y = 3(4) + 5 + ✏ = 17 + ✏
Since ✏ ⇠ N (0, 1), it follows that Y ⇠ N (17, 1).
2. To find P (Y > 17):
✓ ◆
17 17
P (Y > 17) = P Z> p = P (Z > 0)
From the standard normal table:
1
JV17 1
P (Z > 0) = 0.5
Therefore, P (Y > 17) = 0.5.
É
7
Problem 11: Feature Distribution in a Machine
Learning Model
In a dataset, a particular feature X representing the height of individuals is
normally distributed with mean µ = 170 cm and variance 2 = 25 cm2 .
1. What is the probability that a randomly selected individual has a height
greater than 180 cm?
É
2. If we sample 10 individuals, what is the expected total height?
Solution:
1. Standardize X to find P (X > 180):
X µ X 170
Z= =
5
✓ ◆
180 170
P (X > 180) = P Z> = P (Z > 2)
5
From the standard normal table:
P (Z > 2) ⇡ 1 0.9772 = 0.0228
2. The expected total height of 10 individuals is:
" 10 #
X
E Xi = 10 ⇥ E[X] = 10 ⇥ 170 = 1700 cm
i=1
Problem 12: Logistic Regression Probability
In a logistic regression model, the probability that an event occurs is given by:
1
P (Y = 1|X) = (2X+1)
1+e
where X is a feature representing the hours studied by a student.
Introduction to Logistic Regression: Logistic regression is a classifica-
tion model that estimates the probability of a binary outcome (e.g., pass/fail).
The model uses a logistic function (or sigmoid function) to convert the output
into a probability between 0 and 1. In this case, the output P (Y = 1|X) gives
the probability that a student passes, given that they studied for X hours.
I
1. Calculate the probability that the student passes (Y = 1) if they study
for 3 hours.
2. What is the probability that the student fails (Y = 0) if they study for 1
hour?
8
Solution:
1. Substitute X = 3:
1 1
P (Y = 1|X = 3) = (2⇥3+1)
= 7
1+e 1+e
1
⇡ ⇡ 0.9991
1 + 0.00091
The probability that the student passes is approximately 0.9991.
2. Substitute X = 1:
1 1
P (Y = 1|X = 1) = (2⇥1+1)
= 3
1+e 1+e
1
⇡ ⇡ 0.9526
1 + 0.0498
O
Therefore, the probability that the student fails (Y = 0) is:
P (Y = 0|X = 1) = 1 P (Y = 1|X = 1) = 1 0.9526 = 0.0474
Problem 13: Bias-Variance Decomposition
Consider a regression model where the prediction Ŷ is generated based on the
input feature X. Assume that Y is given by:
Y = 3X + 2 + ✏
where ✏ ⇠ N (0, 4) represents Gaussian noise.
i
y
Introduction to Bias-Variance in Regression: In regression models,
the response variable Y is modeled as a combination of a deterministic part (in
this case, 3X +2) and a random noise term (✏). The noise represents uncertainty
or factors not captured by X. Understanding the expected value and variance
helps us understand how much variability in Y is due to noise.
1. Calculate the expected value E[Y ] given X = 5.
2. What is the variance of Y given X = 5?
Solution:
1. Substitute X = 5 into the equation for Y :
E[Y |X = 5] = 3(5) + 2 + E[✏] = 15 + 2 + 0 = 17
The expected value of Y given X = 5 is 17.
2. The variance of Y is equal to the variance of the noise term ✏ since it is
independent of X:
Var(Y |X = 5) = Var(✏) = 4
9
8
Problem 14: Gaussian Mixture Model
Suppose a dataset is generated from a Gaussian Mixture Model (GMM) with
two components. The first component is N (0, 1) with a mixing coefficient of
I
0.4, and the second component is N (5, 4) with a mixing coefficient of 0.6.
Introduction to Gaussian Mixture Models (GMM): A GMM is used
to model data that comes from multiple underlying distributions, each of which
is Gaussian. The model is a weighted sum of these distributions, where the
weights (mixing coefficients) represent the proportion of each distribution in
the overall data.
1. What is the overall expected value of the mixture distribution?
2. Calculate the variance of the mixture distribution.
Solution:
1. The expected value of the mixture distribution is given by:
E[X] = w1 E[X1 ] + w2 E[X2 ]
where w1 = 0.4, E[X1 ] = 0, w2 = 0.6, and E[X2 ] = 5.
E[X] = 0.4 ⇥ 0 + 0.6 ⇥ 5 = 3
2. The variance of the mixture distribution is given by:
Var(X) = w1 (Var(X1 )+(E[X1 ] E[X])2 )+w2 (Var(X2 )+(E[X2 ] E[X])2 )
i
= 0.4(1 + (0 3)2 ) + 0.6(4 + (5 3)2 )
n = 0.4(1 + 9) + 0.6(4 + 4)
= 0.4 ⇥ 10 + 0.6 ⇥ 8 = 4 + 4.8 = 8.8
Fyn.EEEEy3
The variance of the mixture distribution is 8.8.
Problem 15: Transformation of Gaussian Ran-
dom Variables
Let X ⇠ N (2, 9), and define a new random variable Y = X 2 . t tryst
fyljdyFy12
1. Find the expected value E[Y ].
2. Find the variance Var(Y ).
3. Using Chebyshev’s inequality, estimate the probability P (|Y E[Y ]|
20).
Fyfylyldy
Solution:
10
OF
1. **Expected Value of Y **:
E[Y ] = E[X 2 ]
To find E[X 2 ], use the formula:
Ei
E[X 2 ] = Var(X) + (E[X])2
E[X 2 ] = 9 + 22 = 9 + 4 = 13
2. **Variance of Y **: To find Var(Y ), we need E[Y 2 ]:
E[Y 2 ] = E[X 4 ]
pf eat
For a normally distributed random variable, E[X 4 ] = 3 4
+6 2 2
µ + µ4 .
Here, 2 = 9 and µ = 2.
E[X 4 ] = 3(92 ) + 6(9)(22 ) + 24 = 3(81) + 6(9)(4) + 16
I t
= 243 + 216 + 16 = 475
Therefore:
Var(Y ) = E[Y 2 ] (E[Y ])2 = 475 132 = 475 169 = 306
3. **Chebyshev’s Inequality**: Using Chebyshev’s inequality:
r e
It a gthmonent
ii Var(Y )
P (|Y E[Y ]| 20)
202
306
P (|Y 13| 20) = 0.765
400
Problem 16: Probability with Joint Gaussian Vari-
ables
w w
Let X1 ⇠ N (0, 4) and X2 ⇠ N (0, 9) be two independent Gaussian random
variables. Define the new variables:
Y1 = X1 + 2X2 , Y2 = 3X1 X2
1. Find the covariance Cov(Y1 , Y2 ).
I
2. Are Y1 and Y2 independent? Justify your answer.
É't
Solution:
11
1. **Covariance**:
Cov(Y1 , Y2 ) = Cov(X1 + 2X2 , 3X1 X2 )
Using the bilinearity of covariance:
Cov(Y1 , Y2 ) = Cov(X1 , 3X1 )+Cov(X1 , X2 )+Cov(2X2 , 3X1 )+Cov(2X2 , X2 )
Since X1 and X2 are independent, Cov(X1 , X2 ) = 0. Therefore:
Cov(Y1 , Y2 ) = 3Var(X1 ) + ( 2)Var(X2 )
= 3 ⇥ 4 + ( 2) ⇥ 9 = 12 18 = 6
2. **Independence**: Two random variables are independent if their covari-
ance is zero. Since Cov(Y1 , Y2 ) = 6 6= 0, Y1 and Y2 are not independent.
Problem 17: Estimation with Gaussian Mixture
Models
A dataset is generated from a Gaussian Mixture Model (GMM) with three
components. The first component is N ( 3, 1) with a mixing coefficient of 0.2,
the second component is N (0, 4) with a mixing coefficient of 0.5, and the third
I
component is N (3, 1) with a mixing coefficient of 0.3.
1. Find the overall expected value of the mixture distribution.
2. Calculate the overall variance of the mixture distribution.
I
3. Calculate the probability that a value drawn from the mixture is greater
than 2.
Solution:
1. **Expected Value**:
E[X] = w1 E[X1 ] + w2 E[X2 ] + w3 E[X3 ]
E[X] = 0.2 ⇥ ( 3) + 0.5 ⇥ 0 + 0.3 ⇥ 3
E[X] = 0.6 + 0 + 0.9 = 0.3
2. **Variance**:
Var(X) = w1 (Var(X1 )+(E[X1 ] E[X])2 )+w2 (Var(X2 )+(E[X2 ] E[X])2 )+w3 (Var(X3 )+(E[X3 ] E[X
= 0.2(1 + ( 3 0.3)2 ) + 0.5(4 + (0 0.3)2 ) + 0.3(1 + (3 0.3)2 )
= 0.2(1 + 10.89) + 0.5(4 + 0.09) + 0.3(1 + 7.29)
= 0.2 ⇥ 11.89 + 0.5 ⇥ 4.09 + 0.3 ⇥ 8.29
= 2.378 + 2.045 + 2.487 = 6.91
12
3. **Probability Greater than 2**:
P (X > 2) = w1 P (X1 > 2) + w2 P (X2 > 2) + w3 P (X3 > 2)
• For X1 ⇠ N ( 3, 1):
✓ ◆
2 ( 3)
P (X1 > 2) = P Z > = P (Z > 5) ⇡ 0 (since P (Z > 5) is very small)
1
• For X2 ⇠ N (0, 4):
✓ ◆
2 0
P (X2 > 2) = P Z > = P (Z > 1) ⇡ 1 0.8413 = 0.1587
2
• For X3 ⇠ N (3, 1):
✓ ◆
2 3
P (X3 > 2) = P Z> = P (Z > 1) ⇡ 0.8413
1
P (X > 2) = 0.2 ⇥ 0 + 0.5 ⇥ 0.1587 + 0.3 ⇥ 0.8413
= 0.07935 + 0.25239 = 0.33174
The probability that a value drawn from the mixture is greater than 2 is
approximately 0.332.
13