A Digression: Markov Chains

Markov chains are simple, easy-to-learn mathematical models.  It is used to predict non-evolving systems over time and is commonly used in the business world.

 

As useful as it seems, Markov chains cannot be learned without a basic knowledge of math matrices.  Thus, this article and the next one will be broken down into two parts, the first explaining math matrices and the second explaining their application to Markov chains. If you are already familiar with mathematical matrices, click here to learn about Markov chains!

 

We already learned game matrices.  Now let’s learn about math matrices!

 

Like a game matrix, a math matrix is simply an array of numbers organized by rows and columns.  It is usually encompassed by parenthesis or brackets.  An example of a matrix is shown below.

 

A =  image002 

 

All matrices are represented by a capital letter, which in this case would be the letter A.  If we were to refer to a specific entry in the ith row and jth column, we would represent it as Ai, j.  As an example, A­2,1 = 2 and A1,2 = 1.

 

Addition

 

A =  image002  B = image004   C =   image006

 

 

Above, we have three matrices labeled A, B and CA and B are 3 by 2 matrices while C is a 2 by 4 matrix.  When adding matrices, there is only one rule that must be followed.  Since matrices come in all sizes, you may only add matrices with the same number of rows and column.  In the above case, we may only add matrices A and B, but not A and C or B and C because they are of different sizes.

 

The matrix sum of A + B is calculated by adding corresponding entries.  The formula is (A + B)i,j = Ai,j + Bi,j.  Adding values of the ith row and jth column will give us a value in the ith row and jth column of the resulting matrix.

Our new matrix (A + B) is as follows:

(A + B) = image008  = image010

 

Easy right?

 

Scalar Multiplication

There are two forms of matrix multiplication.  The first is a scalar multiplication, which is the product of a constant and a matrix. The formula for a scalar multiplication of a constant c is (cA)i,j = c · Ai,j.  Simply, each entry is multiplied by the constant.  For example, if we were to multiply matrix A with a constant of 7, we would get:

 

7A =  image012  =   image014

 

 

Matrix Multiplication

Our second form of matrix multiplication is that between two matrices.  Here is where it gets tricky.  Not all matrices can be multiplied.  A matrix product is defined only when the number of columns of the first matrix is equal to the number of rows of the second matrix.  In other words, the number of values in each row of the first matrix must equal the number of values in each column of the second matrix.

A 3 by 2 matrix can be multiplied with an 18 by 3 matrix.  A 3 by 2 matrix cannot be multiplied with a 3 by 18 matrix or even another 3 by 2 matrix.  In general, a p by q matrix can only be multiplied with a q by r matrix, which yields a resulting p by r matrix.

 

In our above example, we see that AB is not defined because matrix A has two columns while matrix B has three rows.  AC and BC are defined because matrix C has two rows.  Note that CA and CB are not defined because matrix C has four columns and matrix A and B have three rows.

 

Now that we know the limitations regarding matrix multiplication, we ask ourselves the question: how do we multiply the matrices?

 

We perform an operation called a dot product, which is multiplying the ROWS of the first matrix with the COLUMNS of the second matrix.  We do this by summing the product of each value of a row from the first matrix and the corresponding value in the column of the second matrix.  The resulting number becomes a value on our resulting matrix.  The formula expressed more formally for the matrix AB, a product of a p by q matrix A and a q by r matrix B, is ABi,j = (Ai,1 x Bj,1) + (Ai,2 x Bj,2) + … + (Ai,q x Bj,q).  This may be easier to illustrate with an example.

 

A =  image002  C =  image006   AC =   image016

 

Let us begin with the product AC.  Since A is a 3 by 2 matrix and C a 2 by 4, resulting AC should be a 3 by 4 matrix.  To get the first row, first column entry of AC (AC1,1) we sum corresponding values of the first row of A and the first column of C.  The values are highlighted below:

 

A =  image018  C =   image020

 

Doing so would result in (1 x 3) + (1 x 5) = 15.  Thus, AC1,1 = 15.  We would use the same method for subsequent entries. 

 

A =  image022  C =   image024

 

For the second row, third column entry of AC (AC2,3), we would get (2 x 4) + (3 x 2) = 14. 

 

 

Ultimately, if we were to repeat this process for each value, we would get this resulting matrix:

 

AC =   image026

AC =   image028

 

Here is another example.  Suppose you have two matrices:

 

A = image030    B =  image032

 

Try multiplying them!  You should ultimately get:

 

AB =  image034

 

AB =    image036

 

Notice if you reverse the order of multiplication and take the product BA, you get a completely different answer!

 

BAimage038

 

BA =    image040

 

This shows us that matrix multiplication is non-commutative (the product AB is not the same as BA).  Order matters when we are multiplying matrices.

 

Another thing to note is that most graphing scientific calculators are capable of quickly calculating a matrix multiplication.  On the standard TI-84, pressing 2nd and x-1 will lead you to the matrix menu, in which you can edit matrices and assign them to a letter.  In addition, if the above multiplication is too hard to grasp or tedious to work by hand, there are many good apps online (such as this one) that can perform the multiplication.

 

To be continued…

 

A Putnam fellow, Benji Fisher once described math matrices as the best book-keeping device in the history of man.  This is just an introduction to mathematics matrices, an important part of mathematics.  Math matrices are extensively used in applied mathematics and are especially useful for solving linear equations and representing vector spaces.  It is no wonder that matrix theory (yes the study of math matrices!) holds a significant role in linear algebra as well.

 

Stay tuned…  

 

<< Previous Article: A Mathematical Approach to Success <<