Problem 1
Consider matrixes A, and A-transpose (AT) Show that (AT matrix-multipled by A) does not equal (A matrix-multipled by AT)
Proof
Proof:
If we take a 2x2 non-zero matrix,
At = [[a, b], [c, d]]
At = [[a, c], [b, d]]
AAt = [[(aa + ba), (ac + bd)], [(ca + db), (cc + dd)]]
AtA = [[(aa + cc), (ac + cd)], [(ba + dc), (bb + dd)]]
Because the results of either
Demonstration
A <- matrix(c(1,2,3,4,5,6,7,8,9), nrow=3, byrow=TRUE)
At <- t(A)Matrix Multiplication AT*A
At %*% A## [,1] [,2] [,3]
## [1,] 66 78 90
## [2,] 78 93 108
## [3,] 90 108 126
Matrix Multiplication A*AT
At %*% A## [,1] [,2] [,3]
## [1,] 66 78 90
## [2,] 78 93 108
## [3,] 90 108 126
Looking at the above we can see that the resuls of each matrix multiplication are not the same.
Problem 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. Please submit your response in an R Markdown document using our class naming convention, E.g. LFulton_Assignment2_PS2.png
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. If you doing the entire assignment in R, then please submit only one markdown document for both the problems.
LU_solution<- function(A){
upper <- A
dimensions <- dim(A)[1]
lower <- diag(dimensions)
for(i in 2:dimensions){
for(j in 1:(i-1)){
lower[i,j] <- upper[i,j] / upper[j,j]
upper[i,] <- upper[i,] - lower[i,j] * upper[j,]
}
}
return(list(lower, upper))
}Test with Matrix A from problem 1
LU_solution(A)## [[1]]
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 4 1 0
## [3,] 7 2 1
##
## [[2]]
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 -3 -6
## [3,] 0 0 0