M301 Linear Algebra · Week 14

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.

The solution of \(\mathbf x_{k+1}=A\mathbf x_k\)

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\).

Example 1 (a formula with three eigenvectors)

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.

Example 2 (long-term behavior of the grocery chain model)

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.

3,0004,0005,0006,0007,0000123456789106,0004,000AdaBayk (months)
Figure 1. The grocery chain model for ten months: \(\mathbf x_k=(6{,}000,\ 4{,}000)-2{,}000\,(0.5)^k(1,-1)\). The dots are the vectors \(\mathbf x_k\). Both sequences approach the dashed levels.

Two remarks on Example 2.

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.

Definition (attractor, repeller, saddle point)

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

(a) an attractor if \(|\lambda_1|\lt 1\) and \(|\lambda_2|\lt 1\);
(b) a repeller if \(|\lambda_1|\gt 1\) and \(|\lambda_2|\gt 1\);
(c) a saddle point if one of \(|\lambda_1|,|\lambda_2|\) is greater than \(1\) and the other is less than \(1\).

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.

Example 3 (the origin as an attractor)

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.

−3−2−1123−3−2−1123x1x2x0x1x2
Figure 2. The origin as an attractor: trajectories for \(A=\begin{bmatrix} 0.8 & 0\\ 0 & 0.64\end{bmatrix}\) that start on the square with corners \((\pm 3,\pm 3)\). The trajectory from \(\mathbf x_0=(3,3)\) is highlighted.
Example 4 (the origin as a repeller)

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.

−3−2−1123−3−2−1123x1x2x9x10x11
Figure 3. The origin as a repeller: trajectories for \(A=\begin{bmatrix} 1.44 & 0\\ 0 & 1.2\end{bmatrix}\) that start close to \(\mathbf 0\). The trajectory from \(\mathbf x_0=(0.05,\ 0.3)\) is highlighted.
Example 5 (the origin as a saddle point)

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\)).

−3−2−1123−3−2−1123x1x2x0x1x2x3
Figure 4. The origin as a saddle point: trajectories for \(A=\begin{bmatrix} 2 & 0\\ 0 & 0.5\end{bmatrix}\) that start on or near the \(x_2\)-axis. The trajectory from \(\mathbf x_0=(0.4,\ 3)\) is highlighted.
Exercise 1.A (a formula for \(\mathbf x_k\))

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\).

(a) The eigenvalues \(\lambda_1\) of \(\mathbf v_1\) and \(\lambda_2\) of \(\mathbf v_2\):
\(\lambda_1=\) \(\lambda_2=\)
(b) The weights with \(\mathbf x_0=c_1\mathbf v_1+c_2\mathbf v_2\):
\(c_1=\) \(c_2=\)
(c) Use the formula \(\mathbf x_k=c_1\lambda_1^k\mathbf v_1+c_2\lambda_2^k\mathbf v_2\) to find \(\mathbf x_2\):
\(\mathbf x_2=(\) , \()\)
(d) As \(k\to\infty\), the sequence \(\mathbf x_k\)
(a) \(A\mathbf v_1=(5-2,\ 2-0.5)=(3,\ 1.5)=1.5\,\mathbf v_1\) and \(A\mathbf v_2=(2.5-2,\ 1-0.5)=(0.5,\ 0.5)=0.5\,\mathbf v_2\). So \(\lambda_1=1.5\) and \(\lambda_2=0.5\).
(b) \(2c_1+c_2=5\) and \(c_1+c_2=4\). Subtracting gives \(c_1=1\), and then \(c_2=3\).
(c) The formula gives \[\mathbf x_2=(1.5)^2\begin{bmatrix} 2\\ 1\end{bmatrix}+3(0.5)^2\begin{bmatrix} 1\\ 1\end{bmatrix}=\begin{bmatrix} 4.5+0.75\\ 2.25+0.75\end{bmatrix}=\begin{bmatrix} 5.25\\ 3\end{bmatrix}.\] Direct check: \(\mathbf x_1=A\mathbf x_0=(4.5,\ 3)\) and \(\mathbf x_2=A\mathbf x_1=(5.25,\ 3)\).
(d) \(\mathbf x_k=(1.5)^k\mathbf v_1+3(0.5)^k\mathbf v_2\). The second term tends to \(\mathbf 0\), and the first term grows without bound because \(c_1=1\ne 0\) and \(1.5\gt 1\). The sequence is unbounded.
Exercise 1.B (attractor, repeller or saddle point)

