-----------------------------------------------------------------------------
Assignment
-----------------------------------------------------------------------------
Course: Modeling and Simulation (1105481)
Student Name : Munifa Qaid Alotaibi
ID: 202101239
Q1: In certain city, if today is sunny, tomorrow will be sunny 80% of
the time. If today is cloudy, tomorrow will be cloudy 60% of time.
Supposing today is sunny, what is the probability it will be cloudy the
day after tomorrow? (4 Marks)
To find the probability that it will be cloudy the day after tomorrow, given that today
is sunny, considering the probabilities for each scenario.
first defining the events:
A: Today is sunny
B: Tomorrow is sunny
C: The day after tomorrow is cloudy
With following probabilities:
P(B|A) = 0.8 (the probability that tomorrow is sunny given that today is
sunny)
P(C|B) = 0.6 (the probability that the day after tomorrow is cloudy given that
tomorrow is sunny)
For find P(C|A), the probability that the day after tomorrow is cloudy, given today is
sunny.
Using Bayes' theorem,:
P(C|A) = P(C∩A) / P(A)
To find P(C∩A), the probability of both events C and A occurring :
P(C∩A) = P(C|B) * P(B|A) * P(A)
= P(C∩A) = 0.6 * 0.8 * 1
Since P(A) = 1 (given that today is sunny) :
P(C|A) = P(C∩A) / P(A) = P(C∩A) / 1 = P(C∩A)
Therefore, the probability that it will be cloudy the day after tomorrow, given that
today is sunny, is:
P(C|A) = P(C∩A) = 0.6 * 0.8 = 0.48
So, the probability it will be cloudy the day after tomorrow, given that today is sunny,
is 0.48 or 48%.
Q2 Consider a Markov chain with states 1, 2, 3, 4, 5 and a transition
probability matrix
Specify the classes of the Markov chain and determine whether they are
recurrent or transient (5 marks)
For Markov chain , we can identify the following classes:
Class 1: {1, 2, 4}
Class 2: {3}
Class 3: {5}
Then , determining whether these classes are recurrent or transient.
A recurrent class is a closed communicating class where starting in any state
of the class, there is a 100% probability of eventually returning to that class.
A transient class is a closed communicating class where starting in any state of
the class, there is a non-zero probability of never returning to that class.
To determine the recurrence/transience of each class, examining the diagonal
elements of the corresponding submatrix of the transition probability matrix.
For Class 1: {1, 2, 4}
The submatrix is:
[1/5 2/5 1/5]
[2/9 4/9 1/9]
[0 0 0]
The diagonal elements of this submatrix are 1/5 and 4/9. Neither of them is equal to 1,
which means that Class 1 is transient.
For Class 2: {3}
The submatrix is:
[0]
Since there is only one state in Class 2, the diagonal element is 1. Therefore, Class 2
is recurrent.
For Class 3: {5}
The submatrix is:
[1/5]
The diagonal element of this submatrix is 1/5, which is not equal to 1. Thus, Class 3 is
also transient.
The Result :
Class 1: {1, 2, 4} is transient.
Class 2: {3} is recurrent.
Class 3: {5} is transient.
Q3 The transition matrix of a Markov chain with states E1, E2 and
E3 is given by:
What is the Mean Duration of state E3? Assume time spent in each
state 50 ms.(3 mark )
P(E3 -> Exit) represents the probability of transitioning from state E3 to an exit state
(a state outside of {E1, E2, E3}).
Looking at the transition matrix : the state E3 transitions to E2 with a probability of
1/2 and transitions to an exit state with a probability of 1/2.
Therefore, P(E3 -> Exit) = 1/2.
Now, we can calculate D3:
D3 = 1 / P(E3 -> Exit) = 1 / (1/2) = 2
The mean duration of state E3 is 2 time units.
The mean return time to E3 starting from qualquer state, M_E
M_E = M_EE * P_EE + M_E1E * P_E1E + M_E2E * P_E2E
M_E3 = 50 * 1 + 0 * 0 + 50 * 1
Solve for Mean Duration:
M_E3 = 100 ms
Therefore, the Mean Duration of state E3 is 100 milliseconds.
Q4 Given the Markov chain below:
What is the probability that people in middle class at the first stage is
stay in middle class by the 5th stage? (4 marks)
To calculate the probability that people in the middle class at the first stage stay in the
middle class by the 5th stage, we need to compute the 5th power of the transition
matrix P and look at the corresponding entry.
First, calculating the 5th power of the transition matrix P:
P^5 = P * P * P * P * P
Calculating this matrix multiplication, we get:
P^5 = [[0.158, 0.253, 0.590],
[0.182, 0.281, 0.537],
[0.200, 0.307, 0.493]]
The entry in the second row and second column of P^5 represents the probability of
transitioning from the middle class at the first stage to the middle class at the fifth
stage.
Therefore, the probability that people in the middle class at the first stage stay in the
middle class by the 5th stage is 0.281 or 28.1%.
Q5 / What is the service rate in an M/M/1 queue with ρ = 0.17 and λ
= 0.03? (2 marks)
In an M/M/1 queue, ρ represents the traffic intensity or utilization, and λ represents
the arrival rate.
The service rate (μ) can be calculated using the formula:
μ=λ/ρ
Given ρ = 0.17 and λ = 0.03,
calculating the service rate:
μ = 0.03 / 0.17
μ ≈ 0.1765
Therefore, the service rate in the M/M/1 queue with ρ = 0.17 and λ = 0.03 is
approximately 0.1765.