Assignment - Module 6
06 August 2021
Group 23: Aman Jindal | Yuhang Jiang | Daniel Gabriel Tan | Qining Liu
Thus Probability that $X = 4, Y = 1, \; given \; X + Y = 5$ would be the probability of the pair $(4, 1)$ divided by the sum of the probabilities of all the $(X,Y)$ pairs that result in $X + Y = 5$
The sum of all the $(X,Y)$ pairs that result in $X + Y = 5$ is same the probability calculated in part (i) above.
# Calculations
import numpy as np
import math
def poisson_pmf(mean, k): return (mean**k)*np.exp(-mean)/math.factorial(k)
x_mean = 3
y_mean = 2
x = np.arange(6)
y = np.arange(6)[::-1]
xy_pairs = [(i, j) for i, j in zip(x,y)]
prob_xy5 = sum([poisson_pmf(x_mean, i)*poisson_pmf(y_mean, j) for i, j in xy_pairs])
prob_xy5_check = poisson_pmf(x_mean+y_mean, 5)
prob_x4_y1_xy5 = poisson_pmf(x_mean, 4)*poisson_pmf(y_mean, 1)/poisson_pmf(x_mean+y_mean, 5)
print('Using the first method, Probability of X+Y = 5 is {:.4f}'.format(prob_xy5))
print('Using the second method, Probability of X+Y = 5 is {:.4f}'.format(prob_xy5_check))
print('Probability of X = 4 and Y = 1, given X+Y = 5 is {:.4f}'.format(prob_x4_y1_xy5))
Using the first method, Probability of X+Y = 5 is 0.1755 Using the second method, Probability of X+Y = 5 is 0.1755 Probability of X = 4 and Y = 1, given X+Y = 5 is 0.2592
The probability of the next bus arriving in next 10 minutes is equal to $1 - \text{the probability of no bus arriving in next 10 minutes}$
The average number of buses per 10 minutes is $5/6$
# Calculations
prob_bus_10mins = 1 - poisson_pmf(5/6, 0)
prob_bus_5mins = 1 - poisson_pmf(5/12, 0)
print('Probability of a bus arriving in the next 10 minutes is {:.4f}'.format(prob_bus_10mins))
print('Probability of a bus arriving in the next 5 minutes is {:.4f}'.format(prob_bus_5mins))
Probability of a bus arriving in the next 10 minutes is 0.5654 Probability of a bus arriving in the next 5 minutes is 0.3408
In the above equation, the two events on the RHS are disjoint
$$\therefore P(Y=4) = P(X=2) + P(X=-2) = 1/4$$
The End.