Self-check only.

Classify the origin for the dynamical system \(\mathbf x_{k+1}=A\mathbf x_k\).

(a) \(A=\begin{bmatrix} 0.5 & 0\\ 0 & 0.9\end{bmatrix}\)
(b) \(A=\begin{bmatrix} -1.5 & 0\\ 0 & 3\end{bmatrix}\)
(c) \(A=\begin{bmatrix} 0.4 & 0\\ 0 & 1.7\end{bmatrix}\)
(d) Let \(A=\begin{bmatrix} 3 & 0\\ 0 & 0.2\end{bmatrix}\). Enter a starting point \(\mathbf x_0\ne\mathbf 0\) whose trajectory tends to \(\mathbf 0\). Any correct point is accepted.
\(\mathbf x_0=(\) , \()\)
(a) \(|0.5|\lt 1\) and \(|0.9|\lt 1\): attractor.
(b) \(|-1.5|=1.5\gt 1\) and \(|3|\gt 1\): repeller. The sign of an eigenvalue does not matter for the classification, only its absolute value.
(c) \(|0.4|\lt 1\) and \(|1.7|\gt 1\): saddle point.
(d) \(\mathbf x_k=(c_1\,3^k,\ c_2\,(0.2)^k)\). The first entry stays bounded only when \(c_1=0\). Every point \((0,c_2)\) with \(c_2\ne 0\) is correct, for example \(\mathbf x_0=(0,1)\): these are the points of the direction of greatest attraction.

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.

Definition (probability vector, stochastic matrix, Markov chain)

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.

Example 1 (the city and suburbs model as a Markov chain)

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.

Warning (two readings of a state vector)

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.

Example 2 (a chain with three states)

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\)01234681015
state 110.50.370.3290.31330.30320.30080.30020.3000
state 200.30.450.5250.56250.59060.59770.59940.6000
state 300.20.180.1460.12420.10620.10160.10040.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.

00.20.40.60.81012351015state 1: 0.3state 2: 0.6state 3: 0.1k (steps)
Figure 5. The chain of Example 2: the three entries of \(\mathbf x_k\) for \(k=0,\dots,15\). They approach the dashed levels \(0.3\), \(0.6\) and \(0.1\).

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\).

Example 3 (two steps at once)

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

Definition (steady-state vector)

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.

Example 4 (checking a steady-state vector)

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\).

(a) \(\mathbf q=\begin{bmatrix} 0.375\\ 0.625\end{bmatrix}\)
(b) \(\mathbf u=\begin{bmatrix} 0.5\\ 0.5\end{bmatrix}\)
(c) \(\mathbf w=\begin{bmatrix} 3\\ 5\end{bmatrix}\)

Solution

