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 , where is the chance of moving from state to state , so each row sums to . The distribution after steps is the starting distribution times . Under mild conditions the chain forgets where it started and settles into a stationary distribution with , an eigenvector with eigenvalue ; 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 , 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 with .
- 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 ; if today is rainy, tomorrow is sunny with probability . 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
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.
Needs first
- Random Variables, Expectation and VarianceA number decided by chance, summed up by its expectation (the long-run average) and its variance (how far it typically strays).Core · Probability & Statistics
- Eigenvalues and EigenvectorsThe directions a matrix only stretches and never turns, and the factor by which it stretches each one.Undergraduate I · Linear Algebra
Leads to
- Softmax and Language ModelsSoftmax turns a list of scores into probabilities; a language model uses it to predict the next token, trained by cross-entropy.Frontier · Machine Learning
- Reinforcement LearningLearning what to do from rewards alone: an agent acts, sees rewards, and improves its policy to maximise discounted future reward.Frontier · Machine Learning
On the way to
Recommended
- MIT 6.1200J Mathematics for Computer ScienceMIT OpenCourseWare · CourseMIT's 2024 course on proofs, number theory, graphs, counting and discrete probability, with lecture videos, notes and problem sets.
- Mathematics for Machine LearningDeisenroth, Faisal and Ong (Cambridge University Press) · BookA free book that gathers exactly the linear algebra, vector calculus, probability and optimisation machine learning uses, then applies them to regression, PCA and classification.
- Seeing TheoryBrown University · InteractiveA visual introduction to probability and statistics in which you flip coins, draw samples and fit lines in the browser; complete and ad-free, with a Chinese version.
- Harvard Stat 110: ProbabilityJoe Blitzstein, Harvard University · CourseJoe Blitzstein's Harvard probability course: lecture videos, about 250 practice problems with solutions and a free online textbook, strong on intuition and story proofs.
- Information Theory, Inference, and Learning AlgorithmsDavid MacKay · BookMacKay's book connecting entropy, coding, Bayesian inference and neural networks, free to read online and still the one recommended for information theory with intuition.
- 宋浩老师官方宋浩(山东财经大学) · Videos · 中文Full university courses in calculus, linear algebra and probability by a Shandong University of Finance and Economics lecturer, clear and good-humoured; a new calculus series came out in October 2026.