* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download APPENDIX Matrix Algebra
Bra–ket notation wikipedia , lookup
Capelli's identity wikipedia , lookup
System of linear equations wikipedia , lookup
Tensor operator wikipedia , lookup
Quadratic form wikipedia , lookup
Linear algebra wikipedia , lookup
Cartesian tensor wikipedia , lookup
Symmetry in quantum mechanics wikipedia , lookup
Rotation matrix wikipedia , lookup
Eigenvalues and eigenvectors wikipedia , lookup
Jordan normal form wikipedia , lookup
Determinant wikipedia , lookup
Four-vector wikipedia , lookup
Matrix (mathematics) wikipedia , lookup
Singular-value decomposition wikipedia , lookup
Perron–Frobenius theorem wikipedia , lookup
Non-negative matrix factorization wikipedia , lookup
Cayley–Hamilton theorem wikipedia , lookup
APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, PhD. MATRIX ALGEBRA REVIEW MATRIX DEFINITIONS A MATRIX is a rectangular collection of numbers. An r × c matrix (also called an array) is a rectangular array (or table) with r rows and c columns. 1 2 5 4 5 3 Matrix A is a matrix with two rows and three columns. For that reason, it is called a 2 by 3 matrix. This is called the dimension of a matrix. It is expressed as number of rows × number of columns. So, B is a 4 × 3 matrix. 1 5 1 2 5 3 5 5 4 8 4 3 It is common to refer to elements in a matrix by subscripts. We can represent such a matrix as B = [bij] where 1≤i≤r and 1 ≤ j ≤ c. Thus bij is the element in the ith row and jth column. with the row first and the column second. So in this case, b2,1= 5 and b1,3= 4. Generally, matrices are denoted as bold capital letters. A SQUARE MATRIX is one where r = c. The main diagonal of a square k × k matrix A is a11, …, akk. If all the elements in the square matrix A are 0 then the matrix is called the null matrix. An identity matrix is a square matrix where on the main diagonal are 1 and all other elements are 0, denoted I (or Ik to emphasize that it is a k × k identity matrix). The following two matrices are both identity matrices and diagonal matrices. 1 0 0 0 0 1 0 0 1 1 APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, Hanov PhD. They are called identity matrices, because any matrix multiplied with an identify matrix equals itself. The diagonal entries of a matrix are the entries where the column and row number are the same. The trace of a n × n matrix is the sum of all the diagonal entries. In other words, for n × n matrix A, The trace of A is a11 + … + akk. A triangular matrix has either all zeros in the triangular portion below the main diagonal (an upper triangular matrix) or all zeros in the triangular portion above the main diagonal (a lower triangular matrix). Define matrix A = [aij] as follows: A is a 3 × 3 square matrix whose main diagonal is 3, 5, 2. The trace of is 3 + 5 + 2 = 10. The element in the 2nd row and 3rd column is a23 = 4. A is an upper triangular matrix. Two matrices A = [aij] and B = [bij] are equal, denoted A = B, if they have the same size and shape (i.e. the same number of of rows and columns) and all the corresponding elements are equal (i.e. aij = bij for all i, j with 1 ≤ i ≤ r and 1 ≤ j ≤ c). EXCEL: a matrix is represented as a rectangular range. E.g. B3:E5 B3: can be considered to be a 3 × 4 matrix. A VECTOR is a matrix with only one row (called a row vector) or only one column (called a column vector). For example y is a 4 dimensional row vector and x is a 3 dimensional column vector. An "ordinary" number can be thought of as a 1 × 1 matrix, also known as a SCALAR. E =π or K =6 2 APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, PhD. MATRIX ARITHMETIC To take the TRANSPOSE of a matrix, simply switch the rows and column of a matrix. The transpose of A can be denoted as A′ or AT. For example, for 1 2 5 5 4 3 1 2 5 5 4 3 EXCEL: If A is an 2 × 3 array, then TRANSPOSE(A) = AT. This is an array function and so you must highlight an 3 × 2 range before entering =TRANSPOSE(A) and then pressing Ctrl-ShiftEnter. If you click on OK or enter, press F2 and then Ctrl-Shift-Enter You can also transpose an array A in Excel by copying the array (i.e. by highlighting the array of A and pressing Ctrl-C), clicking where you want AT located (i.e. the cell at the upper left corner of AT) and then selecting Home/Paste/ and choosing the Transpose option. 3 APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, PhD. If a matrix is its own transpose, then that matrix is said to be symmetric. Symmetric matrices must be square matrices, with the same number of rows and columns. One example of a symmetric matrix is shown below: 1 5 4 5 4 7 3 3 3 To perform MATRIX ADDITION, two matrices must have the same dimensions. This means they must have the same number of rows and columns. In that case simply add each individual component, like below. EXCEL: Perform matrix addition in Excel create formula by the address of the cells for first element of A+B and use copy function to copy formula for rest of the matrix elements. Matrix addition does have many of the same properties as "normal" addition, such as In addition, if one wishes to take the transpose of the sum of two matrices, then To multiply a matrix by a scalar, also known as SCALAR MULTIPLICATION, multiply every element in the matrix by the scalar. For example: 4 APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, PhD. EXCEL: Perform scalar multiplication in Excel create formula for first element of [k*A] matrix and use copy function to copy formula for rest of the matrix elements. To multiply two vectors with the same length together is to take the SUM PRODUCT, also called dot or inner product. This is done by multiplying every entry in the two vectors together and then adding all the products up. For example, for vectors x and y, the dot product is calculated below EXCEL: Multiply two vectors in Excel use function SUMPRODUCT(x,y). In this context an array is a continuous range of cells in a row or column. The number of cells must be the same in each array. To perform MATRIX MULTIPLICATION, the first matrix must have the same number of columns as the second matrix has rows. The number of rows of the resulting matrix equals the number of rows of the first matrix, and the number of columns of the resulting matrix equals the number of columns of the second matrix. So a 2 × 3 matrix could be multiplied by 5 APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, PhD. a 3 × 4 matrix, forming a 2 × 4 matrix, but one cannot multiply a 3 × 4 matrix with a 2 × 3 matrix. 3 2 9 4 8 3 7 2 6 3 3 2 2 6 4 2 3 5 9 24 52 6 12 11 40 35 EXCEL: Multiply two matrix in Excel use function MMULT(A, B). If A is an p × m array and B is an m × n array, then MMULT(A, B) = the p × n matrix A*B. Note that since this is an array function, you must first highlight a p × n range before entering =MMULT(A, B) and then you must press Ctrl-Shift-Enter. Matrix multiplication has some of the same properties as "normal" multiplication, such as 6 APPENDIX Econometrics I – Matrix Algebra Ing. Martina Hanová, PhD. However matrix multiplication is not communicative. That is to say A*B does not necessarily equal B*A. In fact, B*A often has no meaning since the dimensions rarely match up. The INVERSE of a square matrix A, sometimes called a reciprocal matrix, is a matrix A-1. The matrix A-1 is the INVERSE of matrix A if A*A-1 = A-1*A = I where I is the identity matrix. A square matrix A has an inverse if the determinant |A|≠ 0. = 5 10 6 2 12 4 3 8 1 & 0.28 = 0.53 0.44 0.19 0.32 0.11 0.72 0.97 0.56 For finding the matrix inverse in general, you can use Gauss-Jordan Algorithm. However, this is a rather complicated algorithm, so usually one relies upon the computer or calculator to find the matrix inverse. EXCEL: If A is an n × n square array, then MINVERSE(A) = A-1. This is an array function and so you must highlight an n × n range before entering =MINVERSE(A) and then pressing CtrlShift-Enter. 7