(a) The entries of \(\mathbf q\) are nonnegative and \(0.375+0.625=1\), so \(\mathbf q\) is a probability vector. Multiply: \[P\mathbf q=\begin{bmatrix} 0.95(0.375)+0.03(0.625)\\ 0.05(0.375)+0.97(0.625)\end{bmatrix}=\begin{bmatrix} 0.35625+0.01875\\ 0.01875+0.60625\end{bmatrix}=\begin{bmatrix} 0.375\\ 0.625\end{bmatrix}=\mathbf q.\] So \(\mathbf q\) is a steady-state vector.
(b) \(\mathbf u\) is a probability vector, but the entries of \(P\mathbf u\) are \(0.475+0.015=0.49\) and \(0.025+0.485=0.51\). Since \(P\mathbf u\ne\mathbf u\), the vector \(\mathbf u\) is not a steady-state vector.
(c) The entries of \(P\mathbf w\) are \(2.85+0.15=3\) and \(0.15+4.85=5\), so \(P\mathbf w=\mathbf w\). But the entries of \(\mathbf w\) add up to \(8\), so \(\mathbf w\) is not a probability vector and not a steady-state vector. Dividing \(\mathbf w\) by \(8\) gives the vector \(\mathbf q\) of part (a).

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.

Example 5 (a chain that does not settle)

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\).

Exercise 2.A (setting up a Markov chain)

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.

(a) Enter the stochastic matrix \(P\):
\(P=\)
(b) Enter the state vectors after one month and after two months:
\(\mathbf x_1=(\) , \()\)   \(\mathbf x_2=(\) , \()\)
(a) Column 1 describes the Basic users: 90% stay and 10% move to Premium. Column 2 describes the Premium users: 30% move to Basic and 70% stay. So \(P=\begin{bmatrix} 0.9 & 0.3\\ 0.1 & 0.7\end{bmatrix}\). Both columns add up to \(1\).
(b) \(\mathbf x_0=(0.5,\ 0.5)\). The entries of \(\mathbf x_1=P\mathbf x_0\) are \(0.45+0.15=0.6\) and \(0.05+0.35=0.4\). The entries of \(\mathbf x_2=P\mathbf x_1\) are \(0.54+0.12=0.66\) and \(0.06+0.28=0.34\).
Exercise 2.B (probability vectors and steady states)

Self-check only.

(a) The vector \((0.25,\ 0.35,\ 0.4)\) is
(b) The matrix \(\begin{bmatrix} 0.3 & 0.6\\ 0.7 & 0.5\end{bmatrix}\) is
(c) For \(P=\begin{bmatrix} 0.9 & 0.3\\ 0.1 & 0.7\end{bmatrix}\), the vector \((0.75,\ 0.25)\) is
(d) For the same \(P\), the vector \((3,\ 1)\) is
(a) A probability vector: the entries are nonnegative and \(0.25+0.35+0.4=1\).
(b) Not stochastic: the second column adds up to \(0.6+0.5=1.1\).
(c) A steady-state vector: \(0.75+0.25=1\), and the entries of \(P(0.75,\ 0.25)\) are \(0.675+0.075=0.75\) and \(0.075+0.175=0.25\).
(d) Not a steady-state vector. The entries of \(P(3,1)\) are \(2.7+0.3=3\) and \(0.3+0.7=1\), so \(P\) does not change \((3,1)\). But the entries add up to \(4\), so \((3,1)\) is not a probability vector. Dividing by \(4\) gives the vector of part (c).
Exercise 2.C (two steps at once)

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.

(a) Compute \(P^2\):
\(P^2=\)
(b) The probability that a user who is on Basic now is on Premium two months from now:
(a) Row by column: \[P^2=\begin{bmatrix} 0.81+0.03 & 0.27+0.21\\ 0.09+0.07 & 0.03+0.49\end{bmatrix}=\begin{bmatrix} 0.84 & 0.48\\ 0.16 & 0.52\end{bmatrix}.\] Both columns add up to \(1\).
(b) The entry in row 2 (to Premium), column 1 (from Basic) of \(P^2\) is \(0.16\). The two ways to get there: stay on Basic and then move, \(0.9(0.1)=0.09\), or move and then stay on Premium, \(0.1(0.7)=0.07\).

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.

Theorem 10 (stochastic matrices)

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\)

Example 1 (the eigenvalues of a \(2\times 2\) stochastic matrix)

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\).

