[<< wikibooks] High School Mathematics Extensions/Matrices/Full
== Introduction ==
"Matrix" may be more popularly known as a giant computer simulation, but in mathematics it is a totally different thing. To be more precise, a matrix (plural matrices) is a rectangular array of numbers. For example, below is a typical way to write a matrix, with numbers arranged in rows and columns and with round brackets around the numbers:

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  5
                
                
                  10
                
                
                  20
                
              
              
                
                  1
                
                
                  −
                  3
                
                
                  −
                  5
                
                
                  9
                
              
              
                
                  3
                
                
                  −
                  1
                
                
                  −
                  1
                
                
                  −
                  1
                
              
              
                
                  3
                
                
                  2
                
                
                  4
                
                
                  −
                  5
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&5&10&20\\1&-3&-5&9\\3&-1&-1&-1\\3&2&4&-5\end{pmatrix}}}
  The above matrix has 4 rows and 4 columns, so we call it a 4 × 4 (4 by 4) matrix. Also, we can have matrices of many different shapes. The shape of a matrix is the name for the dimensions of the matrix (m by n, where m is the number of rows and n the number of columns). Here are some more examples of matrices:
This is an example of a 3 × 3 matrix:

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  2
                
                
                  3
                
              
              
                
                  4
                
                
                  5
                
                
                  6
                
              
              
                
                  7
                
                
                  8
                
                
                  9
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&2&3\\4&5&6\\7&8&9\\\end{pmatrix}}}
  This is an example of a 5 × 4 matrix:

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  b
                
                
                  c
                
                
                  d
                
              
              
                
                  h
                
                
                  g
                
                
                  f
                
                
                  e
                
              
              
                
                  i
                
                
                  j
                
                
                  k
                
                
                  l
                
              
              
                
                  p
                
                
                  o
                
                
                  n
                
                
                  m
                
              
              
                
                  q
                
                
                  r
                
                
                  s
                
                
                  t
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&b&c&d\\h&g&f&e\\i&j&k&l\\p&o&n&m\\q&r&s&t\\\end{pmatrix}}}
  This is an example of a 1 × 6 matrix:

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  2
                
                
                  3
                
                
                  4
                
                
                  5
                
                
                  6
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&2&3&4&5&6\\\end{pmatrix}}}
  The theory of matrices is intimately connected with that of (linear) simultaneous equations. The ancient Chinese had established a systematic way to solve simultaneous equations. The theory of simultaneous equations was furthered in the east by the Japanese mathematician, Seki and a little later by Leibniz, Newton's greatest rival. Later, Gauss (1777 - 1855), one of the three giants of modern mathematics, popularised the use of Gaussian elimination, which is a simple step by step algorithm for solving any number of linear simultaneous equations. By then the use of matrices to represent simultaneous equation neatly on paper (as discussed above) had become quite common1.
Consider the simultaneous equations:

  
    
      
        x
        +
        y
        =
        10
      
    
    {\displaystyle x+y=10}
  

  
    
      
        x
        −
        y
        =
        4
      
    
    {\displaystyle x-y=4}
  it has the solution x = 7 and y = 3, and the usual way to solve it is to add the two equations together to eliminate the y. Matrix theory offers us another way to solve the above simultaneous equations via matrix multiplication (covered below). We will study the widely accepted way to multiply two matrices together. In theory with matrix multiplication we can solve any number of simultaneous equations, but we shall mainly restrict our attention to 2 × 2 matrices. But even with that restriction, we have opened up doors to topics simultaneous equations could never offer us. Two such examples are

using matrices to solve linear recurrence relations which can be used to model population growth, and
encrypting messages with matrices.We shall commence our study by learning some of the more fundamental concepts of matrices. Once we have a firm grasp of the basics, we shall move on to study the real meat of this chapter, matrix multiplication.


=== Elements ===
An element of a matrix is a particular number inside the matrix, and it is uniquely located with a pair of numbers. E.g. let the following matrix be denoted by A, or symbolically:

  
    
      
        A
        =
        
          
            (
            
              
                
                  1
                
                
                  2
                
                
                  3
                
              
              
                
                  4
                
                
                  5
                
                
                  6
                
              
              
                
                  7
                
                
                  8
                
                
                  9
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}1&2&3\\4&5&6\\7&8&9\\\end{pmatrix}}}
  the (2,2)th entry of A is 5; the (1,1)th entry of A is 1, the (3,3) entry of A is 9 and the (3,2)th entry of A is 8. The (i , j)th entry of A is usually denoted ai,j and the (i , j)th entry of a matrix B is usually denoted by bi,j and so on.


=== Summary ===
A matrix is an array of numbers
A m×n matrix has m rows and n columns
The shape of a matrix is determined by its number of rows and columns
The (i,j)th element of a matrix is located in ith row and jth column


=== Matrix addition & Multiplication by a scalar ===
Matrices can be added together. But only the matrices of the same shape can be added. This is very natural. E.g.

  
    
      
        A
        =
        
          
            (
            
              
                
                  1
                
                
                  x
                
                
                  2
                  x
                
              
              
                
                  1
                
                
                  3
                  x
                
                
                  5
                  x
                
              
              
                
                  1
                
                
                  3
                
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}1&x&2x\\1&3x&5x\\1&3&4\\\end{pmatrix}}}
  

  
    
      
        B
        =
        
          
            (
            
              
                
                  2
                
                
                  9
                
                
                  8
                
              
              
                
                  0
                
                
                  −
                  1
                
                
                  8
                
              
              
                
                  4
                
                
                  6
                
                
                  7
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}2&9&8\\0&-1&8\\4&6&7\\\end{pmatrix}}}
  then

  
    
      
        A
        +
        B
        =
        
          
            (
            
              
                
                  1
                
                
                  2
                
                
                  3
                
              
              
                
                  4
                
                
                  5
                
                
                  6
                
              
              
                
                  7
                
                
                  8
                
                
                  9
                
              
            
            )
          
        
        +
        
          
            (
            
              
                
                  2
                
                
                  9
                
                
                  8
                
              
              
                
                  0
                
                
                  −
                  1
                
                
                  8
                
              
              
                
                  4
                
                
                  6
                
                
                  7
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  1
                  +
                  2
                
                
                  2
                  +
                  9
                
                
                  3
                  +
                  8
                
              
              
                
                  4
                  +
                  0
                
                
                  5
                  +
                  (
                  −
                  1
                  )
                
                
                  6
                  +
                  8
                
              
              
                
                  7
                  +
                  4
                
                
                  8
                  +
                  6
                
                
                  9
                  +
                  7
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  3
                
                
                  11
                
                
                  11
                
              
              
                
                  4
                
                
                  4
                
                
                  14
                
              
              
                
                  11
                
                
                  14
                
                
                  16
                
              
            
            )
          
        
      
    
    {\displaystyle A+B={\begin{pmatrix}1&2&3\\4&5&6\\7&8&9\\\end{pmatrix}}+{\begin{pmatrix}2&9&8\\0&-1&8\\4&6&7\\\end{pmatrix}}={\begin{pmatrix}1+2&2+9&3+8\\4+0&5+(-1)&6+8\\7+4&8+6&9+7\\\end{pmatrix}}={\begin{pmatrix}3&11&11\\4&4&14\\11&14&16\\\end{pmatrix}}}
  Similarly matrices can be multiplied by a number. We call the number a scalar to distinguish it from a matrix. The reader need not worry about the definition here, just remember that a scalar is simply a number.

  
    
      
        5
        A
        =
        A
        +
        A
        +
        A
        +
        A
        +
        A
        =
        5
        
          
            (
            
              
                
                  1
                
                
                  2
                
                
                  3
                
              
              
                
                  4
                
                
                  5
                
                
                  6
                
              
              
                
                  7
                
                
                  8
                
                
                  9
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  5
                
                
                  10
                
                
                  15
                
              
              
                
                  20
                
                
                  25
                
                
                  30
                
              
              
                
                  35
                
                
                  40
                
                
                  45
                
              
            
            )
          
        
      
    
    {\displaystyle 5A=A+A+A+A+A=5{\begin{pmatrix}1&2&3\\4&5&6\\7&8&9\\\end{pmatrix}}={\begin{pmatrix}5&10&15\\20&25&30\\35&40&45\\\end{pmatrix}}}
  in this case the scalar value is 5. In general, when we do s × A , where s is a scalar and A a matrix, we multiply each entry of A by s.


== Matrix Multiplication ==
The widely accepted way to multiply two matrices together is definitely non-intuitive. As mentioned above, multiplication can help with solving simultaneous equations. We will now give a brief outline of how this can be done. Firstly, any system of linear simultaneous equations can be written as a matrix of coefficients multiplied by a matrix of unknowns equaling a matrix of results. This description may sound a little complicated, but in symbolic form it is quite clear. The previous statement simply says that if A, x and b are matrices, then Ax = b, can be used to represent some system of simultaneous equations. The beautiful thing about matrix multiplications is that some matrices can have multiplicative inverses, that is we can multiply both sides of the equation by A-1 to get x = A-1b, which effectively solves the simultaneous equations.
The reader will surely come to understand matrix multiplication better as this chapter progresses. For now we should consider the simplest case of matrix multiplication, multiplying vectors. We will see a few examples and then we will explain process of multiplication

  
    
      
        
          
            
              
                
                  A
                  
                    2
                    ×
                    1
                  
                
                =
                
                  
                    (
                    
                      
                        
                          2
                        
                      
                      
                        
                          9
                        
                      
                    
                    )
                  
                
              
              
                ,
              
              
                
                  B
                  
                    1
                    ×
                    2
                  
                
                =
                
                  
                    (
                    
                      
                        
                          3
                        
                        
                          5
                        
                      
                    
                    )
                  
                
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}A_{2\times 1}={\begin{pmatrix}2\\9\\\end{pmatrix}}&,&B_{1\times 2}={\begin{pmatrix}3&5\end{pmatrix}}\end{matrix}}}
  then

  
    
      
        
          B
          
            1
            ×
            2
          
        
        ×
        
          A
          
            2
            ×
            1
          
        
        =
        
          
            (
            
              
                
                  3
                
                
                  5
                
              
            
            )
          
        
        ×
        
          
            (
            
              
                
                  2
                
              
              
                
                  9
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  (
                  3
                  ×
                  2
                  )
                  +
                  (
                  5
                  ×
                  9
                  )
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  51
                
              
            
            )
          
        
      
    
    {\displaystyle B_{1\times 2}\times A_{2\times 1}={\begin{pmatrix}3&5\end{pmatrix}}\times {\begin{pmatrix}2\\9\\\end{pmatrix}}={\begin{pmatrix}(3\times 2)+(5\times 9)\end{pmatrix}}={\begin{pmatrix}51\end{pmatrix}}}
  Similarly if:

  
    
      
        
          
            
              
                
                  A
                  
                    3
                    ×
                    1
                  
                
                =
                
                  
                    (
                    
                      
                        
                          1
                        
                      
                      
                        
                          2
                        
                      
                      
                        
                          3
                        
                      
                    
                    )
                  
                
              
              
                ,
              
              
                
                  B
                  
                    1
                    ×
                    3
                  
                
                =
                
                  
                    (
                    
                      
                        
                          4
                        
                        
                          5
                        
                        
                          6
                        
                      
                    
                    )
                  
                
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}A_{3\times 1}={\begin{pmatrix}1\\2\\3\end{pmatrix}}&,&B_{1\times 3}={\begin{pmatrix}4&5&6\end{pmatrix}}\end{matrix}}}
  then

  
    
      
        
          B
          
            1
            ×
            3
          
        
        ×
        
          A
          
            3
            ×
            1
          
        
        =
        
          
            (
            
              
                
                  4
                
                
                  5
                
                
                  6
                
              
            
            )
          
        
        ×
        
          
            (
            
              
                
                  1
                
              
              
                
                  2
                
              
              
                
                  3
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  (
                  4
                  ×
                  1
                  )
                  +
                  (
                  5
                  ×
                  2
                  )
                  +
                  (
                  6
                  ×
                  3
                  )
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  32
                
              
            
            )
          
        
      
    
    {\displaystyle B_{1\times 3}\times A_{3\times 1}={\begin{pmatrix}4&5&6\end{pmatrix}}\times {\begin{pmatrix}1\\2\\3\\\end{pmatrix}}={\begin{pmatrix}(4\times 1)+(5\times 2)+(6\times 3)\end{pmatrix}}={\begin{pmatrix}32\end{pmatrix}}}
  A matrix with just one row is called a row vector, similarly a matrix with just one column is called a column vector. When we multiply a row vector A, with a column vector B, we multiply the element in the first column of A by the element in the first row of B and add to that the product of the second column of A and second row of B and so on. More generally we multiply a1,i by bi,1 (where i ranges from 1 to n, the number of rows/columns) and sum up all of the products. Symbolically:

  
    
      
        
          A
          
            1
            ×
            n
          
        
        ×
        
          B
          
            n
            ×
            1
          
        
        =
        (
        
          ∑
          
            i
            =
            1
          
          
            n
          
        
        
          a
          
            1
            ,
            i
          
        
        ×
        
          b
          
            i
            ,
            1
          
        
        )
      
    
    {\displaystyle A_{1\times n}\times B_{n\times 1}=(\sum _{i=1}^{n}a_{1,i}\times b_{i,1})}
   (for information on the 
  
    
      
        ∑
      
    
    {\displaystyle \sum }
   sign, see  Summation_Sign)
where n is the number of rows/columns.In words: the product of a column vector and a row vector is the sum of the product of item 1,i from the row vector and i,1 from the column vector where i is from 1 to the width/height of these vectors.Note: The product of matrices is also a matrix. The product of a row vector and column vector is a 1 by 1 matrix, not a scalar.


=== Exercises ===
Multiply:

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
              
              
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&2\end{pmatrix}}{\begin{pmatrix}1\\2\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  1
                
              
              
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1\\2\end{pmatrix}}{\begin{pmatrix}1&2\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  
                    
                      1
                      8
                    
                  
                
                
                  9
                
              
            
            )
          
        
        
          
            (
            
              
                
                  16
                
              
              
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}{\frac {1}{8}}&9\end{pmatrix}}{\begin{pmatrix}16\\2\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  d
                
              
              
                
                  e
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&b\end{pmatrix}}{\begin{pmatrix}d\\e\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  6
                  +
                  6
                  b
                
                
                  3
                  −
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  0
                
              
              
                
                  0
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}6+6b&3-b\end{pmatrix}}{\begin{pmatrix}0\\0\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  0
                
                
                  a
                  b
                  c
                
              
            
            )
          
        
        
          
            (
            
              
                
                  a
                
              
              
                
                  0
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}0&abc\end{pmatrix}}{\begin{pmatrix}a\\0\end{pmatrix}}}
  


=== Multiplication of non-vector matrices ===
Suppose 
  
    
      
        
          A
          
            m
            ×
            n
          
        
        
          B
          
            n
            ×
            p
          
        
        =
        
          C
          
            m
            ×
            p
          
        
      
    
    {\displaystyle A_{m\times n}B_{n\times p}=C_{m\times p}}
   where A, B and C are matrices.
We multiply the ith row of A with the jth column of B as if they are vector-matrices. The resulting number is the (i,j)th element of C. Symbolically:

  
    
      
        
          c
          
            i
            ,
            j
          
        
        =
        
          ∑
          
            k
            =
            1
          
          
            n
          
        
        
          a
          
            i
            ,
            k
          
        
        ×
        
          b
          
            k
            ,
            j
          
        
      
    
    {\displaystyle c_{i,j}=\sum _{k=1}^{n}a_{i,k}\times b_{k,j}}
   Example 1 
Evaluate AB = C and BA= D, where

  
    
      
        A
        =
        
          
            (
            
              
                
                  3
                
                
                  2
                
              
              
                
                  5
                
                
                  6
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}3&2\\5&6\\\end{pmatrix}}}
  and

  
    
      
        B
        =
        
          
            (
            
              
                
                  2
                
                
                  6
                
              
              
                
                  8
                
                
                  7
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}2&6\\8&7\\\end{pmatrix}}}
   Solution 

  
    
      
        
          c
          
            1
            ,
            1
          
        
        =
        
          
            (
            
              
                
                  3
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
              
              
                
                  8
                
              
            
            )
          
        
        =
        (
        3
        ×
        2
        +
        2
        ×
        8
        )
        =
        22
      
    
    {\displaystyle c_{1,1}={\begin{pmatrix}3&2\end{pmatrix}}{\begin{pmatrix}2\\8\end{pmatrix}}=(3\times 2+2\times 8)=22}
  

  
    
      
        
          c
          
            1
            ,
            2
          
        
        =
        
          
            (
            
              
                
                  3
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  6
                
              
              
                
                  7
                
              
            
            )
          
        
        =
        (
        3
        ×
        6
        +
        2
        ×
        7
        )
        =
        32
      
    
    {\displaystyle c_{1,2}={\begin{pmatrix}3&2\end{pmatrix}}{\begin{pmatrix}6\\7\end{pmatrix}}=(3\times 6+2\times 7)=32}
  

  
    
      
        
          c
          
            2
            ,
            1
          
        
        =
        
          
            (
            
              
                
                  5
                
                
                  6
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
              
              
                
                  8
                
              
            
            )
          
        
        =
        (
        5
        ×
        2
        +
        6
        ×
        8
        )
        =
        58
      
    
    {\displaystyle c_{2,1}={\begin{pmatrix}5&6\end{pmatrix}}{\begin{pmatrix}2\\8\end{pmatrix}}=(5\times 2+6\times 8)=58}
  

  
    
      
        
          c
          
            2
            ,
            2
          
        
        =
        
          
            (
            
              
                
                  5
                
                
                  6
                
              
            
            )
          
        
        
          
            (
            
              
                
                  6
                
              
              
                
                  7
                
              
            
            )
          
        
        =
        (
        5
        ×
        6
        +
        6
        ×
        7
        )
        =
        72
      
    
    {\displaystyle c_{2,2}={\begin{pmatrix}5&6\end{pmatrix}}{\begin{pmatrix}6\\7\end{pmatrix}}=(5\times 6+6\times 7)=72}
  i.e.

  
    
      
        C
        =
        
          
            (
            
              
                
                  22
                
                
                  32
                
              
              
                
                  58
                
                
                  72
                
              
            
            )
          
        
      
    
    {\displaystyle C={\begin{pmatrix}22&32\\58&72\end{pmatrix}}}
  

  
    
      
        
          d
          
            1
            ,
            1
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  6
                
              
            
            )
          
        
        
          
            (
            
              
                
                  3
                
              
              
                
                  5
                
              
            
            )
          
        
        =
        (
        2
        ×
        3
        +
        6
        ×
        5
        )
        =
        36
      
    
    {\displaystyle d_{1,1}={\begin{pmatrix}2&6\end{pmatrix}}{\begin{pmatrix}3\\5\end{pmatrix}}=(2\times 3+6\times 5)=36}
  

  
    
      
        
          d
          
            1
            ,
            2
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  6
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
              
              
                
                  6
                
              
            
            )
          
        
        =
        (
        2
        ×
        2
        +
        6
        ×
        6
        )
        =
        40
      
    
    {\displaystyle d_{1,2}={\begin{pmatrix}2&6\end{pmatrix}}{\begin{pmatrix}2\\6\end{pmatrix}}=(2\times 2+6\times 6)=40}
  

  
    
      
        
          d
          
            2
            ,
            1
          
        
        =
        
          
            (
            
              
                
                  8
                
                
                  7
                
              
            
            )
          
        
        
          
            (
            
              
                
                  3
                
              
              
                
                  5
                
              
            
            )
          
        
        =
        (
        8
        ×
        3
        +
        7
        ×
        5
        )
        =
        59
      
    
    {\displaystyle d_{2,1}={\begin{pmatrix}8&7\end{pmatrix}}{\begin{pmatrix}3\\5\end{pmatrix}}=(8\times 3+7\times 5)=59}
  

  
    
      
        
          d
          
            2
            ,
            2
          
        
        =
        
          
            (
            
              
                
                  8
                
                
                  7
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
              
              
                
                  6
                
              
            
            )
          
        
        =
        (
        8
        ×
        2
        +
        7
        ×
        6
        )
        =
        58
      
    
    {\displaystyle d_{2,2}={\begin{pmatrix}8&7\end{pmatrix}}{\begin{pmatrix}2\\6\end{pmatrix}}=(8\times 2+7\times 6)=58}
  i.e.

  
    
      
        D
        =
        
          
            (
            
              
                
                  36
                
                
                  40
                
              
              
                
                  59
                
                
                  58
                
              
            
            )
          
        
      
    
    {\displaystyle D={\begin{pmatrix}36&40\\59&58\end{pmatrix}}}
  Example 2 
Evaluate AB and BA where 

  
    
      
        A
        =
        
          
            (
            
              
                
                  5
                
                
                  17
                
              
              
                
                  2
                
                
                  7
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}5&17\\2&7\end{pmatrix}}}
  

  
    
      
        B
        =
        
          
            (
            
              
                
                  7
                
                
                  −
                  17
                
              
              
                
                  −
                  2
                
                
                  5
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}7&-17\\-2&5\end{pmatrix}}}
   Solution 

  
    
      
        
          
            (
            
              
                
                  5
                
                
                  17
                
              
              
                
                  2
                
                
                  7
                
              
            
            )
          
        
        
          
            (
            
              
                
                  7
                
                
                  −
                  17
                
              
              
                
                  −
                  2
                
                
                  5
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}5&17\\2&7\end{pmatrix}}{\begin{pmatrix}7&-17\\-2&5\end{pmatrix}}={\begin{pmatrix}1&0\\0&1\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  7
                
                
                  −
                  17
                
              
              
                
                  −
                  2
                
                
                  5
                
              
            
            )
          
        
        
          
            (
            
              
                
                  5
                
                
                  17
                
              
              
                
                  2
                
                
                  7
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}7&-17\\-2&5\end{pmatrix}}{\begin{pmatrix}5&17\\2&7\end{pmatrix}}={\begin{pmatrix}1&0\\0&1\end{pmatrix}}}
  Example 3 
Evaluate AB and BA where

  
    
      
        A
        =
        
          
            (
            
              
                
                  2
                
                
                  6
                
              
              
                
                  0
                
                
                  5
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}2&6\\0&5\end{pmatrix}}}
  

  
    
      
        B
        =
        
          
            (
            
              
                
                  5
                
                
                  −
                  6
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}5&-6\\0&2\end{pmatrix}}}
   Solution 

  
    
      
        
          
            (
            
              
                
                  2
                
                
                  6
                
              
              
                
                  0
                
                
                  5
                
              
            
            )
          
        
        
          
            (
            
              
                
                  5
                
                
                  −
                  6
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  10
                
                
                  0
                
              
              
                
                  0
                
                
                  10
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}2&6\\0&5\end{pmatrix}}{\begin{pmatrix}5&-6\\0&2\end{pmatrix}}={\begin{pmatrix}10&0\\0&10\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  5
                
                
                  −
                  6
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  6
                
              
              
                
                  0
                
                
                  5
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  10
                
                
                  0
                
              
              
                
                  0
                
                
                  10
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}5&-6\\0&2\end{pmatrix}}{\begin{pmatrix}2&6\\0&5\end{pmatrix}}={\begin{pmatrix}10&0\\0&10\end{pmatrix}}}
  Example 4 
Evaluate the following multiplication:

  
    
      
        
          
            (
            
              
                
                  a
                
              
              
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a\\b\end{pmatrix}}{\begin{pmatrix}c&d\\\end{pmatrix}}}
   Solution 
Note that:

  
    
      
        
          
            (
            
              
                
                  a
                
              
              
                
                  b
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a\\b\end{pmatrix}}}
  is a 2 by 1 matrix and 

  
    
      
        
          
            (
            
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}c&d\\\end{pmatrix}}}
  is a 1 by 2 matrix. So the multiplication makes sense and the product should be a 2 by 2 matrix. 

  
    
      
        
          
            (
            
              
                
                  a
                
              
              
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  a
                  c
                
                
                  a
                  d
                
              
              
                
                  b
                  c
                
                
                  b
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a\\b\end{pmatrix}}{\begin{pmatrix}c&d\\\end{pmatrix}}={\begin{pmatrix}ac&ad\\bc&bd\\\end{pmatrix}}}
  Example 5 
Evaluate the following multiplication:

  
    
      
        
          
            (
            
              
                
                  1
                
              
              
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  3
                
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1\\2\end{pmatrix}}{\begin{pmatrix}3&4\\\end{pmatrix}}}
   Solution 

  
    
      
        
          
            (
            
              
                
                  1
                
              
              
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  3
                
                
                  4
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  1
                  ×
                  3
                
                
                  1
                  ×
                  4
                
              
              
                
                  2
                  ×
                  3
                
                
                  2
                  ×
                  4
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  3
                
                
                  4
                
              
              
                
                  6
                
                
                  8
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1\\2\end{pmatrix}}{\begin{pmatrix}3&4\\\end{pmatrix}}={\begin{pmatrix}1\times 3&1\times 4\\2\times 3&2\times 4\\\end{pmatrix}}={\begin{pmatrix}3&4\\6&8\\\end{pmatrix}}}
  Example 6 
Evaluate the following multiplication:

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  c
                
                
                  0
                
              
              
                
                  0
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&0\\0&b\end{pmatrix}}{\begin{pmatrix}c&0\\0&d\end{pmatrix}}}
   Solution 

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  c
                
                
                  0
                
              
              
                
                  0
                
                
                  d
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  a
                  c
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&0\\0&b\end{pmatrix}}{\begin{pmatrix}c&0\\0&d\end{pmatrix}}={\begin{pmatrix}ac&0\\0&bd\end{pmatrix}}}
  
Example 7 
Evaluate the following multiplication:

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&b\\c&d\end{pmatrix}}{\begin{pmatrix}x\\y\end{pmatrix}}}
   Solution 

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  a
                  x
                  +
                  b
                  y
                
              
              
                
                  c
                  x
                  +
                  d
                  y
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&b\\c&d\end{pmatrix}}{\begin{pmatrix}x\\y\end{pmatrix}}={\begin{pmatrix}ax+by\\cx+dy\end{pmatrix}}}
  
Note Multiplication of matrices is generally not commutative, i.e. generally AB ≠ BA.


==== Diagonal matrices ====
A diagonal matrix is a matrix with zero entries everywhere except possibly down the diagonal. Multiplying diagonal matrices is really convenient, as you need only to multiply the diagonal entries together. 
Examples
The following are all diagonal matrices

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  c
                
                
                  0
                
              
              
                
                  0
                
                
                  d
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  0
                
                
                  0
                
              
              
                
                  0
                
                
                  0
                
              
            
            )
          
        
        
          
            (
            
              
                
                  a
                
                
                  0
                
                
                  0
                
              
              
                
                  0
                
                
                  c
                
                
                  0
                
              
              
                
                  0
                
                
                  0
                
                
                  0
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&0\\0&b\end{pmatrix}}{\begin{pmatrix}c&0\\0&d\end{pmatrix}}{\begin{pmatrix}1&0\\0&2\end{pmatrix}}{\begin{pmatrix}0&0\\0&0\end{pmatrix}}{\begin{pmatrix}a&0&0\\0&c&0\\0&0&0\end{pmatrix}}}
  
 Example 1 

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  e
                
                
                  0
                
              
              
                
                  0
                
                
                  f
                
              
            
            )
          
        
        
          
            (
            
              
                
                  h
                
                
                  0
                
              
              
                
                  0
                
                
                  i
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  a
                  e
                  h
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                  f
                  i
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&0\\0&b\end{pmatrix}}{\begin{pmatrix}e&0\\0&f\end{pmatrix}}{\begin{pmatrix}h&0\\0&i\\\end{pmatrix}}={\begin{pmatrix}aeh&0\\0&bfi\\\end{pmatrix}}}
  
 Example 2 

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        
          
            (
            
              
                
                  a
                
                
                  0
                
              
              
                
                  0
                
                
                  b
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  
                    a
                    
                      3
                    
                  
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    b
                    
                      3
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&0\\0&b\end{pmatrix}}{\begin{pmatrix}a&0\\0&b\end{pmatrix}}{\begin{pmatrix}a&0\\0&b\end{pmatrix}}={\begin{pmatrix}a^{3}&0\\0&b^{3}\end{pmatrix}}}
  
The above examples show that if D is a diagonal matrix then Dk is very easy to compute, all we need to do is to take the diagonal entries to the kth power. This will be an extremely useful fact later on, when we learn how to compute the nth Fibonacci number using matrices.


=== Exercises ===
1. State the dimensions of C

a) C = An×pBp×m
b) 
  
    
      
        C
        =
        
          
            (
            
              
                
                  
                    10
                    
                      10
                    
                  
                
                
                  20
                
              
              
                
                  5000
                
                
                  0
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  2
                
                
                  3
                
                
                  4
                
              
              
                
                  2
                
                
                  5
                
                
                  6
                
                
                  6
                
              
            
            )
          
        
      
    
    {\displaystyle C={\begin{pmatrix}10^{10}&20\\5000&0\end{pmatrix}}{\begin{pmatrix}1&2&3&4\\2&5&6&6\end{pmatrix}}}
  2. Evaluate. Please note that in matrix multiplication (AB)C = A(BC) i.e. the order in which you do the multiplications does not matter (proved later).

a)

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  1
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  1
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  1
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&1\\0&1\\\end{pmatrix}}{\begin{pmatrix}1&1\\0&1\\\end{pmatrix}}{\begin{pmatrix}1&1\\0&1\\\end{pmatrix}}{\begin{pmatrix}1\\1\\\end{pmatrix}}}
  b)

  
    
      
        
          
            (
            
              
                
                  3
                
                
                  1
                
              
              
                
                  2
                
                
                  8
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  1
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  1
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}3&1\\2&8\\\end{pmatrix}}{\begin{pmatrix}1&1\\0&2\\\end{pmatrix}}{\begin{pmatrix}1&1\\0&1\\\end{pmatrix}}{\begin{pmatrix}1\\1\\\end{pmatrix}}}
  3. Performing the following multiplications:

  
    
      
        C
        =
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
              
                
                  4
                
                
                  5
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle C={\begin{pmatrix}1&2\\4&5\end{pmatrix}}{\begin{pmatrix}1&0\\0&1\\\end{pmatrix}}}
  
  
    
      
        D
        =
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
              
                
                  4
                
                
                  5
                
              
            
            )
          
        
      
    
    {\displaystyle D={\begin{pmatrix}1&0\\0&1\end{pmatrix}}{\begin{pmatrix}1&2\\4&5\\\end{pmatrix}}}
  What do you notice?


== The Identity & multiplication laws ==
The exercise above showed us that the matrix:

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&0\\0&1\end{pmatrix}}}
  is a very special. It is called the 2 by 2 identity matrix. An identity matrix is a square matrix, whose diagonal entries are 1's and all other entries are zero. The identity matrix, I, has the following very special properties

  
    
      
        A
        ×
        I
        =
        A
      
    
    {\displaystyle A\times I=A}
  

  
    
      
        I
        ×
        A
        =
        A
      
    
    {\displaystyle I\times A=A}
  for all matrices A. We don't usually specify the shape of the identity because it's obvious from the context, and in this chapter we will only deal with the 2 by 2 identity matrix. In the real number system, the number 1 satisfies: r × 1 = r = 1 × r, so it's clear that the identity matrix is analogous to "1".
Associativity, distributivity and (non)-commutativity
Matrix multiplication is a great deal different to the multiplication we know from multiplying real numbers. So it is comforting to know that many of the laws the real numbers satisfy also carries over to the matrix world. But with one big exception, in general AB ≠ BA.
Let A, B, and C be matrices. Associativity means

(AB)C = A(BC)i.e. the order in which you multiply the matrices is unimportant, because the final result you get is the same regardless of the order which you do the multiplications.
On the other hand, distributivity means

A(B + C) = AB + ACand

(A + B)C = AC + BCNote: The commutative property of the real numbers (i.e. ab = ba), does not carry over to the matrix world.
 Convince yourself 
For all 2 by 2 matrices A, B and C. And I the identity matrix.
1. Convince yourself that in the 2 by 2 case:

A(B + C) = AB + ACand

(A + B)C = AC + BC2. Convince yourself that in the 2 by 2 case:

A(BC) = (AB)C3. Convince yourself that:

  
    
      
        A
        B
        ≠
        B
        A
      
    
    {\displaystyle AB\neq BA}
  in general. When does AB = BA? Name at least one case.
Note that all of the above are true for all matrices (of any dimension/shape).


== Determinant and Inverses ==
We shall consider the simultaneous equations:

ax + by = α (1)
cx + dy = β (2)where a, b, c, d, α and β are constants. We want to determine the necessary conditions for (1) and (2) to have a unique solution for x and y. We proceed:

Let (1') = (1) × c
Let (2') = (2) × ai.e.

acx + bcy = cα (1')
acx + ady = aβ (2')Now

let (3) = (2') - (1')
(ad - bc)y = aβ - cα (3)Now y can be uniquely determined if and only if (ad - bc) ≠ 0. So the necessary condition for (1) and (2) to have a unique solution depends on all four of the coefficients of x and y. We call this number (ad - bc) the determinant, because it tells us whether there is a unique solution to two simultaneous equations of 2 variables.
In summary

if (ad - bc) = 0 then there is no unique solution
if (ad - bc) ≠ 0 then there is a unique solution.Note: Unique, we can not emphasise this word enough. If the determinant is zero, it doesn't necessarily mean that there is no solution to the simultaneous equations! Consider:

x + y = 2
7x + 7y = 14the above set of equations has determinant zero, but there is obviously a solution, namely x = y = 1. In fact there are infiinitely many solutions! On the other hand consider also:

x + y = 1
x + y = 2this set of equations has determinant zero, and there is no solution at all. So if determinant is zero then there is either no solution or infinitely many solutions.
 Determinant of a matrix 

We define the determinant of a 2 × 2 matrix 

  
    
      
        A
        =
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}a&b\\c&d\end{pmatrix}}}
  to be

  
    
      
        det
        (
        A
        )
        =
        a
        d
        −
        b
        c
        
      
    
    {\displaystyle \det(A)=ad-bc\!}
  


=== Inverses ===
It is perhaps, at this stage, not very clear what the use is of the det(A). But it's intimately connected with the idea of an inverse. Consider in the real number system a number b, it has (multiplicative) inverse 1/b, i.e. b(1/b) = (1/b)b = 1. We know that 1/b does not exist when b = 0. 
In the world of matrices, a matrix A may or may not have an inverse depending on the value of the determinant det(A)! How is this so? Let's suppose A (known) does have an inverse B (i.e. AB = I = BA). So we aim to find B. Let's suppose further that

  
    
      
        A
        =
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}a&b\\c&d\end{pmatrix}}}
  and 

  
    
      
        B
        =
        
          
            (
            
              
                
                  w
                
                
                  x
                
              
              
                
                  y
                
                
                  z
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}w&x\\y&z\end{pmatrix}}}
  we need to solve four simultaneous equations to get the values of w, x, y and z in terms of a, b, c, d and det(A).

aw + by = 1
cw + dy = 0
ax + bz = 0
cx + dz = 1the reader can try to solve the above by him/herself. The required answer is

  
    
      
        B
        =
        
          
            1
            
              det
              (
              A
              )
            
          
        
        
          
            (
            
              
                
                  d
                
                
                  −
                  b
                
              
              
                
                  −
                  c
                
                
                  a
                
              
            
            )
          
        
      
    
    {\displaystyle B={\frac {1}{\det(A)}}{\begin{pmatrix}d&-b\\-c&a\end{pmatrix}}}
  In here we assumed that A has an inverse, but this doesn't make sense if det(A) = 0, as we can not divide by zero. So A-1 (the inverse of A) exists if and only if det(A) ≠ 0. 
Summary
If AB = BA = I, then we say B is the inverse of A. We denote the inverse of A by A-1. The inverse of a 2 × 2 matrix

  
    
      
        A
        =
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}a&b\\c&d\end{pmatrix}}}
  is 

  
    
      
        
          A
          
            −
            1
          
        
        =
        
          
            1
            
              det
              (
              A
              )
            
          
        
        
          
            (
            
              
                
                  d
                
                
                  −
                  b
                
              
              
                
                  −
                  c
                
                
                  a
                
              
            
            )
          
        
      
    
    {\displaystyle A^{-1}={\frac {1}{\det(A)}}{\begin{pmatrix}d&-b\\-c&a\end{pmatrix}}}
  provided the determinant of A is not zero.


=== Solving simultaneous equations ===
Suppose we are to solve:

ax + by = α
cx + dy = βWe let

  
    
      
        A
        =
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}a&b\\c&d\end{pmatrix}}}
  

  
    
      
        w
        =
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
      
    
    {\displaystyle w={\begin{pmatrix}x\\y\end{pmatrix}}}
  

  
    
      
        γ
        =
        
          
            (
            
              
                
                  α
                
              
              
                
                  β
                
              
            
            )
          
        
      
    
    {\displaystyle \gamma ={\begin{pmatrix}\alpha \\\beta \end{pmatrix}}}
  we can translate it into matrix form

  
    
      
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  α
                
              
              
                
                  β
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}a&b\\c&d\end{pmatrix}}{\begin{pmatrix}x\\y\end{pmatrix}}={\begin{pmatrix}\alpha \\\beta \end{pmatrix}}}
  i.e

  
    
      
        A
        w
        =
        γ
      
    
    {\displaystyle Aw=\gamma }
  If A's determinant is not zero, then we can pre-multiply both sides by A-1 (the inverse of A)

  
    
      
        
          
            
              
                
                  A
                  
                    −
                    1
                  
                
                A
                w
              
              
                =
              
              
                
                  A
                  
                    −
                    1
                  
                
                γ
              
            
            
              
                I
                w
              
              
                =
              
              
                
                  A
                  
                    −
                    1
                  
                
                γ
              
            
            
              
                w
              
              
                =
              
              
                
                  A
                  
                    −
                    1
                  
                
                γ
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}A^{-1}Aw&=&A^{-1}\gamma \\Iw&=&A^{-1}\gamma \\w&=&A^{-1}\gamma \\\end{matrix}}}
  i.e.

  
    
      
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        
          
            1
            
              a
              d
              −
              b
              c
            
          
        
        
          
            (
            
              
                
                  d
                
                
                  −
                  b
                
              
              
                
                  −
                  c
                
                
                  a
                
              
            
            )
          
        
        
          
            (
            
              
                
                  α
                
              
              
                
                  β
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x\\y\end{pmatrix}}={\frac {1}{ad-bc}}{\begin{pmatrix}d&-b\\-c&a\end{pmatrix}}{\begin{pmatrix}\alpha \\\beta \end{pmatrix}}}
  which implies that x and y are unique.
 Examples 
Find the inverse of A, if it exists

a) 
  
    
      
        A
        =
        
          
            (
            
              
                
                  1
                
                
                  5
                
              
              
                
                  2
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}1&5\\2&3\end{pmatrix}}}
  
b) 
  
    
      
        A
        =
        
          
            (
            
              
                
                  10
                
                
                  2
                
              
              
                
                  2
                
                
                  7
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}10&2\\2&7\end{pmatrix}}}
  
c) 
  
    
      
        A
        =
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  3
                  a
                
                
                  3
                  b
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}a&b\\3a&3b\end{pmatrix}}}
  
d) 
  
    
      
        A
        =
        
          
            (
            
              
                
                  3
                
                
                  5
                
              
              
                
                  5
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}3&5\\5&3\end{pmatrix}}}
   Solutions

a) 
  
    
      
        
          A
          
            −
            1
          
        
        =
        
          
            1
            
              −
              7
            
          
        
        
          
            (
            
              
                
                  3
                
                
                  −
                  5
                
              
              
                
                  −
                  2
                
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle A^{-1}={\frac {1}{-7}}{\begin{pmatrix}3&-5\\-2&1\end{pmatrix}}}
  
b) 
  
    
      
        
          A
          
            −
            1
          
        
        =
        
          
            1
            66
          
        
        
          
            (
            
              
                
                  7
                
                
                  −
                  2
                
              
              
                
                  −
                  2
                
                
                  10
                
              
            
            )
          
        
      
    
    {\displaystyle A^{-1}={\frac {1}{66}}{\begin{pmatrix}7&-2\\-2&10\end{pmatrix}}}
  
c) No solution, as det(A) = 3ab - 3ab = 0
d) 
  
    
      
        
          A
          
            −
            1
          
        
        =
        
          
            1
            
              −
              16
            
          
        
        
          
            (
            
              
                
                  3
                
                
                  −
                  5
                
              
              
                
                  −
                  5
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle A^{-1}={\frac {1}{-16}}{\begin{pmatrix}3&-5\\-5&3\end{pmatrix}}}
    Exercises 
1. Find the determinant of

  
    
      
        A
        =
        
          
            (
            
              
                
                  
                    
                      2
                      5
                    
                  
                
                
                  
                    
                      2
                      3
                    
                  
                
              
              
                
              
              
                
                  
                    
                      3
                      2
                    
                  
                
                
                  
                    
                      5
                      2
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}{\frac {2}{5}}&{\frac {2}{3}}\\\\{\frac {3}{2}}&{\frac {5}{2}}\end{pmatrix}}}
  . Using the determinant of A, decide whether there's a unique solution to the following simultaneous equations

  
    
      
        
          
            
              
                
                  
                    2
                    5
                  
                
                x
                +
                
                  
                    2
                    3
                  
                
                y
                =
                0
              
            
            
              
                
                  
                    3
                    2
                  
                
                x
                +
                
                  
                    5
                    2
                  
                
                y
                =
                0
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}{\frac {2}{5}}x+{\frac {2}{3}}y=0\\{\frac {3}{2}}x+{\frac {5}{2}}y=0\end{matrix}}}
  2. Suppose

C = ABshow that 

det(C) = det(A)det(B)for the 2 × 2 case. Note: it's true for all cases.
3. Show that if you swap the rows of A to get A' , then det(A) = -det(A' )
4. Using the result of 2
a) Prove that if:

  
    
      
        A
        =
        
          P
          
            −
            1
          
        
        B
        P
      
    
    {\displaystyle A=P^{-1}BP}
  then det(A) = det(B)
b) Prove that if:

Ak = 0for some positive integer k, then det(A) = 0.
5. a) Compute A5, i.e. multiply A by itself 5 times, where

  
    
      
        A
        =
        
          
            (
            
              
                
                  −
                  1
                
                
                  6
                
              
              
                
                  −
                  1
                
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}-1&6\\-1&4\\\end{pmatrix}}}
  b) Find the inverse of P where 

  
    
      
        P
        =
        
          
            (
            
              
                
                  1
                
                
                  −
                  2
                
              
              
                
                  −
                  1
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle P={\begin{pmatrix}1&-2\\-1&3\\\end{pmatrix}}}
  c) Verify that

  
    
      
        A
        =
        
          P
          
            −
            1
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
        P
      
    
    {\displaystyle A=P^{-1}{\begin{pmatrix}1&0\\0&2\\\end{pmatrix}}P}
  d) Compute A5 by using part (b) and (c).
e) Compute A100


== Other Sections ==
Next Section > High_School_Mathematics_Extensions/Matrices/Linear_Recurrence_Relations_Revisited
Problem Set > High_School_Mathematics_Extensions/Matrices/Problem Set
Project > High_School_Mathematics_Extensions/Matrices/Project/Elementary_Matrices


== *Linear recurrence relations revisited* ==
We have already discussed linear recurrence relations in the  Counting and Generating functions chapter. We shall study it again using matrices. Consider the Fibonacci numbers

1, 1, 2, 3, 5, 8, 13, 21...where each number is the sum of two preceding numbers. Let xn be the (n + 1)th Fibonacci number, we can write:

  
    
      
        
          
            
              
                
                  
                    (
                    
                      
                        
                          
                            x
                            
                              n
                            
                          
                        
                      
                      
                        
                          
                            x
                            
                              n
                              −
                              1
                            
                          
                        
                      
                    
                    )
                  
                
              
              
                =
              
              
                
                  
                    (
                    
                      
                        
                          
                            x
                            
                              n
                              −
                              1
                            
                          
                          +
                          
                            x
                            
                              n
                              −
                              2
                            
                          
                        
                      
                      
                        
                          
                            x
                            
                              n
                              −
                              1
                            
                          
                        
                      
                    
                    )
                  
                
              
            
            
              
            
            
              
              
                =
              
              
                
                  
                    (
                    
                      
                        
                          1
                        
                        
                          1
                        
                      
                      
                        
                          1
                        
                        
                          0
                        
                      
                    
                    )
                  
                
                
                  
                    (
                    
                      
                        
                          
                            x
                            
                              n
                              −
                              1
                            
                          
                        
                      
                      
                        
                          
                            x
                            
                              n
                              −
                              2
                            
                          
                        
                      
                    
                    )
                  
                
              
            
            
              
            
            
              
              
                =
              
              
                
                  
                    
                      (
                      
                        
                          
                            1
                          
                          
                            1
                          
                        
                        
                          
                            1
                          
                          
                            0
                          
                        
                      
                      )
                    
                  
                  
                    2
                  
                
                
                  
                    (
                    
                      
                        
                          
                            x
                            
                              n
                              −
                              2
                            
                          
                        
                      
                      
                        
                          
                            x
                            
                              n
                              −
                              3
                            
                          
                        
                      
                    
                    )
                  
                
              
            
            
              
            
            
              
              
                .
                .
                .
              
            
            
              
            
            
              
              
                =
              
              
                
                  
                    
                      (
                      
                        
                          
                            1
                          
                          
                            1
                          
                        
                        
                          
                            1
                          
                          
                            0
                          
                        
                      
                      )
                    
                  
                  
                    n
                    −
                    1
                  
                
                
                  
                    (
                    
                      
                        
                          
                            x
                            
                              1
                            
                          
                        
                      
                      
                        
                          
                            x
                            
                              0
                            
                          
                        
                      
                    
                    )
                  
                
              
            
            
              
            
            
              
              
                =
              
              
                
                  
                    
                      (
                      
                        
                          
                            1
                          
                          
                            1
                          
                        
                        
                          
                            1
                          
                          
                            0
                          
                        
                      
                      )
                    
                  
                  
                    n
                    −
                    1
                  
                
                
                  
                    (
                    
                      
                        
                          1
                        
                      
                      
                        
                          1
                        
                      
                    
                    )
                  
                
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}{\begin{pmatrix}x_{n}\\x_{n-1}\end{pmatrix}}&=&{\begin{pmatrix}x_{n-1}+x_{n-2}\\x_{n-1}\end{pmatrix}}\\\\&=&{\begin{pmatrix}1&1\\1&0\end{pmatrix}}{\begin{pmatrix}x_{n-1}\\x_{n-2}\end{pmatrix}}\\\\&=&{\begin{pmatrix}1&1\\1&0\end{pmatrix}}^{2}{\begin{pmatrix}x_{n-2}\\x_{n-3}\end{pmatrix}}\\\\&...\\\\&=&{\begin{pmatrix}1&1\\1&0\end{pmatrix}}^{n-1}{\begin{pmatrix}x_{1}\\x_{0}\end{pmatrix}}\\\\&=&{\begin{pmatrix}1&1\\1&0\end{pmatrix}}^{n-1}{\begin{pmatrix}1\\1\end{pmatrix}}\end{matrix}}}
  In fact many linear recurrence relations can be expressed in matrix form , e.g.

  
    
      
        
          x
          
            n
          
        
        =
        2
        
          x
          
            n
            −
            1
          
        
        +
        
          x
          
            n
            −
            2
          
        
        ;
         
        
          
            if n
          
        
        ≥
        2
      
    
    {\displaystyle x_{n}=2x_{n-1}+x_{n-2};\ {\mbox{if n}}\geq 2}
  

  
    
      
        
          x
          
            1
          
        
        =
        1
      
    
    {\displaystyle x_{1}=1}
  

  
    
      
        
          x
          
            0
          
        
        =
        1
      
    
    {\displaystyle x_{0}=1}
  can be expressed as

  
    
      
        
          
            (
            
              
                
                  
                    x
                    
                      n
                    
                  
                
              
              
                
                  
                    x
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  1
                
              
              
                
                  1
                
                
                  0
                
              
            
            )
          
        
        
          
            (
            
              
                
                  
                    x
                    
                      n
                      −
                      1
                    
                  
                
              
              
                
                  
                    x
                    
                      n
                      −
                      2
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x_{n}\\x_{n-1}\end{pmatrix}}={\begin{pmatrix}2&1\\1&0\end{pmatrix}}{\begin{pmatrix}x_{n-1}\\x_{n-2}\end{pmatrix}}}
  and therefore

  
    
      
        
          
            (
            
              
                
                  
                    x
                    
                      n
                    
                  
                
              
              
                
                  
                    x
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        =
        
          
            
              (
              
                
                  
                    2
                  
                  
                    1
                  
                
                
                  
                    1
                  
                  
                    0
                  
                
              
              )
            
          
          
            n
            −
            1
          
        
        
          
            (
            
              
                
                  1
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x_{n}\\x_{n-1}\end{pmatrix}}={\begin{pmatrix}2&1\\1&0\end{pmatrix}}^{n-1}{\begin{pmatrix}1\\1\end{pmatrix}}}
  So if we knew how to compute the powers of matrices quickly then we can work out the (n + 1)th Fibonacci number rather quickly!


=== Computing Powers Quickly ===
Note that from now on we emphasise if a matrix is a vector by writing an arrow on top of it.
Consider

  
    
      
        A
        =
        
          
            (
            
              
                
                  1
                
                
                  −
                  2
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}1&-2\\1&4\end{pmatrix}}}
  
  
    
      
        
          
            x
            →
          
        
        =
        
          
            (
            
              
                
                  2
                
              
              
                
                  −
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\overrightarrow {x}}={\begin{pmatrix}2\\-1\end{pmatrix}}}
  
  
    
      
        
          
            y
            →
          
        
        =
        
          
            (
            
              
                
                  −
                  1
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\overrightarrow {y}}={\begin{pmatrix}-1\\1\end{pmatrix}}}
  Something interesting happens when you multiply A by either 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   or 
  
    
      
        
          
            y
            →
          
        
      
    
    {\displaystyle {\overrightarrow {y}}}
   (Try it). In fact

  
    
      
        A
        
          
            x
            →
          
        
        =
        2
        
          
            x
            →
          
        
      
    
    {\displaystyle A{\overrightarrow {x}}=2{\overrightarrow {x}}}
  and

  
    
      
        A
        
          
            y
            →
          
        
        =
        3
        
          
            y
            →
          
        
      
    
    {\displaystyle A{\overrightarrow {y}}=3{\overrightarrow {y}}}
  .Generally for a matrix B, if a vector w ≠ 0 (the matrix with all entries zero) such that

  
    
      
        B
        
          
            w
            →
          
        
        =
        λ
        
          
            w
            →
          
        
      
    
    {\displaystyle B{\overrightarrow {w}}=\lambda {\overrightarrow {w}}}
  for some scalar λ, then 
  
    
      
        
          
            w
            →
          
        
      
    
    {\displaystyle {\overrightarrow {w}}}
   is called a eigenvector of B and λ the eigenvalue of B (corresponding to w). 
This is a feature of matrices that be exploited to compute powers easily. Here's how, using A, x and y from above, we write the two pieces of information together in matrix form:

  
    
      
        A
        
          
            (
            
              
                
                  
                    
                      x
                      →
                    
                  
                
                
                  
                    
                      y
                      →
                    
                  
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  
                    
                      x
                      →
                    
                  
                
                
                  
                    
                      y
                      →
                    
                  
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle A{\begin{pmatrix}{\overrightarrow {x}}&{\overrightarrow {y}}\end{pmatrix}}={\begin{pmatrix}{\overrightarrow {x}}&{\overrightarrow {y}}\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}}
  or written completely in numeral form

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  −
                  2
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&-2\\1&4\end{pmatrix}}{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}={\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}}
  you are encouraged to check the above is correct. What we did was we merged 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   and 
  
    
      
        
          
            y
            →
          
        
      
    
    {\displaystyle {\overrightarrow {y}}}
   into a matrix using each vector as a column, next we multiplied it by the diagonal matrix whose entries are the eigenvalue of each eigenvector correspondingly.
How to now exploit this matrix form to calculate powers of A quickly? We require a simple but ingenius step -- post-multiply (i.e. multiply from the right) both sides by the inverse of 

  
    
      
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}}
  we have

  
    
      
        
          
            (
            
              
                
                  1
                
                
                  −
                  2
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    −
                    1
                  
                
                
                  
                    −
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle {\begin{pmatrix}1&-2\\1&4\end{pmatrix}}={\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}^{-1}}
  Now to calculate An, we need only to do

  
    
      
        
          A
          
            n
          
        
        =
        
          
            
              (
              
                
                  
                    1
                  
                  
                    −
                    2
                  
                
                
                  
                    1
                  
                  
                    4
                  
                
              
              )
            
          
          
            n
          
        
        =
      
    
    {\displaystyle A^{n}={\begin{pmatrix}1&-2\\1&4\end{pmatrix}}^{n}=}
  
  
    
      
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    −
                    1
                  
                
                
                  
                    −
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
        .
        .
        .
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    −
                    1
                  
                
                
                  
                    −
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle {\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}^{-1}...{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}^{-1}}
  but inverses multiply to give I, so we are left with

  
    
      
        
          A
          
            n
          
        
        =
        
          
            
              (
              
                
                  
                    1
                  
                  
                    −
                    2
                  
                
                
                  
                    1
                  
                  
                    4
                  
                
              
              )
            
          
          
            n
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    0
                  
                
                
                  
                    0
                  
                  
                    3
                  
                
              
              )
            
          
          
            n
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    −
                    1
                  
                
                
                  
                    −
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle A^{n}={\begin{pmatrix}1&-2\\1&4\end{pmatrix}}^{n}={\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}^{n}{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}^{-1}}
  which is very easy to compute since powers of a diagonal matrix are easy to compute (just take each entry to the power).


==== Example 1 ====
Compute A5 where A is given above.
Solution
We do 

  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    0
                  
                
                
                  
                    0
                  
                  
                    3
                  
                
              
              )
            
          
          
            5
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    −
                    1
                  
                
                
                  
                    −
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}^{5}{\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}^{-1}}
  
  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  
                    2
                    
                      5
                    
                  
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    3
                    
                      5
                    
                  
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  1
                
              
              
                
                  1
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}2&-1\\-1&1\end{pmatrix}}{\begin{pmatrix}2^{5}&0\\0&3^{5}\end{pmatrix}}{\begin{pmatrix}1&1\\1&2\end{pmatrix}}}
  
  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  
                    2
                    
                      6
                    
                  
                  −
                  
                    3
                    
                      5
                    
                  
                
                
                  
                    2
                    
                      6
                    
                  
                  −
                  2
                  ×
                  
                    3
                    
                      5
                    
                  
                
              
              
                
                  −
                  
                    2
                    
                      5
                    
                  
                  +
                  
                    3
                    
                      5
                    
                  
                
                
                  −
                  
                    2
                    
                      5
                    
                  
                  +
                  2
                  ×
                  
                    3
                    
                      5
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}2^{6}-3^{5}&2^{6}-2\times 3^{5}\\-2^{5}+3^{5}&-2^{5}+2\times 3^{5}\end{pmatrix}}}
  


==== Example 2 ====
Let 

  
    
      
        B
        =
        
          
            (
            
              
                
                  −
                  13
                
                
                  28
                
              
              
                
                  −
                  8
                
                
                  17
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}}
  and its eigenvectors are

  
    
      
        
          
            (
            
              
                
                  2
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}2\\1\end{pmatrix}}}
   and 
  
    
      
        
          
            (
            
              
                
                  7
                
              
              
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}7\\4\end{pmatrix}}}
  Calculate B5 directly (optional), and again using the method above.
 Solution 
We need to first determine its eigenvalues. We do

  
    
      
        
          
            (
            
              
                
                  −
                  13
                
                
                  28
                
              
              
                
                  −
                  8
                
                
                  17
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
              
              
                
                  1
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}{\begin{pmatrix}2\\1\end{pmatrix}}={\begin{pmatrix}2\\1\end{pmatrix}}}
  so the eigenvalue corresponding to

  
    
      
        
          
            (
            
              
                
                  2
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}2\\1\end{pmatrix}}}
  is 1.
Similarly,

  
    
      
        
          
            (
            
              
                
                  −
                  13
                
                
                  28
                
              
              
                
                  −
                  8
                
                
                  17
                
              
            
            )
          
        
        
          
            (
            
              
                
                  7
                
              
              
                
                  4
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  21
                
              
              
                
                  12
                
              
            
            )
          
        
        =
        3
        
          
            (
            
              
                
                  7
                
              
              
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}{\begin{pmatrix}7\\4\end{pmatrix}}={\begin{pmatrix}21\\12\end{pmatrix}}=3{\begin{pmatrix}7\\4\end{pmatrix}}}
  so the other eigenvalue is 3.
Now we write them in the form:

  
    
      
        
          
            (
            
              
                
                  −
                  13
                
                
                  28
                
              
              
                
                  −
                  8
                
                
                  17
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  7
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  7
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}{\begin{pmatrix}2&7\\1&4\end{pmatrix}}={\begin{pmatrix}2&7\\1&4\end{pmatrix}}{\begin{pmatrix}1&0\\0&3\end{pmatrix}}}
  now make B the subject

  
    
      
        
          
            (
            
              
                
                  −
                  13
                
                
                  28
                
              
              
                
                  −
                  8
                
                
                  17
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  7
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
        
          
            (
            
              
                
                  4
                
                
                  −
                  7
                
              
              
                
                  −
                  1
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}={\begin{pmatrix}2&7\\1&4\end{pmatrix}}{\begin{pmatrix}1&0\\0&3\end{pmatrix}}{\begin{pmatrix}4&-7\\-1&2\end{pmatrix}}}
  Now

  
    
      
        
          
            
              (
              
                
                  
                    −
                    13
                  
                  
                    28
                  
                
                
                  
                    −
                    8
                  
                  
                    17
                  
                
              
              )
            
          
          
            5
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  7
                
              
              
                
                  1
                
                
                  4
                
              
            
            )
          
        
        
          
            (
            
              
                
                  
                    1
                    
                      5
                    
                  
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    3
                    
                      5
                    
                  
                
              
            
            )
          
        
        
          
            (
            
              
                
                  4
                
                
                  −
                  7
                
              
              
                
                  −
                  1
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}^{5}={\begin{pmatrix}2&7\\1&4\end{pmatrix}}{\begin{pmatrix}1^{5}&0\\0&3^{5}\end{pmatrix}}{\begin{pmatrix}4&-7\\-1&2\end{pmatrix}}}
  
so multiplying the right hand side out, we get
  
    
      
        
          
            
              (
              
                
                  
                    −
                    13
                  
                  
                    28
                  
                
                
                  
                    −
                    8
                  
                  
                    17
                  
                
              
              )
            
          
          
            5
          
        
        =
        
          
            (
            
              
                
                  8
                  −
                  7
                  ×
                  
                    3
                    
                      5
                    
                  
                
                
                  14
                  (
                  
                    3
                    
                      5
                    
                  
                  −
                  1
                  )
                
              
              
                
                  4
                  (
                  
                    3
                    
                      5
                    
                  
                  −
                  1
                  )
                
                
                  −
                  7
                  +
                  8
                  ×
                  
                    3
                    
                      5
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}-13&28\\-8&17\end{pmatrix}}^{5}={\begin{pmatrix}8-7\times 3^{5}&14(3^{5}-1)\\4(3^{5}-1)&-7+8\times 3^{5}\end{pmatrix}}}
  


==== Summary -- compute powers quickly ====
Given eigenvectors of a matrix A

Compute the eigenvalues (if not given)
Write in the form A = PDP-1, where D is a diagonal matrix of the eigenvalues, and P the eigenvectors as columns
Compute An using the right hand side equivalent


==== Exercises ====
1. The eigenvectors of

  
    
      
        B
        =
        
          
            (
            
              
                
                  −
                  8
                
                
                  6
                
              
              
                
                  −
                  15
                
                
                  11
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}-8&6\\-15&11\end{pmatrix}}}
  are

  
    
      
        
          
            (
            
              
                
                  2
                
              
              
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}2\\3\end{pmatrix}}}
   and 
  
    
      
        
          
            (
            
              
                
                  3
                
              
              
                
                  5
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}3\\5\end{pmatrix}}}
  calculate B52. The eigenvectors of

  
    
      
        B
        =
        
          
            (
            
              
                
                  −
                  8
                
                
                  6
                
              
              
                
                  −
                  9
                
                
                  7
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}-8&6\\-9&7\end{pmatrix}}}
  are

  
    
      
        
          
            (
            
              
                
                  1
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}1\\1\end{pmatrix}}}
   and 
  
    
      
        
          
            (
            
              
                
                  2
                
              
              
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}2\\3\end{pmatrix}}}
  calculate B53. The eigenvectors of

  
    
      
        B
        =
        
          
            (
            
              
                
                  177
                
                
                  −
                  140
                
              
              
                
                  225
                
                
                  −
                  178
                
              
            
            )
          
        
      
    
    {\displaystyle B={\begin{pmatrix}177&-140\\225&-178\end{pmatrix}}}
  are

  
    
      
        
          
            (
            
              
                
                  4
                
              
              
                
                  5
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}4\\5\end{pmatrix}}}
   and 
  
    
      
        
          
            (
            
              
                
                  7
                
              
              
                
                  9
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}7\\9\end{pmatrix}}}
  calculate B5


=== Eigenvector and eigenvalue ===
We know from the above section that for a matrix if we are given its eigenvectors, we can find the corresponding eigenvalues, and then we can compute its powers quickly. So the last hurdle becomes finding the eigenvectors.
An eigenvectors 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   of a matrix A and its corresponding eigenvalue λ are related by the following expression:

  
    
      
        A
        
          
            x
            →
          
        
        =
        λ
        
          
            x
            →
          
        
      
    
    {\displaystyle A{\overrightarrow {x}}=\lambda {\overrightarrow {x}}}
  where x ≠ 0 where 0 is the zero matrix (all entries zero). We can safely assume that A is given so there are two unknowns -- 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   and λ. We have enough information now to be able to work out the eigenvalues (and from that the eigenvectors):

  
    
      
        A
        
          
            x
            →
          
        
        −
        λ
        
          
            x
            →
          
        
        =
        0
      
    
    {\displaystyle A{\overrightarrow {x}}-\lambda {\overrightarrow {x}}=0}
  

  
    
      
        A
        
          
            x
            →
          
        
        −
        λ
        I
        
          
            x
            →
          
        
        =
        0
      
    
    {\displaystyle A{\overrightarrow {x}}-\lambda I{\overrightarrow {x}}=0}
  

  
    
      
        (
        A
        −
        λ
        I
        )
        
          
            x
            →
          
        
        =
        0
      
    
    {\displaystyle (A-\lambda I){\overrightarrow {x}}=0}
  The matrix (A - λI) must NOT have an inverse, because if it does then 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   = 0. Therefore det(A - λI) = 0.
Suppose

  
    
      
        A
        =
        
          
            (
            
              
                
                  a
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}a&b\\c&d\end{pmatrix}}}
  then

  
    
      
        A
        −
        λ
        I
        =
        
          
            (
            
              
                
                  a
                  −
                  λ
                
                
                  b
                
              
              
                
                  c
                
                
                  d
                  −
                  λ
                
              
            
            )
          
        
      
    
    {\displaystyle A-\lambda I={\begin{pmatrix}a-\lambda &b\\c&d-\lambda \end{pmatrix}}}
  
  
    
      
        0
        =
        det
        (
        A
        −
        λ
        I
        )
        =
        (
        a
        −
        λ
        )
        (
        d
        −
        λ
        )
        −
        b
        c
      
    
    {\displaystyle 0=\det(A-\lambda I)=(a-\lambda )(d-\lambda )-bc}
  Now we see det(A-λI) is a polynomial in λ and det(A-λI) = 0. We are already well-trained in solving quadratics, so it's easy to work out the values of λ. Once we've worked out the values of λ, we can work out 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   (see examples).


==== Example 1 ====
Find the eigenvalues and eigenvectors of

  
    
      
        A
        =
        
          
            (
            
              
                
                  −
                  4
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  7
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}-4&15\\-2&7\end{pmatrix}}}
  and then find D and P such that A = P-1DP.
Solution
We aim to find 
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   and λ such that

A
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
   = λ
  
    
      
        
          
            x
            →
          
        
      
    
    {\displaystyle {\overrightarrow {x}}}
  we proceed

  
    
      
        
          
            (
            
              
                
                  −
                  4
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  7
                
              
            
            )
          
        
        
          
            x
            →
          
        
        =
        λ
        
          
            x
            →
          
        
      
    
    {\displaystyle {\begin{pmatrix}-4&15\\-2&7\end{pmatrix}}{\overrightarrow {x}}=\lambda {\overrightarrow {x}}}
  
  
    
      
        
          
            (
            
              
                
                  −
                  4
                  −
                  λ
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  7
                  −
                  λ
                
              
            
            )
          
        
        
          
            x
            →
          
        
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-4-\lambda &15\\-2&7-\lambda \end{pmatrix}}{\overrightarrow {x}}=0}
   (**)det(A - λI) =
0 = (-4 - λ)(7 - λ) + 30
0 = -28 - 3λ + λ2 + 30
0 = λ2 - 3λ +  2
0 = (λ - 1)(λ - 2)
λ = 1, 2Now for each eigenvalue we will get a different corresponding eigenvector. So we consider the case λ = 1 and  λ = 2 separately.
Consider first λ = 1, from (**) we get

  
    
      
        
          
            (
            
              
                
                  −
                  4
                  −
                  1
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  7
                  −
                  1
                
              
            
            )
          
        
        x
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-4-1&15\\-2&7-1\end{pmatrix}}x=0}
  i.e.

  
    
      
        
          
            (
            
              
                
                  −
                  5
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  6
                
              
            
            )
          
        
        
          
            (
            
              
                
                  u
                
              
              
                
                  v
                
              
            
            )
          
        
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-5&15\\-2&6\end{pmatrix}}{\begin{pmatrix}u\\v\end{pmatrix}}=0}
  where 
  
    
      
        x
        =
        
          
            (
            
              
                
                  u
                
              
              
                
                  v
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}u\\v\end{pmatrix}}}
  
since det(A - λI) = 0, we know that there is no unique solution to the above equation. But we note that:

  
    
      
        x
        =
        
          
            (
            
              
                
                  3
                  t
                
              
              
                
                  1
                  t
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}3t\\1t\end{pmatrix}}}
  for any real number t is a solution, and we choose t = 1 as our solution because it's the simpliest. Therefore 

  
    
      
        x
        =
        
          
            (
            
              
                
                  3
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}3\\1\end{pmatrix}}}
  is the eigenvector corresponding to λ = 1. (***)
Similarly, if λ = 2, from (**) we get

  
    
      
        
          
            (
            
              
                
                  −
                  4
                  −
                  2
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  7
                  −
                  2
                
              
            
            )
          
        
        x
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-4-2&15\\-2&7-2\end{pmatrix}}x=0}
  i.e.

  
    
      
        
          
            (
            
              
                
                  −
                  6
                
                
                  15
                
              
              
                
                  −
                  2
                
                
                  5
                
              
            
            )
          
        
        
          
            (
            
              
                
                  u
                
              
              
                
                  v
                
              
            
            )
          
        
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-6&15\\-2&5\end{pmatrix}}{\begin{pmatrix}u\\v\end{pmatrix}}=0}
  where 
  
    
      
        x
        =
        
          
            (
            
              
                
                  u
                
              
              
                
                  v
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}u\\v\end{pmatrix}}}
  
we note that:

  
    
      
        x
        =
        
          
            (
            
              
                
                  5
                  t
                
              
              
                
                  2
                  t
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}5t\\2t\end{pmatrix}}}
  for any real number t is a solution, as before we choose t = 1 as our solution. Therefore 

  
    
      
        x
        =
        
          
            (
            
              
                
                  5
                
              
              
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}5\\2\end{pmatrix}}}
   is the eigenvector corresponding to λ = 2. (****)We summarise the result of (***) and (****), we have

  
    
      
        A
        
          
            (
            
              
                
                  3
                
              
              
                
                  1
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  3
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle A{\begin{pmatrix}3\\1\end{pmatrix}}={\begin{pmatrix}3\\1\end{pmatrix}}}
  
  
    
      
        A
        
          
            (
            
              
                
                  5
                
              
              
                
                  2
                
              
            
            )
          
        
        =
        2
        
          
            (
            
              
                
                  5
                
              
              
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A{\begin{pmatrix}5\\2\end{pmatrix}}=2{\begin{pmatrix}5\\2\end{pmatrix}}}
  we combine the results into one

  
    
      
        A
        
          
            (
            
              
                
                  3
                
                
                  5
                
              
              
                
                  1
                
                
                  2
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  3
                
                
                  5
                
              
              
                
                  1
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A{\begin{pmatrix}3&5\\1&2\end{pmatrix}}={\begin{pmatrix}3&5\\1&2\end{pmatrix}}{\begin{pmatrix}1&0\\0&2\end{pmatrix}}}
  and so

  
    
      
        A
        =
        
          
            (
            
              
                
                  3
                
                
                  5
                
              
              
                
                  1
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  0
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    3
                  
                  
                    5
                  
                
                
                  
                    1
                  
                  
                    2
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle A={\begin{pmatrix}3&5\\1&2\end{pmatrix}}{\begin{pmatrix}1&0\\0&2\end{pmatrix}}{\begin{pmatrix}3&5\\1&2\end{pmatrix}}^{-1}}
  


==== Example 2 ====
a) Diagonalize A, i.e find P (invertible) and B (diagonal) such that AP = PB
b) Compute A5

  
    
      
        A
        =
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
              
                
                  −
                  1
                
                
                  4
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}1&2\\-1&4\end{pmatrix}}}
   Solution a) We are solving Ax = λx, where λ is a constant and x′ a column vector.
Firstly

  
    
      
        A
        x
        −
        λ
        I
        x
        =
        0
      
    
    {\displaystyle Ax-\lambda Ix=0}
  

  
    
      
        (
        A
        −
        λ
        I
        )
        x
        =
        0
      
    
    {\displaystyle (A-\lambda I)x=0}
  since 'x′ ≠ 0 we have

  
    
      
        d
        e
        t
        (
        A
        −
        λ
        I
        )
        =
        0
      
    
    {\displaystyle det(A-\lambda I)=0}
  i.e.

  
    
      
        det
        
          
            (
            
              
                
                  1
                  −
                  λ
                
                
                  2
                
              
              
                
                  −
                  1
                
                
                  4
                  −
                  λ
                
              
            
            )
          
        
        =
        0
      
    
    {\displaystyle \det {\begin{pmatrix}1-\lambda &2\\-1&4-\lambda \end{pmatrix}}=0}
  

  
    
      
        
          
            
              
                (
                1
                −
                λ
                )
                (
                4
                −
                λ
                )
                +
                2
              
              
                =
              
              
                0
              
            
            
              
                
                  λ
                  
                    2
                  
                
                −
                5
                λ
                +
                6
              
              
                =
              
              
                0
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}(1-\lambda )(4-\lambda )+2&=&0\\\lambda ^{2}-5\lambda +6&=&0\end{matrix}}}
  

  
    
      
        λ
        =
        3
        ,
         
        2
      
    
    {\displaystyle \lambda =3,\ 2}
  For λ = 3, 

  
    
      
        (
        A
        −
        3
        I
        )
        x
        =
        0
      
    
    {\displaystyle (A-3I)x=0}
  

  
    
      
        
          
            (
            
              
                
                  −
                  2
                
                
                  2
                
              
              
                
                  −
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-2&2\\-1&1\end{pmatrix}}{\begin{pmatrix}x\\y\end{pmatrix}}=0}
  Clearly

  
    
      
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  1
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x\\y\end{pmatrix}}={\begin{pmatrix}1\\1\end{pmatrix}}}
  is a solution. Note that we do not accept x = 0 as an solution, because we assume x ≠ 0. Note also that 

  
    
      
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  t
                
              
              
                
                  t
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x\\y\end{pmatrix}}={\begin{pmatrix}t\\t\end{pmatrix}}}
  for some constant t is also a solution. Indeed we could use x = y = 2, 3 or 4 as a solution, but for convenience we choose the simplest i.e. x = y = 1.
For λ = 2, 

  
    
      
        (
        A
        −
        2
        I
        )
        x
        =
        0
      
    
    {\displaystyle (A-2I)x=0}
  

  
    
      
        
          
            (
            
              
                
                  −
                  1
                
                
                  2
                
              
              
                
                  −
                  1
                
                
                  2
                
              
            
            )
          
        
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        0
      
    
    {\displaystyle {\begin{pmatrix}-1&2\\-1&2\end{pmatrix}}{\begin{pmatrix}x\\y\end{pmatrix}}=0}
  Clearly

  
    
      
        
          
            (
            
              
                
                  x
                
              
              
                
                  y
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x\\y\end{pmatrix}}={\begin{pmatrix}2\\1\end{pmatrix}}}
  is a solution.
Therefore

  
    
      
        A
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  1
                
                
                  2
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  3
                
                
                  0
                
              
              
                
                  0
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A{\begin{pmatrix}1&2\\1&1\end{pmatrix}}={\begin{pmatrix}1&2\\1&1\end{pmatrix}}{\begin{pmatrix}3&0\\0&2\end{pmatrix}}}
  is a solution and 

  
    
      
        A
        
          
            (
            
              
                
                  2
                
                
                  1
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  1
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
      
    
    {\displaystyle A{\begin{pmatrix}2&1\\1&1\end{pmatrix}}={\begin{pmatrix}2&1\\1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}}
  is also a solution.

b)

  
    
      
        
          A
          
            5
          
        
        =
        
          
            
              (
              
                
                  
                    
                      
                        (
                        
                          
                            
                              2
                            
                            
                              1
                            
                          
                          
                            
                              1
                            
                            
                              1
                            
                          
                        
                        )
                      
                    
                    
                      
                        (
                        
                          
                            
                              2
                            
                            
                              0
                            
                          
                          
                            
                              0
                            
                            
                              3
                            
                          
                        
                        )
                      
                    
                    
                      
                        
                          (
                          
                            
                              
                                2
                              
                              
                                1
                              
                            
                            
                              
                                1
                              
                              
                                1
                              
                            
                          
                          )
                        
                      
                      
                        −
                        1
                      
                    
                  
                
              
              )
            
          
          
            5
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}{\begin{pmatrix}2&1\\1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}{\begin{pmatrix}2&1\\1&1\end{pmatrix}}^{-1}\end{pmatrix}}^{5}}
  

  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  1
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    0
                  
                
                
                  
                    0
                  
                  
                    3
                  
                
              
              )
            
          
          
            5
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    1
                  
                
                
                  
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}2&1\\1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}^{5}{\begin{pmatrix}2&1\\1&1\end{pmatrix}}^{-1}}
  

  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  1
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  
                    2
                    
                      5
                    
                  
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    3
                    
                      5
                    
                  
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
                
                  −
                  1
                
              
              
                
                  −
                  1
                
                
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}2&1\\1&1\end{pmatrix}}{\begin{pmatrix}2^{5}&0\\0&3^{5}\end{pmatrix}}{\begin{pmatrix}1&-1\\-1&2\end{pmatrix}}}
  

  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  
                    2
                    
                      6
                    
                  
                  −
                  
                    3
                    
                      5
                    
                  
                
                
                  
                    2
                    
                      6
                    
                  
                  −
                  2
                  ×
                  
                    3
                    
                      5
                    
                  
                
              
              
                
                  
                    2
                    
                      5
                    
                  
                  −
                  
                    3
                    
                      5
                    
                  
                
                
                  −
                  
                    2
                    
                      5
                    
                  
                  +
                  2
                  ×
                  
                    3
                    
                      5
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}2^{6}-3^{5}&2^{6}-2\times 3^{5}\\2^{5}-3^{5}&-2^{5}+2\times 3^{5}\end{pmatrix}}}
  


==== Example 3 ====
Solve the linear recurrence relation

  
    
      
        
          
            
              
                
                  x
                  
                    n
                  
                
              
              
                =
              
              
                5
                
                  x
                  
                    n
                    −
                    1
                  
                
              
              
                −
              
              
                6
                
                  x
                  
                    n
                    −
                    2
                  
                
                ;
                 
                
                  
                    if n
                  
                
                ≥
                2
              
            
            
              
                
                  x
                  
                    1
                  
                
              
              
                =
              
              
                1
              
            
            
              
                
                  x
                  
                    0
                  
                
              
              
                =
              
              
                0
              
            
          
        
      
    
    {\displaystyle {\begin{matrix}x_{n}&=&5x_{n-1}&-&6x_{n-2};\ {\mbox{if n}}\geq 2\\x_{1}&=&1\\x_{0}&=&0\\\end{matrix}}}
   Solution 

  
    
      
        
          
            (
            
              
                
                  
                    x
                    
                      n
                    
                  
                
              
              
                
                  
                    x
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        =
        
          
            
              (
              
                
                  
                    5
                  
                  
                    −
                    6
                  
                
                
                  
                    1
                  
                  
                    0
                  
                
              
              )
            
          
          
            n
            −
            1
          
        
        
          
            (
            
              
                
                  1
                
              
              
                
                  0
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x_{n}\\x_{n-1}\end{pmatrix}}={\begin{pmatrix}5&-6\\1&0\end{pmatrix}}^{n-1}{\begin{pmatrix}1\\0\end{pmatrix}}}
  We need to diagonalize 

  
    
      
        A
        =
        
          
            (
            
              
                
                  5
                
                
                  −
                  6
                
              
              
                
                  1
                
                
                  0
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}5&-6\\1&0\end{pmatrix}}}
  we proceed:

  
    
      
        det
        
          (
          A
          −
          λ
          I
          )
        
        =
        0
        
      
    
    {\displaystyle \det {(A-\lambda I)}=0\!}
  we get

λ = 2, 3For λ = 2

  
    
      
        (
        A
        −
        2
        I
        )
        x
        =
        0
        
      
    
    {\displaystyle (A-2I)x=0\!}
  

  
    
      
        x
        =
        
          
            (
            
              
                
                  2
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}2\\1\end{pmatrix}}}
  For λ = 3

  
    
      
        (
        A
        −
        3
        I
        )
        x
        =
        0
        
      
    
    {\displaystyle (A-3I)x=0\!}
  

  
    
      
        x
        =
        
          
            (
            
              
                
                  3
                
              
              
                
                  1
                
              
            
            )
          
        
      
    
    {\displaystyle x={\begin{pmatrix}3\\1\end{pmatrix}}}
  Therefore

  
    
      
        A
        =
        
          
            (
            
              
                
                  2
                
                
                  3
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  2
                
                
                  0
                
              
              
                
                  0
                
                
                  3
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    3
                  
                
                
                  
                    1
                  
                  
                    1
                  
                
              
              )
            
          
          
            −
            1
          
        
      
    
    {\displaystyle A={\begin{pmatrix}2&3\\1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}{\begin{pmatrix}2&3\\1&1\end{pmatrix}}^{-1}}
  Now

  
    
      
        
          A
          
            n
            −
            1
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  3
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            
              (
              
                
                  
                    2
                  
                  
                    0
                  
                
                
                  
                    0
                  
                  
                    3
                  
                
              
              )
            
          
          
            n
            −
            1
          
        
        
          
            (
            
              
                
                  −
                  1
                
                
                  3
                
              
              
                
                  1
                
                
                  −
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A^{n-1}={\begin{pmatrix}2&3\\1&1\end{pmatrix}}{\begin{pmatrix}2&0\\0&3\end{pmatrix}}^{n-1}{\begin{pmatrix}-1&3\\1&-2\end{pmatrix}}}
  

  
    
      
        
          A
          
            n
            −
            1
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  3
                
              
              
                
                  1
                
                
                  1
                
              
            
            )
          
        
        
          
            (
            
              
                
                  
                    2
                    
                      n
                      −
                      1
                    
                  
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    3
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        
          
            (
            
              
                
                  −
                  1
                
                
                  3
                
              
              
                
                  1
                
                
                  −
                  2
                
              
            
            )
          
        
      
    
    {\displaystyle A^{n-1}={\begin{pmatrix}2&3\\1&1\end{pmatrix}}{\begin{pmatrix}2^{n-1}&0\\0&3^{n-1}\end{pmatrix}}{\begin{pmatrix}-1&3\\1&-2\end{pmatrix}}}
  
  
    
      
        
          A
          
            n
            −
            1
          
        
        =
        
          
            (
            
              
                
                  −
                  
                    2
                    
                      n
                    
                  
                  +
                  
                    3
                    
                      n
                    
                  
                
                
                  3
                  ×
                  
                    2
                    
                      n
                    
                  
                  −
                  2
                  ×
                  
                    3
                    
                      n
                    
                  
                
              
              
                
                  −
                  
                    2
                    
                      n
                      −
                      1
                    
                  
                  +
                  
                    3
                    
                      n
                      −
                      1
                    
                  
                
                
                  3
                  ×
                  
                    2
                    
                      n
                      −
                      1
                    
                  
                  −
                  2
                  ×
                  
                    3
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle A^{n-1}={\begin{pmatrix}-2^{n}+3^{n}&3\times 2^{n}-2\times 3^{n}\\-2^{n-1}+3^{n-1}&3\times 2^{n-1}-2\times 3^{n-1}\end{pmatrix}}}
  Therefore

  
    
      
        
          
            (
            
              
                
                  
                    x
                    
                      n
                    
                  
                
              
              
                
                  
                    x
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  −
                  
                    2
                    
                      n
                    
                  
                  +
                  
                    3
                    
                      n
                    
                  
                
                
                  3
                  ×
                  
                    2
                    
                      n
                    
                  
                  −
                  2
                  ×
                  
                    3
                    
                      n
                    
                  
                
              
              
                
                  −
                  
                    2
                    
                      n
                      −
                      1
                    
                  
                  +
                  
                    3
                    
                      n
                      −
                      1
                    
                  
                
                
                  3
                  ×
                  
                    2
                    
                      n
                      −
                      1
                    
                  
                  −
                  2
                  ×
                  
                    3
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        
          
            (
            
              
                
                  1
                
              
              
                
                  0
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x_{n}\\x_{n-1}\end{pmatrix}}={\begin{pmatrix}-2^{n}+3^{n}&3\times 2^{n}-2\times 3^{n}\\-2^{n-1}+3^{n-1}&3\times 2^{n-1}-2\times 3^{n-1}\end{pmatrix}}{\begin{pmatrix}1\\0\end{pmatrix}}}
  
  
    
      
        
          
            (
            
              
                
                  
                    x
                    
                      n
                    
                  
                
              
              
                
                  
                    x
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
        =
        
          
            (
            
              
                
                  −
                  
                    2
                    
                      n
                    
                  
                  +
                  
                    3
                    
                      n
                    
                  
                
              
              
                
                  −
                  
                    2
                    
                      n
                      −
                      1
                    
                  
                  +
                  
                    3
                    
                      n
                      −
                      1
                    
                  
                
              
            
            )
          
        
      
    
    {\displaystyle {\begin{pmatrix}x_{n}\\x_{n-1}\end{pmatrix}}={\begin{pmatrix}-2^{n}+3^{n}\\-2^{n-1}+3^{n-1}\end{pmatrix}}}
  i.e

  
    
      
        
          x
          
            n
          
        
        =
        −
        
          2
          
            n
          
        
        +
        
          3
          
            n
          
        
        
      
    
    {\displaystyle x_{n}=-2^{n}+3^{n}\!}
  


=== Exercises ===
1. Compute A5 where

  
    
      
        A
        =
        
          
            (
            
              
                
                  −
                  12
                
                
                  10
                
              
              
                
                  −
                  21
                
                
                  17
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}-12&10\\-21&17\end{pmatrix}}}
  2. Compute A5 where

  
    
      
        A
        =
        
          
            (
            
              
                
                  −
                  6
                
                
                  28
                
              
              
                
                  −
                  2
                
                
                  9
                
              
            
            )
          
        
      
    
    {\displaystyle A={\begin{pmatrix}-6&28\\-2&9\end{pmatrix}}}
  3. Solve the following recurrence relations

  
    
      
        
          x
          
            n
          
        
        =
        3
        
          x
          
            n
            −
            1
          
        
        −
        
          x
          
            n
            −
            2
          
        
        
      
    
    {\displaystyle x_{n}=3x_{n-1}-x_{n-2}\!}
  

  
    
      
        
          x
          
            1
          
        
        =
        1
        
      
    
    {\displaystyle x_{1}=1\!}
  

  
    
      
        
          x
          
            0
          
        
        =
        0
        
      
    
    {\displaystyle x_{0}=0\!}
   Solutions 
1.

  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  −
                  2922
                
                
                  2110
                
              
              
                
                  −
                  4431
                
                
                  3197
                
              
            
            )
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}-2922&2110\\-4431&3197\end{pmatrix}}}
  2.

  
    
      
        
          A
          
            5
          
        
        =
        
          
            (
            
              
                
                  −
                  216
                
                
                  868
                
              
              
                
                  −
                  62
                
                
                  249
                
              
            
            )
          
        
      
    
    {\displaystyle A^{5}={\begin{pmatrix}-216&868\\-62&249\end{pmatrix}}}
  


== More Applications ==
...more to come

Problem Set > High_School_Mathematics_Extensions/Matrices/Problem Set
Project > High_School_Mathematics_Extensions/Matrices/Project/Elementary_Matrices


= Feedback =
What do you think? Too easy or too hard? Too much information or not enough? How can we improve? Please let us know by leaving a comment in the discussion tab. Better still, edit it yourself and make it better.