DATA605: Assignment 2

Bonnie Cooper

Trace / Determinant / Factorization

Problem Set #1

  1. Show that \(A^T A \neq AA^T\) in general. (Proof and demonstration.)

    If matrix \(A\) has dimentions \((m , n)\) and \(A^T\) is \(A\)’s transpose, then the products \(A^TA\) and \(AA^T\) will have the dimensions \((n,n)\) and \((m,m)\) respectively. Therefore, if \(m \neq n\) it follows that \(A^T A \neq AA^T\)

    This is demonstrated here:

##      [,1] [,2] [,3] [,4]
## [1,]    1    4    1    0
## [2,]    2    1    1    1
## [3,]    3    1    2    2
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    4    1    1
## [3,]    1    1    2
## [4,]    0    1    2
## [1] "size of AtA: 4x4    size of AAt: 3x3"
## [1] FALSE
  1. For a special type of square matrix A, we get \(A^T A = AA^T\). Under what conditions could this be true? (Hint: The Identity matrix I is an example of such a matrix).

    Square matices with symmetry across the diagonal are a special case where \(A^T A = AA^T\) is true.

##      [,1] [,2] [,3]
## [1,]   14   10   10
## [2,]   10    9   10
## [3,]   10   10   14
##      [,1] [,2] [,3]
## [1,]   14   10   10
## [2,]   10    9   10
## [3,]   10   10   14
## [1] TRUE

Problem Set #2

    Matrix factorization is a very important problem. There are supercomputers built just to do matrix factorizations. Every second you are on an airplane, matrices are being factorized. Radars that track flights use a technique called Kalman filtering. At the heart of Kalman Filtering is a Matrix Factorization operation. Kalman Filters are solving linear systems of equations when they track your flight using radars.
    Write an R function to factorize a square matrix A into LU or LDU, whichever you prefer. You don’t have to worry about permuting rows of A and you can assume that A is less than 5x5, if you need to hard-code any variables in your code.

## $U
##      [,1] [,2] [,3]
## [1,]    2   -1   -2
## [2,]    0    4   -1
## [3,]    0    0    3
## 
## $L
##      [,1] [,2] [,3]
## [1,]    1    0    0
## [2,]   -2    1    0
## [3,]   -2   -1    1