Algorithm (finding a steady-state vector of \(P\))
  1. Form \(P-I\) by subtracting \(1\) from each diagonal entry of \(P\).
  2. 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.
  3. Choose a nonzero solution \(\mathbf w\) with simple entries.
  4. Divide \(\mathbf w\) by the sum of its entries. The result is \(\mathbf q\). Check that \(P\mathbf q=\mathbf q\).
Example 2 (finding a steady-state vector)

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\).

Example 3 (every chain approaches \(\mathbf q\))

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\)01234limit
first entry of \(\mathbf x_k\)10.60.480.4440.4332\(3/7\approx 0.4286\)
second entry of \(\mathbf x_k\)00.40.520.5560.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\).

0.510.51x1x2x0 = (1, 0)x1 = (0.6, 0.4)x2 = (0.48, 0.52)y0y1q = (3/7, 4/7)line through (3, 4)(0, 1)
Figure 6. Two Markov chains for \(P=\begin{bmatrix} 0.6 & 0.3\\ 0.4 & 0.7\end{bmatrix}\), one from \(\mathbf x_0=(1,0)\) and one from \(\mathbf y_0=(0,1)\). Both stay on the segment of probability vectors and approach \(\mathbf q=(3/7,\ 4/7)\).

The argument of Example 3 used two facts: \(1\) is an eigenvalue, and the other eigenvalue is less than \(1\) in absolute value.

Definition (strictly dominant eigenvalue)

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.

Definition (regular stochastic matrix)

A stochastic matrix \(P\) is regular if some power \(P^k\) contains only strictly positive entries.

Example 4 (regular or not)

Decide whether each stochastic matrix is regular.

(a) \(P=\begin{bmatrix} 0.6 & 0.3\\ 0.4 & 0.7\end{bmatrix}\)
(b) \(Q=\begin{bmatrix} 0.5 & 0.2 & 0.3\\ 0.3 & 0.8 & 0.3\\ 0.2 & 0 & 0.4\end{bmatrix}\), for which \(Q^2=\begin{bmatrix} 0.37 & 0.26 & 0.33\\ 0.45 & 0.70 & 0.45\\ 0.18 & 0.04 & 0.22\end{bmatrix}\)
(c) \(R=\begin{bmatrix} 0 & 1\\ 1 & 0\end{bmatrix}\)

Solution

(a) All entries of \(P=P^1\) are strictly positive, so \(P\) is regular.
(b) \(Q\) has a zero entry, but every entry of \(Q^2\) is strictly positive. So \(Q\) is regular.
(c) \(R^2=I\), \(R^3=R\), \(R^4=I\), and so on. Every power of \(R\) is either \(R\) or \(I\), and both contain zeros. So \(R\) is not regular.
Theorem 11

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.

Example 5 (the city and suburbs model)

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

Example 6 (the long-run numbers of the three plans)

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\)0126122436
Free10,0008,4507,307.54,987.64,071.53,855.23,846.5
Plus4,0004,4004,562.54,492.64,295.64,233.54,230.9
Pro1,0002,1503,1305,519.86,632.96,911.36,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.

Exercise 3.A (the bike share)

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}\).

(a) Enter the steady-state vector \(\mathbf q\) of \(P\):
\(\mathbf q=(\) , \()\)
(b) The numbers of bikes in the long run:
North: South:
(c) The eigenvalue of \(P\) other than \(1\):
(a) \(P-I=\begin{bmatrix} -0.3 & 0.2\\ 0.3 & -0.2\end{bmatrix}\). The equation \(-0.3x_1+0.2x_2=0\) gives \(x_1=\tfrac23x_2\). With \(x_2=3\): \(\mathbf w=(2,3)\), with entry sum \(5\). So \(\mathbf q=(2/5,\ 3/5)=(0.4,\ 0.6)\). Check: the entries of \(P\mathbf q\) are \(0.28+0.12=0.4\) and \(0.12+0.48=0.6\).
(b) \(P\) is regular, so the chain converges to \(\mathbf q\) (Theorem 11): \(0.4(200)=80\) bikes at North and \(0.6(200)=120\) at South. In the steady state \(0.3(80)=24\) bikes go from North to South each day and \(0.2(120)=24\) go the other way.
(c) The characteristic polynomial is \[\det(P-\lambda I)=(0.7-\lambda)(0.8-\lambda)-0.06=\lambda^2-1.5\lambda+0.5=(\lambda-1)(\lambda-0.5).\] The other eigenvalue is \(0.5\): the distance to the steady state is halved every day.
Exercise 3.B (regular matrices and the eigenvalue 1)

