Discrete Dynamical Systems and Markov Chains
The eigenvector decomposition · Long-term behavior of \(\mathbf x_{k+1}=A\mathbf x_k\) · Attractors, repellers and saddle points · Markov chains · Stochastic matrices · Steady-state vectors · Regular stochastic matrices
By the end of this week you will be able to:
- write the solution of \(\mathbf x_{k+1}=A\mathbf x_k\) as \(\mathbf x_k=c_1\lambda_1^k\mathbf v_1+\cdots+c_n\lambda_n^k\mathbf v_n\) and find the weights \(c_1,\dots,c_n\) from \(\mathbf x_0\);
- read the long-term behavior of the system from the absolute values of the eigenvalues;
- classify the origin as an attractor, a repeller or a saddle point, and describe the trajectories when \(A\) is diagonal;
- set up a Markov chain from a description, compute its state vectors, and check whether a vector is a steady-state vector;
- find the steady-state vector of a stochastic matrix as an eigenvector for the eigenvalue \(1\), and explain why a Markov chain with a regular stochastic matrix converges to it.
Day 1: The Eigenvector Decomposition and Trajectories
Today we solve the difference equation \(\mathbf x_{k+1}=A\mathbf x_k\) with the eigenvectors of \(A\), explain the long-term behavior of the grocery chain model of Week 4, and draw the solutions when \(A\) is a diagonal \(2\times 2\) matrix.
1.1 The eigenvector decomposition
A discrete dynamical system is a difference equation
\[\mathbf x_{k+1}=A\mathbf x_k\qquad(k=0,1,2,\dots)\]together with a starting vector \(\mathbf x_0\). The vector \(\mathbf x_k\) describes the state of a system at time \(k\), and the matrix \(A\) says how the state changes in one time step. We want to know what happens to \(\mathbf x_k\) as \(k\) grows, without computing all the vectors one by one.
Assume that \(A\) is diagonalizable, with linearly independent eigenvectors \(\mathbf v_1,\dots,\mathbf v_n\) and corresponding eigenvalues \(\lambda_1,\dots,\lambda_n\). Since \(\{\mathbf v_1,\dots,\mathbf v_n\}\) is a basis of \(\mathbb R^n\), the starting vector can be written in exactly one way as
\[\mathbf x_0=c_1\mathbf v_1+c_2\mathbf v_2+\cdots+c_n\mathbf v_n.\]This is the eigenvector decomposition of \(\mathbf x_0\). Now multiply by \(A\). By linearity, and because each \(\mathbf v_i\) is an eigenvector,
\[\mathbf x_1=A\mathbf x_0=c_1A\mathbf v_1+\cdots+c_nA\mathbf v_n=c_1\lambda_1\mathbf v_1+\cdots+c_n\lambda_n\mathbf v_n.\]Multiply by \(A\) once more. Each term is again a multiple of an eigenvector, so each term is again multiplied by its own eigenvalue:
\[\mathbf x_2=A\mathbf x_1=c_1\lambda_1A\mathbf v_1+\cdots+c_n\lambda_nA\mathbf v_n=c_1\lambda_1^2\mathbf v_1+\cdots+c_n\lambda_n^2\mathbf v_n.\]Every further multiplication by \(A\) raises each exponent by one.
Let \(A\) be a diagonalizable \(n\times n\) matrix with linearly independent eigenvectors \(\mathbf v_1,\dots,\mathbf v_n\) and corresponding eigenvalues \(\lambda_1,\dots,\lambda_n\). If \(\mathbf x_0=c_1\mathbf v_1+\cdots+c_n\mathbf v_n\), then
\[\mathbf x_k=c_1\lambda_1^k\,\mathbf v_1+c_2\lambda_2^k\,\mathbf v_2+\cdots+c_n\lambda_n^k\,\mathbf v_n\qquad(k=0,1,2,\dots).\]In Week 12 we used this formula with two eigenvectors. The formula has three ingredients: the eigenvalues, the eigenvectors, and the weights of \(\mathbf x_0\). Only the powers \(\lambda_i^k\) change with \(k\).
Let
\[A=\begin{bmatrix} 3 & -2.5 & -1.5\\ 0 & 0.5 & -1.5\\ 0 & 0 & -1\end{bmatrix},\qquad \mathbf v_1=\begin{bmatrix} 1\\ 0\\ 0\end{bmatrix},\quad \mathbf v_2=\begin{bmatrix} 1\\ 1\\ 0\end{bmatrix},\quad \mathbf v_3=\begin{bmatrix} 1\\ 1\\ 1\end{bmatrix},\qquad \mathbf x_0=\begin{bmatrix} 2\\ 3\\ 1\end{bmatrix}.\]Show that \(\mathbf v_1,\mathbf v_2,\mathbf v_3\) are eigenvectors of \(A\), and find a formula for the solution of \(\mathbf x_{k+1}=A\mathbf x_k\).
Solution
Eigenvalues. Multiply:
\[A\mathbf v_1=\begin{bmatrix} 3\\ 0\\ 0\end{bmatrix}=3\mathbf v_1,\qquad A\mathbf v_2=\begin{bmatrix} 3-2.5\\ 0.5\\ 0\end{bmatrix}=\begin{bmatrix} 0.5\\ 0.5\\ 0\end{bmatrix}=0.5\,\mathbf v_2,\qquad A\mathbf v_3=\begin{bmatrix} 3-2.5-1.5\\ 0.5-1.5\\ -1\end{bmatrix}=\begin{bmatrix} -1\\ -1\\ -1\end{bmatrix}=-\mathbf v_3.\]The eigenvalues are \(3\), \(0.5\) and \(-1\). They are distinct, so the three eigenvectors are linearly independent (Theorem 2 of Week 12) and form a basis of \(\mathbb R^3\).
Weights. Solve \(c_1\mathbf v_1+c_2\mathbf v_2+c_3\mathbf v_3=\mathbf x_0\). The augmented matrix is already in echelon form:
\[\left[\begin{array}{ccc|c} 1 & 1 & 1 & 2\\ 0 & 1 & 1 & 3\\ 0 & 0 & 1 & 1\end{array}\right].\]Back substitution: row 3 gives \(c_3=1\). Row 2 gives \(c_2=3-c_3=2\). Row 1 gives \(c_1=2-c_2-c_3=-1\). So \(\mathbf x_0=-\mathbf v_1+2\mathbf v_2+\mathbf v_3\).
Formula.
\[\mathbf x_k=-3^k\begin{bmatrix} 1\\ 0\\ 0\end{bmatrix}+2\,(0.5)^k\begin{bmatrix} 1\\ 1\\ 0\end{bmatrix}+(-1)^k\begin{bmatrix} 1\\ 1\\ 1\end{bmatrix}.\]Check with \(k=1\). The formula and direct multiplication give the same vector:
\[-3\,\mathbf v_1+\mathbf v_2-\mathbf v_3=\begin{bmatrix} -3+1-1\\ 1-1\\ -1\end{bmatrix}=\begin{bmatrix} -3\\ 0\\ -1\end{bmatrix},\qquad A\mathbf x_0=\begin{bmatrix} 6-7.5-1.5\\ 1.5-1.5\\ -1\end{bmatrix}=\begin{bmatrix} -3\\ 0\\ -1\end{bmatrix}.\]The three terms behave differently as \(k\) grows. The first term grows without bound, the second term tends to \(\mathbf 0\), and the third term changes its sign at every step and keeps its size.
1.2 The two grocery chains
In Week 4 we computed, step by step, how the customers of a town move between two grocery chains. The eigenvector decomposition gives all the steps at once, and it shows where the numbers settle.
Each month 20% of Ada's customers switch to Bay and 30% of Bay's customers switch to Ada. This month Ada has 4,000 customers and Bay has 6,000. With \(\mathbf x_k=(\text{Ada},\text{Bay})\) in month \(k\),
\[\mathbf x_{k+1}=A\mathbf x_k,\qquad A=\begin{bmatrix} 0.8 & 0.3\\ 0.2 & 0.7\end{bmatrix},\qquad \mathbf x_0=\begin{bmatrix} 4{,}000\\ 6{,}000\end{bmatrix}.\]Find a formula for \(\mathbf x_k\) and describe what happens as \(k\to\infty\).
Solution
Step 1: eigenvalues. The characteristic polynomial factors:
\[\det(A-\lambda I)=(0.8-\lambda)(0.7-\lambda)-(0.3)(0.2)=\lambda^2-1.5\lambda+0.5=(\lambda-1)(\lambda-0.5).\]The eigenvalues are \(1\) and \(0.5\).
Step 2: eigenvectors. For \(\lambda=1\): \(A-I=\begin{bmatrix} -0.2 & 0.3\\ 0.2 & -0.3\end{bmatrix}\). The equation \(-0.2x_1+0.3x_2=0\) gives \(x_1=\tfrac32x_2\). With \(x_2=2\): \(\mathbf v_1=\begin{bmatrix} 3\\ 2\end{bmatrix}\).
For \(\lambda=0.5\): \(A-0.5I=\begin{bmatrix} 0.3 & 0.3\\ 0.2 & 0.2\end{bmatrix}\). The equation \(x_1+x_2=0\) gives \(\mathbf v_2=\begin{bmatrix} 1\\ -1\end{bmatrix}\).
Step 3: weights. Solve \(c_1\mathbf v_1+c_2\mathbf v_2=\mathbf x_0\):
\[\left[\begin{array}{cc|c} 3 & 1 & 4{,}000\\ 2 & -1 & 6{,}000\end{array}\right].\]Adding the two equations gives \(5c_1=10{,}000\), so \(c_1=2{,}000\). The first equation then gives \(c_2=4{,}000-3(2{,}000)=-2{,}000\).
Step 4: the formula. Since \(1^k=1\),
\[\mathbf x_k=2{,}000\begin{bmatrix} 3\\ 2\end{bmatrix}-2{,}000\,(0.5)^k\begin{bmatrix} 1\\ -1\end{bmatrix}=\begin{bmatrix} 6{,}000\\ 4{,}000\end{bmatrix}-2{,}000\,(0.5)^k\begin{bmatrix} 1\\ -1\end{bmatrix}.\]Check. For \(k=1\): \(2{,}000(0.5)=1{,}000\), so the formula gives \(\mathbf x_1=(5{,}000,\ 5{,}000)\). Direct multiplication agrees:
\[A\mathbf x_0=\begin{bmatrix} 0.8(4{,}000)+0.3(6{,}000)\\ 0.2(4{,}000)+0.7(6{,}000)\end{bmatrix}=\begin{bmatrix} 3{,}200+1{,}800\\ 800+4{,}200\end{bmatrix}=\begin{bmatrix} 5{,}000\\ 5{,}000\end{bmatrix}.\]Long-term behavior. Since \(|0.5|\lt 1\), the factor \((0.5)^k\) tends to \(0\). The second term disappears and
\[\mathbf x_k\to\begin{bmatrix} 6{,}000\\ 4{,}000\end{bmatrix}\qquad\text{as }k\to\infty.\]The distance to the limit is halved every month: \(\mathbf x_2=(5{,}500,\ 4{,}500)\), \(\mathbf x_3=(5{,}750,\ 4{,}250)\), \(\mathbf x_4=(5{,}875,\ 4{,}125)\). See Figure 1.
Two remarks on Example 2.
- The limit \(2{,}000\,\mathbf v_1\) is an eigenvector for \(\lambda=1\), so \(A\) does not change it. In numbers: 20% of 6,000 is 1,200 and 30% of 4,000 is 1,200. Each month the same number of customers moves in each direction.
- The limit depends only on the total number of customers. Whatever \(\mathbf x_0\) is, adding the two equations of step 3 gives \(5c_1=\) total. With a total of 10,000 the limit is always \((6{,}000,\ 4{,}000)\). The weight \(c_2\) only decides how the system approaches the limit.
1.3 Trajectories for a diagonal matrix
When \(A\) is \(2\times 2\), the vectors \(\mathbf x_0,\mathbf x_1,\mathbf x_2,\dots\) can be drawn as points in the plane. The graph of \(\mathbf x_0,\mathbf x_1,\mathbf x_2,\dots\) is called a trajectory of the dynamical system. In the figures below, the points of one trajectory are joined by a thin curve so that the trajectory is easier to follow. Only the dots belong to the trajectory.
Let \(A\) be a diagonalizable \(2\times 2\) matrix with eigenvalues \(\lambda_1\) and \(\lambda_2\). For the dynamical system \(\mathbf x_{k+1}=A\mathbf x_k\), the origin is
The three examples below show what the names mean. In each of them \(A\) is diagonal, so the eigenvectors are \(\mathbf e_1=(1,0)\) and \(\mathbf e_2=(0,1)\), the eigenvalues are the diagonal entries, and the weights of \(\mathbf x_0=(c_1,c_2)\) are its entries.
Describe the trajectories of \(\mathbf x_{k+1}=A\mathbf x_k\) for \(A=\begin{bmatrix} 0.8 & 0\\ 0 & 0.64\end{bmatrix}\).
Solution
The eigenvalues are \(0.8\) and \(0.64\). If \(\mathbf x_0=(c_1,c_2)\), then
\[\mathbf x_k=c_1(0.8)^k\begin{bmatrix} 1\\ 0\end{bmatrix}+c_2(0.64)^k\begin{bmatrix} 0\\ 1\end{bmatrix}=\begin{bmatrix} c_1(0.8)^k\\ c_2(0.64)^k\end{bmatrix}.\]Both \((0.8)^k\) and \((0.64)^k\) tend to \(0\), so every trajectory tends to \(\mathbf 0\). The origin is an attractor. For example, \(\mathbf x_0=(3,3)\) gives \(\mathbf x_1=(2.4,\ 1.92)\) and \(\mathbf x_2=(1.92,\ 1.2288)\).
The second entry shrinks faster than the first, because \(0.64\lt 0.8\). So the points lose their \(\mathbf e_2\) part first, and they come in to the origin close to the \(x_1\)-axis (Figure 2). The line through \(\mathbf 0\) and the eigenvector for the eigenvalue of smaller absolute value, here the \(x_2\)-axis, is called the direction of greatest attraction.
Describe the trajectories of \(\mathbf x_{k+1}=A\mathbf x_k\) for \(A=\begin{bmatrix} 1.44 & 0\\ 0 & 1.2\end{bmatrix}\).
Solution
The eigenvalues are \(1.44\) and \(1.2\). If \(\mathbf x_0=(c_1,c_2)\), then
\[\mathbf x_k=\begin{bmatrix} c_1(1.44)^k\\ c_2(1.2)^k\end{bmatrix}.\]Both \((1.44)^k\) and \((1.2)^k\) grow without bound. Every trajectory with \(\mathbf x_0\ne\mathbf 0\) moves away from the origin, even when \(\mathbf x_0\) is very close to \(\mathbf 0\). The origin is a repeller. For example, \(\mathbf x_0=(0.05,\ 0.3)\) gives \(\mathbf x_9\approx(1.33,\ 1.55)\) and \(\mathbf x_{11}\approx(2.76,\ 2.23)\).
The first entry grows faster, because \(1.44\gt 1.2\). The trajectories bend toward the direction of the \(x_1\)-axis (Figure 3). The line through \(\mathbf 0\) and the eigenvector for the eigenvalue of larger absolute value, here the \(x_1\)-axis, is called the direction of greatest repulsion.
Describe the trajectories of \(\mathbf x_{k+1}=A\mathbf x_k\) for \(A=\begin{bmatrix} 2 & 0\\ 0 & 0.5\end{bmatrix}\). Show that a solution is unbounded if its starting point is not on the \(x_2\)-axis.
Solution
The eigenvalues are \(2\) and \(0.5\). If \(\mathbf x_0=(c_1,c_2)\), then
\[\mathbf x_k=c_1\,2^k\begin{bmatrix} 1\\ 0\end{bmatrix}+c_2\,(0.5)^k\begin{bmatrix} 0\\ 1\end{bmatrix}=\begin{bmatrix} c_1\,2^k\\ c_2\,(0.5)^k\end{bmatrix}.\]If \(\mathbf x_0\) is on the \(x_2\)-axis, then \(c_1=0\) and \(\mathbf x_k=(0,\ c_2(0.5)^k)\to\mathbf 0\). If \(\mathbf x_0\) is not on the \(x_2\)-axis, then \(c_1\ne 0\) and the first entry \(c_1\,2^k\) grows without bound, so the solution is unbounded.
For example, \(\mathbf x_0=(0.4,\ 3)\) gives \(\mathbf x_1=(0.8,\ 1.5)\), \(\mathbf x_2=(1.6,\ 0.75)\), \(\mathbf x_3=(3.2,\ 0.375)\). The point first comes closer to the origin and then moves away along the \(x_1\)-axis (Figure 4). The origin attracts along one direction and repels along another. The direction of greatest attraction is the \(x_2\)-axis (eigenvalue \(0.5\)), and the direction of greatest repulsion is the \(x_1\)-axis (eigenvalue \(2\)).
Self-check only. These exercises are not graded. Entries may be typed as integers, decimals (1.5 or 1,5) or simple fractions (3/2).
Let \(A=\begin{bmatrix} 2.5 & -2\\ 1 & -0.5\end{bmatrix}\) and \(\mathbf x_0=\begin{bmatrix} 5\\ 4\end{bmatrix}\). The vectors \(\mathbf v_1=\begin{bmatrix} 2\\ 1\end{bmatrix}\) and \(\mathbf v_2=\begin{bmatrix} 1\\ 1\end{bmatrix}\) are eigenvectors of \(A\).
Self-check only.
Classify the origin for the dynamical system \(\mathbf x_{k+1}=A\mathbf x_k\).
Day 2: Markov Chains
Today we return to the transition matrices of Week 4, describe them with probabilities, follow a chain of state vectors over many steps, and meet the state that does not change.
2.1 Probability vectors and stochastic matrices
In Week 4 a population was divided into groups, and a transition matrix \(M\) moved the state forward by one period: \(\mathbf x_{k+1}=M\mathbf x_k\). The entry in row \(i\), column \(j\) of \(M\) was the fraction of group \(j\) that is in group \(i\) one period later, so each column of \(M\) added up to \(1\). The same model is used whenever a system is in one of several states and moves between them with fixed fractions or probabilities.
A vector with nonnegative entries that add up to \(1\) is called a probability vector. A stochastic matrix is a square matrix whose columns are probability vectors.
A Markov chain is a sequence of probability vectors \(\mathbf x_0,\mathbf x_1,\mathbf x_2,\dots\) together with a stochastic matrix \(P\) such that
\[\mathbf x_{k+1}=P\mathbf x_k\qquad(k=0,1,2,\dots).\]The vector \(\mathbf x_k\) is called the state vector at time \(k\).
For example, \((0.2,\ 0.5,\ 0.3)\) is a probability vector. The vector \((0.7,\ 0.4)\) is not, because its entries add up to \(1.1\), and \((1.2,\ -0.2)\) is not, because it has a negative entry.
The transition matrices of Week 4 are stochastic matrices. A state vector of Week 4 listed the sizes of the groups. Dividing it by the total size gives a probability vector, which lists the fraction of the population in each group.
In 2020 a region has 600,000 residents in the city and 400,000 in the suburbs. Each year 5% of the city residents move to the suburbs and 3% of the suburban residents move to the city. Write the model as a Markov chain and find the distribution of the population in 2021 and in 2022.
Solution
The total is 1,000,000, so 60% of the population lives in the city and 40% in the suburbs. Column 1 of \(P\) describes the city residents: 95% stay and 5% move. Column 2 describes the suburban residents: 3% move and 97% stay.
\[\mathbf x_0=\begin{bmatrix} 0.60\\ 0.40\end{bmatrix},\qquad P=\begin{bmatrix} 0.95 & 0.03\\ 0.05 & 0.97\end{bmatrix}.\]The entries of \(\mathbf x_0\) are nonnegative and add up to \(1\), so \(\mathbf x_0\) is a probability vector. The columns \((0.95,\ 0.05)\) and \((0.03,\ 0.97)\) of \(P\) are probability vectors, so \(P\) is a stochastic matrix. Two steps of the chain:
\[\mathbf x_1=P\mathbf x_0=\begin{bmatrix} 0.95(0.60)+0.03(0.40)\\ 0.05(0.60)+0.97(0.40)\end{bmatrix}=\begin{bmatrix} 0.570+0.012\\ 0.030+0.388\end{bmatrix}=\begin{bmatrix} 0.582\\ 0.418\end{bmatrix},\] \[\mathbf x_2=P\mathbf x_1=\begin{bmatrix} 0.95(0.582)+0.03(0.418)\\ 0.05(0.582)+0.97(0.418)\end{bmatrix}=\begin{bmatrix} 0.5529+0.01254\\ 0.0291+0.40546\end{bmatrix}=\begin{bmatrix} 0.56544\\ 0.43456\end{bmatrix}.\]In 2021, 58.2% of the population lives in the city. In 2022, about 56.5% does. The entries of \(\mathbf x_1\) and of \(\mathbf x_2\) again add up to \(1\).
The last observation is general. If \(P\) is a stochastic matrix with columns \(\mathbf p_1,\dots,\mathbf p_n\) and \(\mathbf x\) is a probability vector, then \(P\mathbf x=x_1\mathbf p_1+\cdots+x_n\mathbf p_n\). Its entries are nonnegative, and since the entries of each \(\mathbf p_j\) add up to \(1\), the entries of \(P\mathbf x\) add up to \(x_1\cdot 1+\cdots+x_n\cdot 1=1\). So \(P\mathbf x\) is again a probability vector, and a Markov chain never leaves the set of probability vectors.
A state vector can be read in two ways. For a large population, the entries are the fractions of the population in each state. For one member chosen at random, the entries are the probabilities that this member is in each state. In Example 1, a person who lives in the city now has the state vector \((1,0)\) now and \(P(1,0)=(0.95,\ 0.05)\) next year: the probability that this person lives in the suburbs next year is \(0.05\).
2.2 Following a chain for many steps
The most interesting question about a Markov chain is what happens after many steps. We first look at the numbers.
A system has three states. It moves between them according to the stochastic matrix \(P\), and it starts in state 1:
\[P=\begin{bmatrix} 0.5 & 0.2 & 0.3\\ 0.3 & 0.8 & 0.3\\ 0.2 & 0 & 0.4\end{bmatrix},\qquad \mathbf x_0=\begin{bmatrix} 1\\ 0\\ 0\end{bmatrix}.\]Compute \(\mathbf x_1\), \(\mathbf x_2\), \(\mathbf x_3\). What happens to the system as time passes?
Solution
Each state vector is \(P\) times the previous one. Since \(\mathbf x_0=\mathbf e_1\), the vector \(\mathbf x_1=P\mathbf e_1\) is the first column of \(P\):
\[\mathbf x_1=\begin{bmatrix} 0.5\\ 0.3\\ 0.2\end{bmatrix},\qquad \mathbf x_2=P\mathbf x_1=\begin{bmatrix} 0.25+0.06+0.06\\ 0.15+0.24+0.06\\ 0.10+0+0.08\end{bmatrix}=\begin{bmatrix} 0.37\\ 0.45\\ 0.18\end{bmatrix},\] \[\mathbf x_3=P\mathbf x_2=\begin{bmatrix} 0.185+0.090+0.054\\ 0.111+0.360+0.054\\ 0.074+0+0.072\end{bmatrix}=\begin{bmatrix} 0.329\\ 0.525\\ 0.146\end{bmatrix}.\]Further steps, with the entries rounded to four decimals:
| \(k\) | 0 | 1 | 2 | 3 | 4 | 6 | 8 | 10 | 15 |
|---|---|---|---|---|---|---|---|---|---|
| state 1 | 1 | 0.5 | 0.37 | 0.329 | 0.3133 | 0.3032 | 0.3008 | 0.3002 | 0.3000 |
| state 2 | 0 | 0.3 | 0.45 | 0.525 | 0.5625 | 0.5906 | 0.5977 | 0.5994 | 0.6000 |
| state 3 | 0 | 0.2 | 0.18 | 0.146 | 0.1242 | 0.1062 | 0.1016 | 0.1004 | 0.1000 |
The state vectors change less and less from one step to the next. They seem to approach the vector \(\mathbf q=(0.3,\ 0.6,\ 0.1)\) (Figure 5). The following calculation is exact, with no rounding:
\[P\mathbf q=\begin{bmatrix} 0.5 & 0.2 & 0.3\\ 0.3 & 0.8 & 0.3\\ 0.2 & 0 & 0.4\end{bmatrix}\begin{bmatrix} 0.3\\ 0.6\\ 0.1\end{bmatrix}=\begin{bmatrix} 0.15+0.12+0.03\\ 0.09+0.48+0.03\\ 0.06+0+0.04\end{bmatrix}=\begin{bmatrix} 0.3\\ 0.6\\ 0.1\end{bmatrix}=\mathbf q.\]When the system is in the state \(\mathbf q\), one more step does not change it.
2.3 Several steps at once
Since \(\mathbf x_2=P\mathbf x_1=P(P\mathbf x_0)=P^2\mathbf x_0\), and in the same way \(\mathbf x_3=P^3\mathbf x_0\),
\[\mathbf x_k=P^k\mathbf x_0\qquad(k=0,1,2,\dots).\]The matrix \(P^k\) describes \(k\) steps at once. Its entry in row \(i\), column \(j\) is the probability of being in state \(i\) after \(k\) steps for a member that starts in state \(j\).
For the matrix \(P\) of Example 2, compute \(P^2\). What is the probability that a system that starts in state 2 is in state 3 two steps later?
Solution
Multiply row by column:
\[P^2=\begin{bmatrix} 0.5 & 0.2 & 0.3\\ 0.3 & 0.8 & 0.3\\ 0.2 & 0 & 0.4\end{bmatrix}\begin{bmatrix} 0.5 & 0.2 & 0.3\\ 0.3 & 0.8 & 0.3\\ 0.2 & 0 & 0.4\end{bmatrix}=\begin{bmatrix} 0.37 & 0.26 & 0.33\\ 0.45 & 0.70 & 0.45\\ 0.18 & 0.04 & 0.22\end{bmatrix}.\]For example, the entry in row 3, column 2 is \(0.2(0.2)+0(0.8)+0.4(0)=0.04\). This entry is the answer: the probability is \(0.04\). In one step the system cannot go from state 2 to state 3, because the entry in row 3, column 2 of \(P\) is \(0\). In two steps it can, by going to state 1 first: \(0.2\cdot 0.2=0.04\).
Two checks. The columns of \(P^2\) add up to \(1\), so \(P^2\) is again a stochastic matrix. The first column of \(P^2\) is \(P^2\mathbf e_1=(0.37,\ 0.45,\ 0.18)\), the vector \(\mathbf x_2\) of Example 2.
2.4 Steady-state vectors
If \(P\) is a stochastic matrix, a steady-state vector (or equilibrium vector) for \(P\) is a probability vector \(\mathbf q\) such that
\[P\mathbf q=\mathbf q.\]If the system is in the state \(\mathbf q\), it stays there: \(\mathbf x_k=\mathbf q\) gives \(\mathbf x_{k+1}=P\mathbf q=\mathbf q\). In Example 2, \(\mathbf q=(0.3,\ 0.6,\ 0.1)\) is a steady-state vector. Checking a given vector needs two things: the vector is a probability vector, and \(P\) does not change it.
Let \(P=\begin{bmatrix} 0.95 & 0.03\\ 0.05 & 0.97\end{bmatrix}\) be the matrix of Example 1. Decide whether each vector is a steady-state vector for \(P\).
Solution
With a total population of 1,000,000, the steady state of Example 4 has 375,000 residents in the city and 625,000 in the suburbs. Each year \(0.05(375{,}000)=18{,}750\) people leave the city and \(0.03(625{,}000)=18{,}750\) arrive. These are the levels that the populations approached in Week 4.
A chain does not always approach a steady-state vector.
Let \(R=\begin{bmatrix} 0 & 1\\ 1 & 0\end{bmatrix}\). Show that \(\mathbf q=(0.5,\ 0.5)\) is a steady-state vector for \(R\), and describe the Markov chain that starts at \(\mathbf x_0=(1,0)\).
Solution
\(R\) is a stochastic matrix, and multiplication by \(R\) interchanges the two entries of a vector. So \(R\mathbf q=(0.5,\ 0.5)=\mathbf q\), and \(\mathbf q\) is a steady-state vector. The chain from \(\mathbf x_0=(1,0)\) is
\[\mathbf x_1=\begin{bmatrix} 0\\ 1\end{bmatrix},\quad \mathbf x_2=\begin{bmatrix} 1\\ 0\end{bmatrix},\quad \mathbf x_3=\begin{bmatrix} 0\\ 1\end{bmatrix},\ \dots\]The system changes its state at every step. The chain alternates between two vectors and does not approach \(\mathbf q\) or any other vector.
Examples 2, 4 and 5 leave three questions open. Does every stochastic matrix have a steady-state vector? How is it found, when it is not given? When does the chain approach it? All three are answered with eigenvalues and eigenvectors, because \(P\mathbf q=\mathbf q\) says that \(\mathbf q\) is an eigenvector of \(P\) for the eigenvalue \(1\).
Self-check only.
The users of a phone service are on the Basic plan or on the Premium plan. Each month 10% of the Basic users move to Premium and 30% of the Premium users move to Basic. This month half of the users are on each plan. Take state 1 to be Basic and state 2 to be Premium.
Self-check only.
Self-check only.
Let \(P=\begin{bmatrix} 0.9 & 0.3\\ 0.1 & 0.7\end{bmatrix}\) be the matrix of the phone service: state 1 is Basic and state 2 is Premium.
Day 3: Markov Chains with Eigenvalues and Eigenvectors
Today we show that \(1\) is an eigenvalue of every stochastic matrix, find steady-state vectors as eigenvectors, and use the eigenvector decomposition to explain why a chain approaches its steady state.
3.1 The eigenvalue 1
A steady-state vector satisfies \(P\mathbf q=\mathbf q=1\,\mathbf q\). So a steady-state vector is an eigenvector of \(P\) for the eigenvalue \(1\) that is also a probability vector. The first question is whether \(1\) is always an eigenvalue.
If \(P\) is a stochastic matrix, then \(1\) is an eigenvalue of \(P\).
Proof. A number \(\lambda\) is an eigenvalue of \(P\) exactly when \(\det(P-\lambda I)=0\), so we show that \(\det(P-I)=0\). Each column of \(P\) adds up to \(1\), and subtracting \(I\) lowers exactly one entry of each column by \(1\). So each column of \(P-I\) adds up to \(0\). Now add rows \(1,\dots,n-1\) of \(P-I\) to row \(n\). These are row replacements, so the determinant does not change. The new row \(n\) contains the column sums, so it is a row of zeros, and a matrix with a row of zeros has determinant \(0\). Hence \(\det(P-I)=0\), and \(1\) is an eigenvalue of \(P\). \(\blacksquare\)
Find the eigenvalues of \(P=\begin{bmatrix} 0.6 & 0.3\\ 0.4 & 0.7\end{bmatrix}\).
Solution
The columns are probability vectors, so \(P\) is stochastic. As in the proof, the columns of \(P-I=\begin{bmatrix} -0.4 & 0.3\\ 0.4 & -0.3\end{bmatrix}\) add up to \(0\), and \(\det(P-I)=0.12-0.12=0\). The characteristic polynomial is
\[\det(P-\lambda I)=(0.6-\lambda)(0.7-\lambda)-0.12=\lambda^2-1.3\lambda+0.3=(\lambda-1)(\lambda-0.3).\]The eigenvalues are \(1\) and \(0.3\).
By Theorem 10, the equation \((P-I)\mathbf x=\mathbf 0\) always has nonzero solutions. It can be shown that one of them has nonnegative entries, so that it can be scaled to a probability vector. Every stochastic matrix has a steady-state vector.
3.2 Finding a steady-state vector
To find a steady-state vector, find an eigenvector for the eigenvalue \(1\) and scale it so that its entries add up to \(1\).
- Form \(P-I\) by subtracting \(1\) from each diagonal entry of \(P\).
- Solve \((P-I)\mathbf x=\mathbf 0\) by row reducing the augmented matrix \([\,P-I\mid\mathbf 0\,]\). Multiplying the rows by \(10\) or \(100\) first removes the decimals.
- Choose a nonzero solution \(\mathbf w\) with simple entries.
- Divide \(\mathbf w\) by the sum of its entries. The result is \(\mathbf q\). Check that \(P\mathbf q=\mathbf q\).
Find a steady-state vector for \(P=\begin{bmatrix} 0.6 & 0.3\\ 0.4 & 0.7\end{bmatrix}\).
Solution
Steps 1 and 2. The equation \(P\mathbf x=\mathbf x\) is the same as \((P-I)\mathbf x=\mathbf 0\). Row reduce with \(R_2\to R_2+R_1\) and then \(R_1\to-\tfrac{1}{0.4}R_1\):
\[\left[\begin{array}{cc|c} -0.4 & 0.3 & 0\\ 0.4 & -0.3 & 0\end{array}\right]\sim\left[\begin{array}{cc|c} -0.4 & 0.3 & 0\\ 0 & 0 & 0\end{array}\right]\sim\left[\begin{array}{cc|c} 1 & -3/4 & 0\\ 0 & 0 & 0\end{array}\right].\]So \(x_1=\tfrac34x_2\) and \(x_2\) is free. The general solution is \(x_2\begin{bmatrix} 3/4\\ 1\end{bmatrix}\).
Step 3. With \(x_2=4\) the solution has no fractions: \(\mathbf w=\begin{bmatrix} 3\\ 4\end{bmatrix}\).
Step 4. The entries of \(\mathbf w\) add up to \(7\), so
\[\mathbf q=\frac17\begin{bmatrix} 3\\ 4\end{bmatrix}=\begin{bmatrix} 3/7\\ 4/7\end{bmatrix}\approx\begin{bmatrix} 0.429\\ 0.571\end{bmatrix}.\]Check.
\[P\mathbf q=\begin{bmatrix} 6/10 & 3/10\\ 4/10 & 7/10\end{bmatrix}\begin{bmatrix} 3/7\\ 4/7\end{bmatrix}=\begin{bmatrix} 18/70+12/70\\ 12/70+28/70\end{bmatrix}=\begin{bmatrix} 30/70\\ 40/70\end{bmatrix}=\mathbf q.\]3.3 Why the chain approaches the steady state
A steady-state vector is a state that does not change. The more important fact is that, for most stochastic matrices, every Markov chain moves toward it. The eigenvector decomposition of Day 1 shows why: if \(\mathbf x_0=c_1\mathbf v_1+c_2\mathbf v_2\) with eigenvectors \(\mathbf v_1,\mathbf v_2\) of \(P\) for the eigenvalues \(\lambda_1,\lambda_2\), then \(\mathbf x_k=c_1\lambda_1^k\mathbf v_1+c_2\lambda_2^k\mathbf v_2\).
Let \(P=\begin{bmatrix} 0.6 & 0.3\\ 0.4 & 0.7\end{bmatrix}\) and let \(\mathbf x_0\) be any probability vector. Show that the Markov chain \(\mathbf x_{k+1}=P\mathbf x_k\) converges to \(\mathbf q=(3/7,\ 4/7)\).
Solution
By Examples 1 and 2, the eigenvalues of \(P\) are \(1\) and \(0.3\), and \(\mathbf v_1=\begin{bmatrix} 3\\ 4\end{bmatrix}\) is an eigenvector for \(1\). For \(\lambda=0.3\): \(P-0.3I=\begin{bmatrix} 0.3 & 0.3\\ 0.4 & 0.4\end{bmatrix}\), so \(x_1=-x_2\) and \(\mathbf v_2=\begin{bmatrix} 1\\ -1\end{bmatrix}\). Write \(\mathbf x_0=c_1\mathbf v_1+c_2\mathbf v_2\). Then
\[\mathbf x_k=c_1\cdot 1^k\,\mathbf v_1+c_2\,(0.3)^k\,\mathbf v_2=c_1\begin{bmatrix} 3\\ 4\end{bmatrix}+c_2\,(0.3)^k\begin{bmatrix} 1\\ -1\end{bmatrix}\ \to\ c_1\begin{bmatrix} 3\\ 4\end{bmatrix}\qquad\text{as }k\to\infty,\]because \((0.3)^k\to 0\). It remains to find \(c_1\). Add the two entries of \(\mathbf x_0=c_1(3,4)+c_2(1,-1)\). The entries of \(\mathbf x_0\) add up to \(1\), the entries of \(\mathbf v_1\) add up to \(7\), and the entries of \(\mathbf v_2\) add up to \(0\):
\[1=7c_1+0\cdot c_2,\qquad\text{so } c_1=\tfrac17\ \text{ for every probability vector }\mathbf x_0.\]Hence \(\mathbf x_k\to\tfrac17(3,4)=\mathbf q\), whatever the starting state is. The starting state only decides \(c_2\), and the term with \(c_2\) dies out. For \(\mathbf x_0=(1,0)\):
| \(k\) | 0 | 1 | 2 | 3 | 4 | limit |
|---|---|---|---|---|---|---|
| first entry of \(\mathbf x_k\) | 1 | 0.6 | 0.48 | 0.444 | 0.4332 | \(3/7\approx 0.4286\) |
| second entry of \(\mathbf x_k\) | 0 | 0.4 | 0.52 | 0.556 | 0.5668 | \(4/7\approx 0.5714\) |
Figure 6 shows this chain and the chain that starts at \((0,1)\). The probability vectors of \(\mathbb R^2\) form the segment from \((1,0)\) to \((0,1)\). Both chains move along the segment to the point where it meets the line through \(\mathbf v_1\).
The argument of Example 3 used two facts: \(1\) is an eigenvalue, and the other eigenvalue is less than \(1\) in absolute value.
An eigenvalue \(\lambda_1\) of a matrix \(A\) is strictly dominant if \(|\lambda_1|\gt|\lambda|\) for every other eigenvalue \(\lambda\) of \(A\).
For the matrix of Example 3, with the eigenvalues \(1\) and \(0.3\), the eigenvalue \(1\) is strictly dominant. For \(R=\begin{bmatrix} 0 & 1\\ 1 & 0\end{bmatrix}\), the characteristic polynomial is \(\lambda^2-1=(\lambda-1)(\lambda+1)\). The eigenvalues are \(1\) and \(-1\), and neither is strictly dominant: the term for \(\lambda=-1\) changes its sign at every step and never dies out. This is the chain of Day 2 that does not settle.
The eigenvalue \(1\) is strictly dominant for the following class of stochastic matrices.
A stochastic matrix \(P\) is regular if some power \(P^k\) contains only strictly positive entries.
Decide whether each stochastic matrix is regular.
Solution
If \(P\) is an \(n\times n\) regular stochastic matrix, then \(P\) has a unique steady-state vector \(\mathbf q\). Further, if \(\mathbf x_0\) is any initial state and \(\mathbf x_{k+1}=P\mathbf x_k\) for \(k=0,1,2,\dots\), then the Markov chain \(\{\mathbf x_k\}\) converges to \(\mathbf q\) as \(k\to\infty\).
Here "converges to \(\mathbf q\)" means that the entries of \(\mathbf x_k\) can be made as close as desired to the corresponding entries of \(\mathbf q\) by taking \(k\) large enough. The proof of Theorem 11 is omitted. The idea is the one of Example 3: for a regular stochastic matrix, \(1\) is a strictly dominant eigenvalue, so in \(\mathbf x_k\) every term except the one for \(\lambda=1\) dies out. The initial state has no effect on the long-term behavior of the chain.
Explain why the city and suburbs chain with \(P=\begin{bmatrix} 0.95 & 0.03\\ 0.05 & 0.97\end{bmatrix}\) and \(\mathbf x_0=(0.6,\ 0.4)\) approaches \(\mathbf q=(0.375,\ 0.625)\), and why it does so slowly.
Solution
All entries of \(P\) are strictly positive, so \(P\) is regular. By Theorem 11, \(P\) has exactly one steady-state vector, and every chain converges to it. On Day 2 we checked that \(\mathbf q=(0.375,\ 0.625)\) is a steady-state vector, so it is the limit.
For the speed, look at the eigenvalues. The characteristic polynomial is
\[\det(P-\lambda I)=(0.95-\lambda)(0.97-\lambda)-0.0015=\lambda^2-1.92\lambda+0.92=(\lambda-1)(\lambda-0.92).\]The eigenvalues are \(1\) and \(0.92\), with the eigenvectors \(\mathbf v_1=(3,5)\) and \(\mathbf v_2=(1,-1)\): indeed \(P-0.92I=\begin{bmatrix} 0.03 & 0.03\\ 0.05 & 0.05\end{bmatrix}\). As in Example 3, the weight on \(\mathbf v_1\) is \(c_1=\tfrac18\), and the first entry of \(\mathbf x_0\) gives \(c_2=0.6-0.375=0.225\):
\[\mathbf x_k=\begin{bmatrix} 0.375\\ 0.625\end{bmatrix}+0.225\,(0.92)^k\begin{bmatrix} 1\\ -1\end{bmatrix}.\]The distance to the steady state is multiplied by \(0.92\) each year. Since \(0.92\) is close to \(1\), the approach is slow: \((0.92)^{10}\approx 0.43\), so after ten years more than 40% of the distance is still left. In Example 3 the factor is \(0.3\), and four steps are enough for two correct decimals.
3.4 The subscription model
In Week 4 a service had the plans Free, Plus and Pro, with 10,000, 4,000 and 1,000 users, and the monthly transition matrix
\[M=\begin{bmatrix} 0.80 & 0.10 & 0.05\\ 0.15 & 0.70 & 0.10\\ 0.05 & 0.20 & 0.85\end{bmatrix}.\]What are the numbers of users of the three plans in the long run?
Solution
\(M\) is a stochastic matrix, and all its entries are strictly positive, so \(M\) is regular. By Theorem 11, the fractions of users on the three plans converge to the unique steady-state vector \(\mathbf q\), whatever the starting numbers are.
Steps 1 and 2. Form \(M-I\) and multiply each row of the augmented matrix by \(20\):
\[\left[\begin{array}{ccc|c} -0.20 & 0.10 & 0.05 & 0\\ 0.15 & -0.30 & 0.10 & 0\\ 0.05 & 0.20 & -0.15 & 0\end{array}\right]\sim\left[\begin{array}{ccc|c} -4 & 2 & 1 & 0\\ 3 & -6 & 2 & 0\\ 1 & 4 & -3 & 0\end{array}\right].\]Interchange \(R_1\) and \(R_3\); then \(R_2\to R_2-3R_1\) and \(R_3\to R_3+4R_1\); then \(R_3\to R_3+R_2\):
\[\left[\begin{array}{ccc|c} 1 & 4 & -3 & 0\\ 3 & -6 & 2 & 0\\ -4 & 2 & 1 & 0\end{array}\right]\sim\left[\begin{array}{ccc|c} 1 & 4 & -3 & 0\\ 0 & -18 & 11 & 0\\ 0 & 18 & -11 & 0\end{array}\right]\sim\left[\begin{array}{ccc|c} 1 & 4 & -3 & 0\\ 0 & -18 & 11 & 0\\ 0 & 0 & 0 & 0\end{array}\right].\]The variable \(x_3\) is free. Row 2 gives \(x_2=\tfrac{11}{18}x_3\), and row 1 gives \(x_1=-4x_2+3x_3=-\tfrac{44}{18}x_3+\tfrac{54}{18}x_3=\tfrac{10}{18}x_3\).
Step 3. With \(x_3=18\): \(\mathbf w=\begin{bmatrix} 10\\ 11\\ 18\end{bmatrix}\).
Step 4. The entries of \(\mathbf w\) add up to \(39\):
\[\mathbf q=\frac{1}{39}\begin{bmatrix} 10\\ 11\\ 18\end{bmatrix}\approx\begin{bmatrix} 0.256\\ 0.282\\ 0.462\end{bmatrix}.\]Check. It is enough to check \(M\mathbf w=\mathbf w\), one row at a time:
\[\begin{aligned} 0.80(10)+0.10(11)+0.05(18)&=8+1.1+0.9=10,\\ 0.15(10)+0.70(11)+0.10(18)&=1.5+7.7+1.8=11,\\ 0.05(10)+0.20(11)+0.85(18)&=0.5+2.2+15.3=18.\end{aligned}\]Answer. The total number of users stays 15,000. In the long run there are about \(15{,}000\cdot\tfrac{10}{39}\approx 3{,}846\) Free users, \(15{,}000\cdot\tfrac{11}{39}\approx 4{,}231\) Plus users and \(15{,}000\cdot\tfrac{18}{39}\approx 6{,}923\) Pro users. Direct computation with \(\mathbf x_{k+1}=M\mathbf x_k\) agrees:
| month \(k\) | 0 | 1 | 2 | 6 | 12 | 24 | 36 |
|---|---|---|---|---|---|---|---|
| Free | 10,000 | 8,450 | 7,307.5 | 4,987.6 | 4,071.5 | 3,855.2 | 3,846.5 |
| Plus | 4,000 | 4,400 | 4,562.5 | 4,492.6 | 4,295.6 | 4,233.5 | 4,230.9 |
| Pro | 1,000 | 2,150 | 3,130 | 5,519.8 | 6,632.9 | 6,911.3 | 6,922.6 |
The service starts with two thirds of its users on Free, and it ends with almost half of its users on Pro. The steady state depends only on \(M\), not on the starting numbers.
Self-check only.
A campus bike share has two stations, North and South, and 200 bikes. Each day 30% of the bikes that start at North end the day at South, and 20% of the bikes that start at South end the day at North. With North as state 1, the stochastic matrix is \(P=\begin{bmatrix} 0.7 & 0.2\\ 0.3 & 0.8\end{bmatrix}\).
Self-check only.
Self-check only.
Find the steady-state vector of the regular stochastic matrix \(P=\begin{bmatrix} 0.7 & 0.1 & 0.1\\ 0.2 & 0.8 & 0.2\\ 0.1 & 0.1 & 0.7\end{bmatrix}\).
Multiply the rows of \([\,P-I\mid\mathbf 0\,]\) by \(10\):
\[\left[\begin{array}{ccc|c} -3 & 1 & 1 & 0\\ 2 & -2 & 2 & 0\\ 1 & 1 & -3 & 0\end{array}\right].\]Subtracting row 3 from row 1 gives \(-4x_1+4x_3=0\), so \(x_1=x_3\). Row 3 then gives \(x_2=3x_3-x_1=2x_3\). Row 2 is satisfied: \(2x_3-4x_3+2x_3=0\). With \(x_3=1\): \(\mathbf w=(1,2,1)\), with entry sum \(4\). So \(\mathbf q=(0.25,\ 0.5,\ 0.25)\).
Check:
\[P\mathbf q=\begin{bmatrix} 0.175+0.05+0.025\\ 0.05+0.4+0.05\\ 0.025+0.05+0.175\end{bmatrix}=\begin{bmatrix} 0.25\\ 0.5\\ 0.25\end{bmatrix}=\mathbf q.\]Homework 14
- Fill in your name and surname below before you save the PDF.
- This homework covers Week 13 (diagonalization), which had no homework, and Week 14.
- Show your work. For each step, name the theorem, the row operation or the reason you use. An answer without the steps that lead to it does not receive full credit.
- Every question has two answer modes: Type and Write by hand. In Write by hand mode the text boxes are replaced by a writing area where you can write with a pen, your finger or the mouse. For each question, only the answer of the selected mode goes into the PDF. Changing the mode does not delete what you entered in the other mode.
- In Type mode, write a vector as
(1, -2, 3), a matrix as[1 2; 3 4](rows separated by semicolons), a power as0.5^k, and a polynomial asL^2 - 3L + 2withLfor \(\lambda\). - To submit: press "Save homework as PDF", choose "Save as PDF" in the print dialog, and upload the file to Canvas.
- Your answers are saved automatically in this browser. If you open the page on a different computer or browser, they will not be there.
Question 120 points
Question 220 points
Let \(A=\begin{bmatrix} 1.7 & -0.3\\ -1.2 & 0.8\end{bmatrix}\) and \(\mathbf x_0=\begin{bmatrix} 3\\ 2\end{bmatrix}\), and consider the dynamical system \(\mathbf x_{k+1}=A\mathbf x_k\).
Question 320 points
Weights, formula for \(\mathbf x_k\) and limit:
Question 420 points
Each week a commuter either drives or takes the train. Of the commuters who drive in one week, 80% drive again in the next week and 20% take the train. Of the commuters who take the train in one week, 40% drive in the next week and 60% take the train again. This week half of the commuters drive and half take the train. Take state 1 to be "drives" and state 2 to be "takes the train".
Initial state vector:
Question 520 points
Why \(P\) is regular, steady-state vector, check, and numbers of cars: