Exercise 1. Let (Xn)n≥0 be a Markov chain with state space I={1,2,3} and transition matrix
P=01/32/32/301/31/32/30,
as in Figure 1. Suppose that the initial distribution λ of X0 is uniform on I, that is, λ=(1/3,1/3,1/3). (1) Compute P{X3=2}. (2) Compute P{X0=1,X2=3} and P{X0+X2=4}. (3) Compute P{X0=1,X2=3∣X0+X2=4}. (4) Determine the joint distribution of (X3,X4) and compute E[X3X4].
Figure 1. The chain of Exercise 1. Each arrow carries the probability of the jump.
Solution 1. All four questions are about the chain at fixed times, and the tool for them is the n-step transition matrix of the first post. The probability of going from i to j in n steps is the entry (i,j) of the power Pn, that is pij(n)=P{Xn=j∣X0=i}=(Pn)ij, and the distribution of Xn is the row vector λPn:P{Xn=j}=(λPn)j. Both come from the product formula (1.1) of the first post, summed over the states the chain visits between time 0 and time n.
The powers are computed with the product of matrices: the entry (i,j) of a product AB is ∑kaikbkj, the row i of A multiplied term by term with the column j of B and summed. For P2 each entry is a sum of three products, and the products with a zero factor drop out. The other entries of P are 1/3 and 2/3, so each product is 1/9,2/9 or 4/9, a multiple of 1/9, and
For instance, the entry (1,1) is p12p21+p13p31=92+92=94, since p11=0. Then P3=P2P. An entry of P2 is a multiple of 1/9 and an entry of P a multiple of 1/3, so every product is a multiple of 1/27, and
Here the entry (1,1) is 94⋅0+91⋅31+94⋅32=271+278, and the others are computed in the same way. Doing matrix multiplication one therefore gets P2 and P3 as above, and
λP3=(1/3,1/3,1/3)P3=(1/3,1/3,1/3).
In detail, the entry j of λP3 is ∑iλi(P3)ij=31∑i(P3)ij, one third of the sum of the column j of P3. Every column of P3 contains the three numbers 1/3,2/9 and 4/9, whose sum is 3/9+2/9+4/9=1, so every entry of λP3 is 1/3. Therefore
The first line answers (1): P{X3=2}=1/3, and the same holds for the other two states. The second line uses the definition of conditional probability: for events A and B with P(B)>0, one sets P(A∣B)=P(A∩B)/P(B), so that P(A∩B)=P(A∣B)P(B). Here B={X0=1} has probability λ1=1/3>0, and P{X2=3∣X0=1}=p13(2)=4/9, the entry (1,3) of P2. The same number comes from the paths of two steps from 1 to 3: the path 1→2→3 has probability p12p23=32⋅32=94, and the paths through 1 or 3 have probability 0, because p11=p33=0.
For the event {X0+X2=4} we use the law of total probability. The events {X0=1},{X0=2} and {X0=3} are pairwise disjoint and their union is the whole space, because X0 takes values in I. By additivity, for every event A we have P(A)=∑kP(A∩{X0=k}), and each term is P(A∣X0=k)P{X0=k} by the definition of conditional probability, since P{X0=k}=1/3>0. Hence
In the first of these two displays, the second equality holds because on the event {X0=k} the sum X0+X2 equals 4 exactly when X2=4−k. So the events {X0+X2=4} and {X2=4−k} have the same intersection with {X0=k}, and a conditional probability given {X0=k} depends only on that intersection. The three conditional probabilities are entries of P2:p13(2)=4/9 for k=1,p22(2)=4/9 for k=2 and p31(2)=1/9 for k=3. Their sum is 9/9=1, which gives 1/3.
The second display answers (3). Its first equality is the definition of conditional probability, which applies because P{X0+X2=4}=1/3>0. Its second equality holds because 1+3=4: the event {X0=1,X2=3} is contained in {X0+X2=4}, so their intersection is {X0=1,X2=3} itself.
Finally, to determine the joint distribution of (X3,X4), one has to compute, as in Figure 2,
Since X3 and X4 take finitely many values, their joint distribution is given by these nine numbers: the probability of any set of pairs is the sum of the numbers of its pairs. The first equality is again the definition of conditional probability, with P{X3=i}=1/3>0 by (1). The factor P{X4=j∣X3=i} is pij: by (1.1) of the first post, summed over the states i0,i1,i2 at times 0, 1 and 2,
since the same sum without the factor pij is P{X3=i}. The nine numbers pij/3 are the entries of P divided by 3, drawn in Figure 2; they add up to 1, because each row of P adds up to 1. Then
The first equality is the expectation of a function of a random vector that takes finitely many values: E[g(X3,X4)] is the sum of g(i,j)P{X3=i,X4=j} over all pairs (i,j), here with g(i,j)=ij. In the second, the three pairs with i=j are missing because p11=p22=p33=0, and the six remaining terms are, in order, the pairs (1,2),(1,3),(2,1),(2,3),(3,1) and (3,2). Their sum is 34+1+32+4+2+2=11, and one third of it is 11/3.
Figure 2. The joint distribution of (X3,X4): the cell in row i and column j holds P{X3=i,X4=j}=pij/3.
Exercise 2. A mouse runs through the maze of Figure 3. At each step it leaves the room it is in by choosing randomly, and with equal probability, one of the doors out of the room. Suppose there is always a door between two neighbouring rooms, and let Xn represent the position of the mouse at time n. (1) Give the transition matrix P for the Markov chain (Xn)n≥0. (2) Suppose that the mouse starts in room 1, that is, X0=1. Compute the probability that it arrives in room 6 after 3 steps.
Figure 3. The maze of Exercise 2, with a door between any two neighbouring rooms. Dashed, the two routes of 3 steps from room 1 to room 6 of Solution 2.
Solution 2. The entry pij is the probability that the mouse, in room i, goes to room j at the next step. It always leaves the room, so pii=0. If room i has di doors, each door is chosen with probability 1/di, and each leads to a different neighbouring room: pij=1/di when j is a neighbour of i, and pij=0 otherwise. In Figure 3, rooms 1 and 2 have one door, to room 3; room 3 has four, to rooms 1,2, 4 and 5; rooms 4 and 5 have two, to rooms 3 and 6; room 6 has two, to rooms 4 and 5. Row by row, the transition matrix P is
Each row adds up to 1, as the row of a transition matrix must. Moreover, for the probability P{X3=6∣X0=1}, one could compute p16(3) directly. However, starting from the state 1, the mouse can reach the state 6 in 3 steps only along two routes, 1→3→4→6 and 1→3→5→6, drawn in Figure 3, thus
P{X3=6∣X0=1}=1⋅41⋅21+1⋅41⋅21=41.
To see why only these two routes count, recall that by the product formula (1.1) of the first post, p16(3) is the sum, over the rooms k and l visited at times 1 and 2, of the probabilities of the paths from 1 to 6 through k and l:
p16(3)=k,l∑p1kpklpl6.
A term is positive only if its three factors are. From room 1 the only possible step is to room 3, since p13=1; room 6 can be entered only from rooms 4 and 5; and from room 3 the mouse goes to 4 or to 5 with probability 1/4 each. So the sum has exactly two positive terms, p13p34p46=1⋅41⋅21=81 and p13p35p56=81, one for each route, and they add up to 1/4.
Exercise 4. Let X0:(Ω,F,P)→(I,2I) be a random variable, where I is a countable subset of R and 2I is the power set of I. Let (Zn)n≥0 be a sequence of independent and identically distributed random variables from (Ω,F,P) to (E,E). Assume that X0 and the sequence (Zn)n≥0 are also independent. Given a 2I⊗E-measurable function f:I×E→I, define inductively
Xn+1:=f(Xn,Zn),n≥0.
Show that (Xn)n≥0 is a Markov chain.
Solution 4. We first show that Zn is independent of (X0,…,Xn), written Zn⊥(X0,…,Xn). Two random variables, or random vectors, are independent when the σ-algebras they generate are: P(A∩B)=P(A)P(B) for every A in the first and B in the second. The σ-algebra σ{Y1,…,Ym} generated by random variables is the smallest one that contains every event {Yk∈S} with S measurable. Note that by construction
and so on, where gi:I×Ei→I is a 2I⊗E⊗i-measurable function. In general g1=f and gi+1(x,z0,…,zi)=f(gi(x,z0,…,zi−1),zi), so that Xi+1=gi+1(X0,Z0,…,Zi) by induction. Each gi+1 is measurable: it is f composed with the map that sends (x,z0,…,zi) to (gi(x,z0,…,zi−1),zi), a map into a product whose two components are measurable, hence measurable, and a composition of measurable maps is measurable.
that is, Zn⊥(X0,…,Xn). The hypothesis at the start holds because X0,Z0,Z1,… are independent, the Zn among themselves and X0 from all of them, and a variable of an independent family is independent of any group of the others. A random vector generates the same σ-algebra as its components, which gives both equalities. The inclusion holds because every Xk with k≤n is gk(X0,Z0,…,Zk−1), a measurable function of (X0,Z0,…,Zn−1): each event {Xk=i} is the preimage of a measurable set under this vector, so it belongs to its σ-algebra, which then contains σ{X0,…,Xn}. Independence of two σ-algebras passes to any smaller one, which gives the conclusion.
Denote by i0,i1,…,in,j the states in I, with P{Xn=in,…,X0=i0}>0, so that the conditional probabilities below are defined. Then
The first equality is the definition Xn+1=f(Xn,Zn). The second holds because on the event {Xn=in} the variable f(Xn,Zn) equals f(in,Zn), so the two events {f(Xn,Zn)=j} and {f(in,Zn)=j} have the same intersection with the conditioning event, and a conditional probability depends only on that intersection. The fourth equality holds for the same reason, with the event {Xn=in} alone, and the fifth is again the definition of Xn+1. The third equality is the Markov property itself, and it rests on the independence just shown.
To see it, write A={f(in,Zn)=j} and C={Xn−1=in−1,…,X0=i0}. The event A belongs to σ{Zn}: it is {Zn∈S} with S={z∈E:f(in,z)=j}, and S belongs to E because, for a fixed in, the map z↦f(in,z) is measurable, as every section of a product-measurable function is. The events {Xn=in} and {Xn=in}∩C belong to σ{X0,…,Xn}. Here the third equality holds since
where P{f(in,Zn)=j}=P{f(in,Zn)=j∣Xn=in} as Zn⊥Xn. The first line of this display is P(A∩C∣Xn=in), and the first equality is the definition of conditional probability, with P{Xn=in}>0 because this event contains the one of positive probability fixed above. The second equality is the independence of A and {Xn=in}∩C. The third splits the quotient into two factors: the independence of A and {Xn=in} gives P(A)=P(A∩{Xn=in})/P{Xn=in}=P(A∣Xn=in), and the second factor is the definition of P(C∣Xn=in).
The display says that, given {Xn=in}, the event A is independent of the past C. Dividing it by P(C∣Xn=in), which is positive because P{Xn=in,…,X0=i0}>0, gives the third equality:
The first equality here writes both conditional probabilities as quotients by P{Xn=in}, which cancels. It remains to see that the transition probabilities do not depend on n. By the independence of A and {Xn=i}, as above, P{Xn+1=j∣Xn=i}=P{f(i,Zn)=j}=P{Zn∈S}, with S={z:f(i,z)=j}. The Zn are identically distributed, that is, P{Zn∈S}=P{Z0∈S} for every S in E, so this number is pij:=P{f(i,Z0)=j} for every n.
The numbers pij form a transition matrix: they are nonnegative, and ∑jpij=1 by countable additivity, because f(i,Z0) takes exactly one value in the countable set I. With λ the distribution of X0, conditions (i) and (ii) of Definition 1.2 of the first post hold, so (Xn)n≥0 is Markov(λ,P).
Exercise 5. Let (Zn)n≥1 be a sequence of independent and identically distributed random variables with Bernoulli distribution B(1,q), where 0<q<1, and let (Yn)n≥0 be the sequence of random variables defined by
Y0:=1,Yn+1:=Yn(2Zn+1−1).
Prove that (Yn)n≥0 is a Markov chain and find its transition matrix.
Solution 5. The Markov property can be verified directly in terms of Exercise 4. Namely,
Indeed, Yn+1=f(Yn,Zn+1) with f(y,z):=y(2z−1), and Exercise 4 applies to the independent and identically distributed variables Z1,Z2,…, which are independent of the constant Y0=1. In the notation of Exercise 4, the chain is Xn=Yn and the noise at time n is Zn+1, with values in E={0,1} and its power set. A constant is independent of every random variable, because the events it generates are the empty set and the whole space. The function f is measurable: the set I×E is countable, so each of its subsets is a countable union of points {(y,z)}={y}×{z}, which belong to the product σ-algebra.
On the other hand, since Zn∼B(1,q), the variable 2Zn+1−1 takes values in {−1,+1}, so Yn also takes values in {−1,+1} for all n≥0. The Bernoulli distribution B(1,q) gives P{Z=1}=q and P{Z=0}=1−q, so 2Zn+1−1 is +1 with probability q and −1 with probability 1−q. By induction, Y0=1, and if Yn is ±1 then Yn+1=±Yn is ±1 too: at each step the sign of Yn is kept when Zn+1=1 and changes when Zn+1=0. Thus the transition matrix P of the Markov chain (Yn)n≥0 is a 2×2 matrix, and
P=(p−1,−1p+1,−1p−1,+1p+1,+1)=(q1−q1−qq).
By Exercise 4,pij=P{f(i,Z1)=j}. For i=−1 this is P{−(2Z1−1)=j}, so p−1,−1=P{Z1=1}=q and p−1,+1=P{Z1=0}=1−q. For i=+1 it is P{2Z1−1=j}, so p+1,+1=q and p+1,−1=1−q. The chain starts at +1, its initial distribution is the point mass δ+1, and it keeps its sign with probability q at every step.
Figure 5. An instance: a path Y0,…,Y40 for the q set by the slider, with the changes of sign marked. The button draws another path.