Self-check only.

(a) The stochastic matrix \(\begin{bmatrix} 0 & 0.5\\ 1 & 0.5\end{bmatrix}\) is
(b) The stochastic matrix \(\begin{bmatrix} 0.7 & 0\\ 0.3 & 1\end{bmatrix}\) is
(c) If \(P\) is a stochastic matrix, the number \(1\) is an eigenvalue of \(P\):
(d) A stochastic matrix has the eigenvalues \(1\), \(0.4\) and \(-0.6\). The eigenvalue \(1\) is
(a) Regular: \(\begin{bmatrix} 0 & 0.5\\ 1 & 0.5\end{bmatrix}^2=\begin{bmatrix} 0.5 & 0.25\\ 0.5 & 0.75\end{bmatrix}\), and all entries are strictly positive.
(b) Not regular: a product of lower triangular matrices is lower triangular, so the entry in row 1, column 2 of every power is \(0\). For example, the square is \(\begin{bmatrix} 0.49 & 0\\ 0.51 & 1\end{bmatrix}\).
(c) Always (Theorem 10). Regularity is needed for the convergence in Theorem 11, not for the eigenvalue \(1\).
(d) Strictly dominant: \(|1|\gt|0.4|\) and \(|1|\gt|-0.6|=0.6\). The terms for \(0.4\) and \(-0.6\) die out.
Exercise 3.C (a steady-state vector in \(\mathbb R^3\))

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}\).

\(\mathbf q=(\) , , \()\)

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

Instructions
  • 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 as 0.5^k, and a polynomial as L^2 - 3L + 2 with L for \(\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

(a) The eigenvalues of \(A=\begin{bmatrix} -2 & -3 & 3\\ -3 & -2 & 3\\ -3 & -3 & 4\end{bmatrix}\) are \(1\) and \(-2\). Diagonalize \(A\), if possible: find a basis for each eigenspace, give \(P\) and \(D\), and check your answer with \(AP=PD\). If \(A\) is not diagonalizable, explain why. (12 points)
(b) Is \(B=\begin{bmatrix} 5 & 1\\ -1 & 3\end{bmatrix}\) diagonalizable? Justify your answer with the eigenvalues of \(B\) and the dimensions of the eigenspaces. (8 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\).

(a) Find the eigenvalues of \(A\) and an eigenvector for each eigenvalue. (8 points)
(b) Write \(\mathbf x_0\) as a linear combination of the eigenvectors and give a formula for \(\mathbf x_k\). Then compute \(\mathbf x_2\) from your formula and directly from \(\mathbf x_2=A(A\mathbf x_0)\). (7 points)
(c) Classify the origin as an attractor, a repeller or a saddle point. For which starting vectors \(\mathbf x_0\) does \(\mathbf x_k\) tend to \(\mathbf 0\)? Describe what happens to \(\mathbf x_k\) as \(k\to\infty\) for every other starting vector, and for the given \(\mathbf x_0\) in particular. (5 points)

Question 320 points

(a) Classify the origin as an attractor, a repeller or a saddle point for \(\mathbf x_{k+1}=A\mathbf x_k\) with each of the following matrices. Give the eigenvalues and one sentence of justification for each. (6 points) \[\begin{bmatrix} 0.9 & 0\\ 0 & 0.2\end{bmatrix},\qquad \begin{bmatrix} -1.5 & 0\\ 0 & 1.1\end{bmatrix},\qquad \begin{bmatrix} 0.5 & 4\\ 0 & -3\end{bmatrix}\]
(b) A \(3\times 3\) matrix \(A\) has the eigenvectors \(\mathbf v_1=\begin{bmatrix} 1\\ 1\\ 2\end{bmatrix}\), \(\mathbf v_2=\begin{bmatrix} 1\\ 0\\ -1\end{bmatrix}\), \(\mathbf v_3=\begin{bmatrix} 0\\ 1\\ -1\end{bmatrix}\) with the eigenvalues \(1\), \(0.5\) and \(-0.2\). Let \(\mathbf x_0=\begin{bmatrix} 5\\ 2\\ 5\end{bmatrix}\). Find the weights in \(\mathbf x_0=c_1\mathbf v_1+c_2\mathbf v_2+c_3\mathbf v_3\) by row reducing \([\,\mathbf v_1\ \mathbf v_2\ \mathbf v_3\mid\mathbf x_0\,]\) below. Then give a formula for \(\mathbf x_k\) and find the vector that \(\mathbf x_k\) approaches as \(k\to\infty\). (8 points)

Weights, formula for \(\mathbf x_k\) and limit:

(c) A \(2\times 2\) matrix \(A\) has the eigenvectors \(\mathbf v_1=\begin{bmatrix} 1\\ 1\end{bmatrix}\) and \(\mathbf v_2=\begin{bmatrix} 1\\ -1\end{bmatrix}\) with the eigenvalues \(1\) and \(-1\). Let \(\mathbf x_0=\begin{bmatrix} 3\\ 1\end{bmatrix}\). Give a formula for \(\mathbf x_k\), compute \(\mathbf x_1\), \(\mathbf x_2\) and \(\mathbf x_3\), and decide whether the sequence \(\mathbf x_k\) converges. Is the origin an attractor, a repeller, a saddle point, or none of these? (6 points)

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".

(a) Write the stochastic matrix \(P\) and the initial state vector \(\mathbf x_0\). (4 points)
\(P=\)

Initial state vector:

(b) Find \(\mathbf x_1\) and \(\mathbf x_2\). What fraction of the commuters drives two weeks from now? (4 points)
(c) Find the steady-state vector of \(P\) by solving \((P-I)\mathbf x=\mathbf 0\), and check it. (6 points)
(d) Find the eigenvalues of \(P\) and an eigenvector for each. Write \(\mathbf x_0\) in terms of the eigenvectors, give a formula for \(\mathbf x_k\), and use the formula to explain why \(\mathbf x_k\) converges to the steady-state vector. (6 points)

Question 520 points

(a) A car sharing company has 400 cars and three stations, 1, 2 and 3. A car that starts the day at one station ends the day at a station according to the stochastic matrix \[P=\begin{bmatrix} 0.6 & 0.2 & 0.1\\ 0.3 & 0.5 & 0.3\\ 0.1 & 0.3 & 0.6\end{bmatrix},\] where column \(j\) belongs to the cars that start at station \(j\). Explain why \(P\) is regular. Then find the steady-state vector of \(P\) by row reducing \([\,P-I\mid\mathbf 0\,]\) below, and give the number of cars at each station in the long run. (12 points)

Why \(P\) is regular, steady-state vector, check, and numbers of cars:

(b) Let \(P=\begin{bmatrix} 1-a & b\\ a & 1-b\end{bmatrix}\) with \(0\lt a\lt 1\) and \(0\lt b\lt 1\). Show that the eigenvalues of \(P\) are \(1\) and \(1-a-b\). Find the steady-state vector of \(P\) in terms of \(a\) and \(b\). Then explain why \(|1-a-b|\lt 1\), and what this says about the Markov chain \(\mathbf x_{k+1}=P\mathbf x_k\). (8 points)