Skip to content
← All questions

What is a simple way to check if a transition matrix has been constructed correctly?

A simple sanity check is to verify that the sum of the probabilities in each row of the transition matrix equals 1.

Conditions

  • The matrix is intended to be a transition matrix for a Markov chain.

Reasoning, step by step

  1. Take the first row of the matrix and sum its entries.
  2. Check if the sum equals 1.
  3. Repeat this process for every row in the matrix.
  4. If all rows sum to 1, the matrix passes this basic validity check.

Example

For the matrix P=[0.30.70.40.6]P = \begin{bmatrix} 0.3 & 0.7 \\ 0.4 & 0.6 \end{bmatrix}, the speaker checks 0.3+0.7=10.3 + 0.7 = 1 and 0.4+0.6=10.4 + 0.6 = 1. He states, "And just a quick sanity check to make sure that your transition matrix is correct is to check that the rows sum to one."

Common misconceptions

  • Checking that the columns sum to 1 instead of the rows.
  • Assuming that if the rows sum to 1, the matrix is definitely correct; it also needs to have non-negative entries.

Watch the explanation

Explore next

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.