Advanced Mathematics

Markov Chains

A random process hopping between states, where the next step depends only on the current state and not on how it got there.

Needs a step first: 11

A Markov chain is described by a transition matrix PP, where PijP_{ij} is the chance of moving from state ii to state jj, so each row sums to 11. The distribution after nn steps is the starting distribution times PnP^n. Under mild conditions the chain forgets where it started and settles into a stationary distribution π\pi with πP=π\pi P=\pi, an eigenvector with eigenvalue 11; the next-largest eigenvalue says how quickly it settles.

Where it shows up: Reinforcement learning is built on Markov decision processes, and text generation can be seen as a Markov chain whose state is everything written so far.

How to hold it: In your head

See a Markov chain as a matrix applied again and again, its long-run state as the eigenvector with eigenvalue 11, and the next-largest eigenvalue as how fast it forgets where it started.

What knowing it looks like

  • Write the transition matrix of a described process and compute probabilities two or three steps ahead.
  • Find the stationary distribution by solving πP=π\pi P=\pi with ∑iπi=1\sum_i\pi_i=1.
  • Say from its eigenvalues whether a chain will settle down, and roughly how fast.

Test yourself

If today is sunny, tomorrow is sunny with probability 0.90.9; if today is rainy, tomorrow is sunny with probability 0.50.5. Today is sunny. Find the probability that it rains the day after tomorrow, and the long-run fraction of rainy days.
Show the worked answer
With states (sunny, rainy), P=(0.90.10.50.5)P=\begin{pmatrix}0.9&0.1\\0.5&0.5\end{pmatrix}. Rain the day after tomorrow: 0.9×0.1+0.1×0.5=0.140.9\times0.1+0.1\times0.5=0.14. In the long run the flow out of sunny equals the flow in: 0.1 πS=0.5 πR0.1\,\pi_S=0.5\,\pi_R, so πS=5πR\pi_S=5\pi_R and π=(56,16)\pi=(\tfrac56,\tfrac16): one day in six is rainy. The other eigenvalue is 0.9+0.5−1=0.40.9+0.5-1=0.4, so the influence of today's weather fades like 0.4n0.4^n.

Needs a step first: 11

Learn it with an AI

Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.

Be my maths tutor. I'm learning "Markov Chains" (Undergraduate II tier): A random process hopping between states, where the next step depends only on the current state and not on how it got there.
I already know: Random Variables, Expectation and Variance, Eigenvalues and Eigenvectors.
Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away.
Finish by testing me with this: If today is sunny, tomorrow is sunny with probability $0.9$; if today is rainy, tomorrow is sunny with probability $0.5$. Today is sunny. Find the probability that it rains the day after tomorrow, and the long-run fraction of rainy days.
Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.

On the way to

Recommended