Unit 4 Topic 4.14

Matrices Modeling Contexts

see every function move

3 min readfreeNot practiced

Beyond the exam. The AP® Precalculus exam does not test this unit. Many classes teach it, and it prepares you for calculus.

Matrices model situations where things move between a few states in steps: bikes between stations each day, customers between phone plans each month, a town's weather from one day to the next. If the chance of each move stays the same from step to step, one matrix predicts the whole future.

The transition matrix

Each day a bike at station A stays there with chance 0.80.8 and is ridden to B with chance 0.20.2. A bike at B goes to A with chance 0.30.3 and stays with chance 0.70.7. Put each station's chances in a column, "from" across the top and "to" down the side:

from Afrom B
to A0.80.80.30.3
to B0.20.20.70.7
T=[0.80.30.20.7]T = \left[ \begin{matrix} 0.8 & 0.3 \\ 0.2 & 0.7 \end{matrix} \right]

This is a transition matrix. Each column adds up to 11, because every bike ends the day somewhere. (Some books put "from" in the rows and multiply on the other side; the numbers are the same, read the other way. Check which way a matrix is set up before using it.)

Two circles, Station A and Station B. A loop on A is labeled 0.8 and an arrow from A to B is labeled 0.2; an arrow from B to A is labeled 0.3 and a loop on B is labeled 0.7. Each day a bike at A stays with chance 0.8 or moves to B with chance 0.2, and a bike at B moves to A with chance 0.3 or stays with chance 0.7.
Figure 1. The bike-share model as a diagram. LevlPrep original diagram.

One step forward

A state vector lists how many are in each state, here x0=[400100]\mathbf{x}_0 = \left[ \begin{matrix} 400 \\ 100 \end{matrix} \right]: 400400 bikes at A and 100100 at B. The expected numbers one day later are Tx0T\mathbf{x}_0.

Worked example 1. Predict the bikes at each station after one day and after two days.

x1\mathbf{x}_1=[0.80.30.20.7][400100]= \left[ \begin{matrix} 0.8 & 0.3 \\ 0.2 & 0.7 \end{matrix} \right]\left[ \begin{matrix} 400 \\ 100 \end{matrix} \right]=[0.8(400)+0.3(100)0.2(400)+0.7(100)]= \left[ \begin{matrix} 0.8(400) + 0.3(100) \\ 0.2(400) + 0.7(100) \end{matrix} \right]=[350150]= \left[ \begin{matrix} 350 \\ 150 \end{matrix} \right].

Row 1 collects everything that ends at A: 320320 bikes that stayed plus 3030 that came over from B.

x2\mathbf{x}_2=Tx1= T\mathbf{x}_1=[0.8(350)+0.3(150)0.2(350)+0.7(150)]= \left[ \begin{matrix} 0.8(350) + 0.3(150) \\ 0.2(350) + 0.7(150) \end{matrix} \right]=[325175]= \left[ \begin{matrix} 325 \\ 175 \end{matrix} \right]. The total stays 500500.

In general xn=Tnx0\mathbf{x}_n = T^n\mathbf{x}_0. A calculator with matrix operations finds T10T^{10} or T30T^{30} in one step.

One step back

If today's state is known, yesterday's solves Txyesterday=xtodayT\mathbf{x}_{\text{yesterday}} = \mathbf{x}_{\text{today}}, so xyesterday=T−1xtoday\mathbf{x}_{\text{yesterday}} = T^{-1}\mathbf{x}_{\text{today}}. Here det⁡T\det T=0.56−0.06= 0.56 - 0.06=0.5= 0.5, and T−1[350150]T^{-1}\left[ \begin{matrix} 350 \\ 150 \end{matrix} \right]=[400100]= \left[ \begin{matrix} 400 \\ 100 \end{matrix} \right], the starting state, as it should be.

The long run

Keep stepping and the numbers settle: 350350, 325325, 312.5312.5, ... at A, approaching 300300. A steady state is a vector that one more step does not change: Tx=xT\mathbf{x} = \mathbf{x}.

Worked example 2. Find the steady state for 500500 bikes.

At a steady state the bikes leaving A balance those arriving: 0.2a=0.3b0.2a = 0.3b, so a=1.5ba = 1.5b. With a+b=500a + b = 500: 2.5b=5002.5b = 500, b=200b = 200, a=300a = 300.

Check: T[300200]T\left[ \begin{matrix} 300 \\ 200 \end{matrix} \right]=[240+6060+140]= \left[ \begin{matrix} 240 + 60 \\ 60 + 140 \end{matrix} \right]=[300200]= \left[ \begin{matrix} 300 \\ 200 \end{matrix} \right].

The steady state does not depend on how the bikes start; with 400400 or 100100 at A, the system drifts toward 300300 and 200200.

Shares instead of counts

The same matrix works with shares that add up to 11. If today is rainy, the weather state is [01]\left[ \begin{matrix} 0 \\ 1 \end{matrix} \right] (chance of sun 00, chance of rain 11), and Tn[01]T^n\left[ \begin{matrix} 0 \\ 1 \end{matrix} \right] gives the chances of sun and rain nn days later.

Spot a mistake on this page?