Examples of Markov chains

This page contains examples of Markov chains in action.

A game of Monopoly, snakes and ladders or any other game whose moves are determined entirely by dice is a Markov chain. This is in contrast to card games such as poker or blackjack, where the cards represent a 'memory' of the past moves. To see the difference, consider the probability for a certain event in the game. In the above mentioned dice games, the only thing that matters is the current state of the board. The next state of the board depends on the current state, and the next roll of the dice. It doesn't depend on how things got to their current state. In a game such as poker or blackjack, a player can gain an advantage by remembering which hands have already been played (and hence which cards are no longer in the deck), so the next state (or hand) of the game is not independent of the past states.

Contents

A very simple weather model

The probabilities of weather conditions, given the weather on the preceding day, can be represented by a transition matrix:

<math>
   P = \begin{bmatrix}
       0.9 & 0.5 \\
       0.1 & 0.5
   \end{bmatrix}

<math> The matrix P represents the weather model in which a sunny day is 90% likely to be followed by another sunny day, and a rainy day is 50% likely to be followed by another rainy day. The columns can be labelled "sunny" and "rainy" respectively, and the rows can be labelled in the same order.

(P)i j is the probability that, if a given day is of type j, it will be followed by a day of type i.

Notice that the columns of P sum to 1: this is because P is a stochastic matrix.

Predicting the weather

The weather on day 0 is known to be sunny. This is represented by a vector in which the "sunny" entry is 100%, and the "rainy" entry is 0%:

<math>
   \mathbf{x}^{(0)} = \begin{bmatrix}
       1 \\
       0
   \end{bmatrix}

<math>

The weather on day 1 can be predicted by:

<math>
   \mathbf{x}^{(1)} = P \mathbf{x}^{(0)} = \begin{bmatrix}
       0.9 & 0.5 \\
       0.1 & 0.5
   \end{bmatrix}
   \begin{bmatrix}
       1 \\
       0
   \end{bmatrix}
   = \begin{bmatrix}
       0.9 \\
       0.1
   \end{bmatrix} 

<math>

Thus, there is an 90% chance that day 1 will also be sunny.

The weather on day 2 can be predicted in the same way:

<math>
   \mathbf{x}^{(2)} = P \mathbf{x}^{(1)} = P^2 \mathbf{x}^{(0)}
   = \begin{bmatrix}
       0.9 & 0.5 \\
       0.1 & 0.5
   \end{bmatrix}^2
   \begin{bmatrix}
       1 \\
       0
   \end{bmatrix}
   = \begin{bmatrix}
       0.86 \\
       0.14
   \end{bmatrix} 

<math>

General rules for day n are:

<math>
   \mathbf{x}^{(n)} = P \mathbf{x}^{(n-1)}

<math>

<math>
   \mathbf{x}^{(n)} = P^n \mathbf{x}^{(0)}

<math>

Steady state of the weather

In this example, predictions for the weather on more distant days are increasingly inaccurate and tend towards a steady state vector. This vector represents the probabilities of sunny and rainy weather on all days, and is independent of the initial weather.

The steady state vector is defined as:

<math>
   \mathbf{q} = \lim_{n \to \infty} \mathbf{x}^{(n)}

<math>

but only converges if P is a regular transition matrix (that is, there is at least one Pn with all non-zero entries).

Since the q is independent from initial conditions, it must be unchanged when transformed by P. This makes it an eigenvector (with eigenvalue 1), and means it can be derived from P. For the weather example:

<math>
   \begin{matrix}
       P & = & \begin{bmatrix}
           0.9 & 0.5 \\
           0.1 & 0.5
       \end{bmatrix}
       \\
       P \mathbf{q} & = & \mathbf{q}
       & \mbox{(} \mathbf{q} \mbox{ is unchanged by } P \mbox{.)}
       \\
       & = & I \mathbf{q}
       \\
       (I - P) \mathbf{q} & = & \mathbf{0} \\
       & = & \left( \begin{bmatrix}
           1 & 0 \\
           0 & 1
       \end{bmatrix}
       - \begin{bmatrix}
           0.9 & 0.5 \\
           0.1 & 0.5
       \end{bmatrix} \right) \mathbf{q}
       \\
       & = & \begin{bmatrix}
           0.1 & -0.5 \\
           -0.1 & 0.5
       \end{bmatrix} \mathbf{q}
   \end{matrix}

<math>

<math>
   \begin{bmatrix}
       0.1 & -0.5 \\
       -0.1 & 0.5
   \end{bmatrix}
   \begin{bmatrix}
       q_1 \\
       q_2
   \end{bmatrix} = \begin{bmatrix}
       0 \\
       0
   \end{bmatrix}

<math>

<math>
   \begin{bmatrix}
       0.1 & -0.5 \\
       -0.1 & 0.5
   \end{bmatrix}
   \approx \begin{bmatrix}
       1 & -5 \\
       -1 & 5
   \end{bmatrix}

<math>

So

<math>
   q_1 - 5 q_2 = 0

<math>

Set s = q2, so 5 s = q1. We want s + 5 s = 1: therefore s = 0.167. Our steady state vector is:

<math>
   \begin{bmatrix}
       q_1 \\
       q_2
   \end{bmatrix}
   = \begin{bmatrix}
       5 s \\
       s
   \end{bmatrix}
   = \begin{bmatrix}
       0.833 \\
       0.167
   \end{bmatrix}

<math>

In conclusion, in the long term, 83% of days are sunny.

Citation ranking

For the most prolific example of the use of Markov chains, see Google (http://www.google.com). A description behind the page rank algorithm, which is basically a Markov chain over the graph of the Internet, can be found in the seminal paper, "The Page Rank Citation Ranking: Bringing Order to the Web" (http://citeseer.ist.psu.edu/page98pagerank.html) by Larry Page, Sergey Brin, R. Motwani, and T. Winograd.

External links

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools