If we have a square matrix (or a covariance matrix) of the form:

    [a 0]
    [0 b]
OR:
    [a 0 0]
    [0 b 0]
    [0 0 c]
OR:
    [a 0 0 0]
    [0 b 0 0]
    [0 0 c 0]
    [0 0 0 n]

(that is all entries of the matrix are zeros except the main diagnoal)

We don't need to do any calculation to find Eigenvalues and Eigenvectors, simply:

  • Eigenvalues are the diagnoal elements of our matrix, e.g.) a, b, c, and n in the matrices above. AND,
  • Eigenvectors will always take the form:
    • [1, 0] and [0, 1], where each 1 corresponds to the eigenvalue position in the 2x2 matrix.
    • In the case of 3 x 3 matrix, then eigenvectors will be:
      • [1, 0, 0], [0, 1, 0], [0, 0, 1]
    • The same thing apply to 4x4 matrix and any nxn matrix.

If you don't believe that check it out below:

In [3]:
green = [[2,0],
         [0,2]]
eig_val, eig_vec = eig(green)
print eig_val
print eig_vec
[ 2.  2.]
[[ 1.  0.]
 [ 0.  1.]]

In [4]:
red = [[.5, 0],
       [0, 4.5]]
eig_val, eig_vec = eig(red)
print eig_val
print eig_vec
[ 0.5  4.5]
[[ 1.  0.]
 [ 0.  1.]]

In [5]:
blue = [[4.5, 0],
        [0, .5]]
eig_val, eig_vec = eig(blue)
print eig_val
print eig_vec
[ 4.5  0.5]
[[ 1.  0.]
 [ 0.  1.]]

In [6]:
example1 = [[.5, 0],
            [0,  2]]
eig_val, eig_vec = eig(example1)
print eig_val
print eig_vec
[ 0.5  2. ]
[[ 1.  0.]
 [ 0.  1.]]

In [7]:
anything = [[5000,      0], 
            [0,    100000]]
eig_val, eig_vec = eig(anything)
print eig_val
print eig_vec
[   5000.  100000.]
[[ 1.  0.]
 [ 0.  1.]]

In [8]:
another_thing = [[1234,     0], 
                 [0,    56789]]
eig_val, eig_vec = eig(another_thing)
print eig_val
print eig_vec
[  1234.  56789.]
[[ 1.  0.]
 [ 0.  1.]]

Even with 3x3 matrices

python is AWESOME!

In [9]:
threeD_matrix   = [[1234,     0,    0], 
                   [0,    56789,    0],
                   [0,        0, 4334]]
eig_val, eig_vec = eig(threeD_matrix)
print eig_val
print eig_vec
[  1234.  56789.   4334.]
[[ 1.  0.  0.]
 [ 0.  1.  0.]
 [ 0.  0.  1.]]

Even with 4x4 matrices

In [10]:
fourD_matrix   = [[3164,     0,     0,    0], 
                  [0,      999,     0,    0],
                  [0,        0,  8334,    0],
                  [0,        0,     0, 4334]]
eig_val, eig_vec = eig(fourD_matrix)
print eig_val
print eig_vec
[ 3164.   999.  8334.  4334.]
[[ 1.  0.  0.  0.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0.  1.]]

Even with 5x5 matrices ... and

Even with nxn matrices.