Chapter 6 Matrix Algebra



Chapter 6 Matrix AlgebraSafarzadehTable of ContentsTOC \o "1-2" \h \z \uMatrices PAGEREF _Toc33370965 \h 1Vectors PAGEREF _Toc33370966 \h 2Algebra of Matrices PAGEREF _Toc33370967 \h 3Matrix Multiplication PAGEREF _Toc33370968 \h 5Special Matrics: Identity Matrix PAGEREF _Toc33370969 \h 14Matrix algebra began as the study of systems of linear equations. Today, it provides a basic framework for the study of modern algebra, multivariable calculus, and differential equations. Although algebraic operations on matrices may seem a bit abstract, they help simplify the mathematical notations and operations of the underlying models of economic problems. Chapters 6 through 8 of this book employ matrix algebra in optimizing problems, where the function has two or more independent variables. Chapters 9 and 10 utilize the concept of rank and linear dependence as well as matrix algebra in solving linear programming problems and linear economic models. Chapter 11 makes an extensive use of concepts developed in this chapter and chapter 5, such as eigenvalues and eigenvectors, to solve systems of first order differential equations.MatricesMatrix: A matrix is a rectangular array of elements arranged in rows or columns as:Amn=a11a12...a1na21a22...a2n...aij..am1am2...amnA has m*n elements arranged in m rows and n columns, and is said to be of order m by n. The elements in the ith row and jth column is represented by aij. Matrices provide a powerful way of organizing and manipulating data. In many instances, large amounts of information can be summarized in matrix form. Matrices are usually denoted by bold capital characters.Example: A car manufacturer is producing three models of cars, sedan (S), full-size (F), and Vans (V). Total production (TP) of the three models in thousands of units for the years 2014-2018 are summarized in a 5 by 3 matrix,TP5.3=453228523831664139724245784552where the columns represent the models and the rows represent the years, with the first row representing 2014.VectorsA matrix of order 1 by n is called a row vector. For example,b1.3=b1b2b3is a 1 by 3 row vector. A matrix of order m by 1 is a column vector. For example,C3.1=c1c2c3is a 3 by 1 column vector. With these definitions, a matrix can also be viewed as a set of column vectors or row vectors. That is, the matrix A above can be written as A = [a1 a2 . . . a3 where,a1=a11a21..am1a2=a12a22..am2In physical science, the term vector is used to indicate a quantity such as force or velocity that has both magnitude and direction. In such cases, a vector is often represented by an arrow or directed line segment. The length of the arrow represents the magnitude and the tip of the arrow points in the direction of the vector. In business and economics, a vector may represent time series data, collection of data for one variable over a period of time, or a cross section collection of data on a variable at one time. The k elements of a row or column vector can be viewed as the coordinates of a point in a k-dimensional space. Vectors are usually denoted by a bold lower case character.Example: Price of the sedan cars, in thousands of dollars, for 2014-2018 may be represented by a 1x5 vector pt = [9.2 9.6 1.2 1.8 11.2]. This is an example of time-series data on one variable presented in a vector form. The prices of the three models of cars for 2014 may be represented by a 1 by 3 vector pc = [9.2 11.4 18.75]. This is an example of a cross-section data presented in a vector form.Algebra of MatricesThe algebra of matrices utilizes the following rules:Equality of Matrices: Two matrices Aand B are said to be equal when they are of the same order and all the corresponding elements of Aand B are equal.Example: Find x and y in a way that the two matricesA=2-134B=2-1.5xy-xare equal. Solution: For A and B to be equal, .5x = 3 and y - x = 4 should be satisfied. Solving these two equations together gives x = 6 and y = 10.Addition of Matrices: If A and B are of the same order, then A + B is obtained by adding the corresponding elements of A and B.Example: For two matrices A and B are given below. Find A + B. Using R:# Define matrices A and BA <- matrix(c(3, -1, 0, 10), nrow=2, ncol=2, byrow=TRUE)B <- matrix(c(2, 4, -7, 5), nrow=2, ncol = 2, byrow=TRUE)A; B## [,1] [,2]## [1,] 3 -1## [2,] 0 10## [,1] [,2]## [1,] 2 4## [2,] -7 5# Add A and B to get CC <- A+BC## [,1] [,2]## [1,] 5 3## [2,] -7 15The elements of matrix C are found by adding up the corresponding elements of the matrices A and B.Subtraction of Matrices: If A and B are of the same order, then A-B is obtained by subtracting the corresponding elements of B from A.Example: For the two matrices A and B of the preceding example find D=A-B. Using R:# Subtraction D <- A-BD## [,1] [,2]## [1,] 1 -5## [2,] 7 5The elements of matrix D are found by subtracting the corresponding elements of the matrix B from A.Scalar Multiplication: If k is a scalar, the scalar multiplication of A is obtained by multiplying each element of A by k. Example: Given Find 10*A#Scalar Multiplication of A by 1010*A## [,1] [,2]## [1,] 30 -10## [2,] 0 100Example: Unit Cost A manufacturer has two plants, p1 and p2. The cost of inputs per unit of labor and capital in each plant are shown by the following matrix,C3.2=233542383340where the rows 1, 2 and 3 are representing the plant and columns are representing unit cost of labor and capital for the corresponding plants, p1 and p2, respectively. It is expected that the next year’s unit costs of labor and capital will rise by 6%. Find the expected unit cost matrix for the next year. Solution: Multiply all elements of the cost matrix by 1.06 to get the expected cost for the next year.#Scalar multiplication and expected costunit_cost <- matrix(c(23, 35, 42, 38, 33, 40), nrow=3, ncol = 2, byrow =TRUE)expected_unit_cost <- 1.06*unit_costunit_cost## [,1] [,2]## [1,] 23 35## [2,] 42 38## [3,] 33 40expected_unit_cost## [,1] [,2]## [1,] 24.38 37.10## [2,] 44.52 40.28## [3,] 34.98 42.40Matrix MultiplicationIf matrix A is of order m*n and matrix B is of order n*p, then the product of A.B is a matrix of order m*p, where the ijth element is obtained by multiplying the elements of the ith row of the first matrix by the corresponding elements of the jth column of the second matrix and summing over all terms. For this to be possible, it is clear that the number of columns in the first matrix (n) should be equal to the number of rows in the second matrix (n). If that is the case, the matrices are said to be conformable for multiplication.Example: Find the dot product of A and BA=a11a12a21a22B=b11b12b21b22A*B=a11*b11+a12*b21a11*b12+a12*b22a21*b11+a22*b21a21*b12+a22*b22Example: Find the product of A and B below.A=3-1010B=24-75# Matrix MultiplicationA <- matrix(c(3, -1, 0, 10), nrow = 2, ncol=2, byrow = TRUE)B <- matrix(c(2, 4, -7, 5), nrow = 2, ncol=2,byrow = TRUE )C <- A%*%BC## [,1] [,2]## [1,] 13 7## [2,] -70 50where, c11 = 3*2+(-1)*(-7)=13, c12 = 3*4+(-1)*5=7, c21=0*2+10*(-7)=-70, and c22=0*4+10*5=50.It is important to note that not all the laws of ordinary scalar algebra hold for matrix algebra. The following are some of the laws of matrix operations.The Commutative law of addition holds. If A and B are of the same order, then A + B = B + A.The Associative law of addition holds. (A + B) + C =A + (B + C).The Commutative law of multiplication does not hold for product matrices, except in the case of some special square matrices. A*B ≠ B*A.The Associative law of multiplication holds. (A.B).C = A.(B.C).The Distributive law holds. A.(B + C) = A.B + A.C, and (B + C).A = B.A + C.A.The Distributive law of scalar multiplication holds. k(A + B) = kA + k*B, and (v + k)A = vA + kA.Example - Input Requirement: A manufacturer is producing three products x, y, and z. Each unit of x requires 5 units of labor and 1 unit of capital. Each unit of y requires 2 units of labor and 4 units of capital. Each unit of z requires 3 units of labor and 2 units of capital. Write the matrix of input requirements. If the manufacturer decides to produce 50 units of x, 20 units of y, and 80 units of z how many units of labor and capital are needed.IR <- matrix(c(5,1,2,4,3,2), nrow=3, ncol = 2, byrow = TRUE)rownames(IR) <- c("x", "y", "z")colnames(IR) <- c("labor", "capital")IR## labor capital## x 5 1## y 2 4## z 3 2Q <- matrix(c(50,20,80), nrow=1, ncol = 3)Q## [,1] [,2] [,3]## [1,] 50 20 80labor_capital <- Q %*% IRlabor_capital## labor capital## [1,] 530 290Note that, Q is a 1x3 vector and IR is a 3x2 matrix. The matrices are conformable for multiplication and the product is a 1x2 vector, with 530 units of labor and 290 units of capital.Example - Total Revenue: A firm operating in three locations manufactures and sells four products (A, B, C, and D) that are sold at market prices PA=8, PB=22, PC=13, and PD=16. Location 1 (L1) supplies 350 units of A and 598 units of D. Location 2 (L2) supplies 960 units of A, 1020 units of C, and 560 units of D. Location 3 (L#) supplies 2040 units of B and 975 units of D. Write the total revenue of the producer in matrix form and find total revenue for each location and the total revenue of the firm.Q <- matrix(c(350,0,0,598,960,0,1020,560,0,2040,0,975), nrow=4, ncol = 3, byrow=FALSE)colnames(Q) <- c("L1","L2","L3")rownames(Q) <- c("A", "B", "C", "D")Q## L1 L2 L3## A 350 960 0## B 0 0 2040## C 0 1020 0## D 598 560 975P <- matrix(c(8,22,13,16), nrow=1, ncol = 4)Revenue <- P %*% QTotal_Revenue <- sum(Revenue)Revenue## L1 L2 L3## [1,] 12368 29900 60480Total_Revenue## [1] 102748Total Revenue of the Firm = 12368 + 29900 + 60480 = 102748Direct Multiplication of Matrices: There are many cases in which a column or a row of a matrix needs to be scaled up or down. In these cases direct multiplication is a useful tool. Direct product of two matrices is a matrix with the elements that are the product of the corresponding elements of the two matrices.Example: Find the direct product of A and BA=a1b1c1d1B=a2b2c2d2AB=a1a2b1b2c1c2d1d2Example: Find the direct product of A and B below.#Direct Product of Two MatricesA <- matrix(c(3,1,7,2), nrow=2, ncol = 2, byrow = TRUE)B <- matrix(c(5,2,1,-3), nrow=2, ncol = 2, byrow = TRUE)A*B## [,1] [,2]## [1,] 15 2## [2,] 7 -6Transposition: One operation on matrices that has no equivalent in scalar algebra is called transposition. The transpose of A, denoted A’ or At, is obtained from A by interchanging rows and columns. That is, the first row of A becomes the first column of A’, the second row of A becomes the second column of A’ and so on.Example: Find the transpose of the following matrix,A=a11a12a21a22a31a32A’=a11a21a31a12a22a32Example: Find the transpose of the following matrixS <- matrix(c(15,10,20,8), nrow=2, ncol = 2, byrow = TRUE)print (S)## [,1] [,2]## [1,] 15 10## [2,] 20 8t(S)## [,1] [,2]## [1,] 15 20## [2,] 10 8Transposition is often used in matrix multiplication to make two matrices conformable for multiplication. For example, if A is a matrix of order 3x2 and B is a matrix of 4x2, B can’t be pre-multiplied by A. However, transposing B turns it to a 2x4 matrix and makes it conformable for pre-multiplication by A. The product of A.B’ will be a 3x4 matrix.Example - Total Spending: A consumer selects a basket of goods containing three items with the prices (P) and quantities (Q) given as P = (2 4 11), Q = (5 27 88), respectively. Find the total spending (TS) on the goods.P <- matrix(c(2,4,11), nrow=1, ncol = 3)Q <- matrix(c(5,27,88), nrow=1, ncol = 3)TS <- P%*%t(Q)TS## [,1]## [1,] 1086Note that the product of two vectors that generates a scalar number is called the inner product of the two vectors. The inner product and two other types of vector multiplications are discussed in the section titled “Products of Vectors” in this chapter.Transposition Rules of Matrices are given below, without the proofs. Students are required to verify them using numerical values for A, B, and C (Notation: A’).1- (A’ )’ = A2- (A + B)’ = A’ + B’3- (A.B)’ = B’.A’4- (A.B.C)’ = C’.B’.A’5- (A.B.C)’ = [(A.B).C]’ = C’.(A.B)’ =6- C’.B’.A’Trace: The Trace of a square matrix is defined as the sum of the elements in the principal diagonal.(Notation: tr(A).Example: Find the trace of the following matrixA=a11a12a13a21a22a23a31a32a33tr(A)=a11+a22+a33Example: Find the trace of the following matrix:A <- matrix(c(5,-1,0,3,2,9,21,3,-5,7,9,11,5,4,6,12), nrow=4, ncol = 4, byrow = TRUE)A## [,1] [,2] [,3] [,4]## [1,] 5 -1 0 3## [2,] 2 9 21 3## [3,] -5 7 9 11## [4,] 5 4 6 12sum(diag(A))## [1] 35Inverse Matrix: Given matrix A, if a matrix A-1 exists such that AA-1 = A-1A = I, then A-1is called the inverse of A. Here, I is a unit matrix or identity matrix. A unit matrix or identity matrix is a square matrix of order nxn with “1” in the principal diagonal and zeros everywhere else. In order to establish the matrix A-1, we need a few definitions.Determinant: Associated with any square matrix A, there is a scalar quantity called the determinant of A, denoted by Det[A] or |A|. This quantity is obtained by summing various products of the elements of A.Example: Find the determinant ofA=a11a12a21a22Determinant of a 2x2 matrix is the difference between the product of the diagonal and off-diagonal elements. That is, Det[A] = a11a22 - a21a12. For higher order matrices, finding determinants requires more calculation. There are several ways to find determinant of higher-order matrices. One way, called column expansion is as follows: 1- Take a11 element of the matrix A, delete the corresponding row and column, and form a new matrix (A11 ) with the remaining elements of the matrix. A determinant formed by deleting a row and a column corresponding to one element of a matrix is called principal minor.2- Take a21 element of the matrix A, delete the corresponding row and column, and form a new matrix (A21) with the remaining elements of the matrix.3- Continue this for all the elements of the matrix A in column one.4- Det[A] = a11Det[A11]- a21Det[A21] + a31Det[A31] ………This was a column expansion. Note that, the sign of the Subscript aij coefficients alternates, beginning with positive. The sign of the aij coefficients follows the sign convention (-1)i+j, where i+j is the sum of subscripts in aij. That is, for a11the sign is (-1)2= +1 and for a32 the sign is (-1)5 = -1.If you start with a11and continue with selecting aij is in the first row rather than the first column and follow the steps above, the method is called row expansion. Both row and column expansion will result in the same number for determinant. The question of which one to choose is answered by the magnitude of the numbers in the first row or first column. Obviously, numbers such as zero and one easier to use in numerical multiplication than numbers of larger magnitude.Example: Find the determinant ofB=310256631B <- matrix(c(3,1,0,2,5,6,6,3,1), nrow=3, ncol = 3, byrow = TRUE)det(B)## [1] -5In physical science the absolute value of the determinant of a 2x2 matrix A represents the area of the parallelogram formed by the columns of A. That is, forA=(a b)=4312A <- matrix(c(4,3,1,2), nrow=2, ncol = 2, byrow = TRUE)A## [,1] [,2]## [1,] 4 3## [2,] 1 2The area of the parallelogram formed by vectors a = (4 1) and b = (3 2) is (4)(2) - (1)(3) = 5. The column vectors of a 3x3 matrix form a solid that is a parallelotope. The determinant of the matrix will be the volume of this solid.Properties of Determinants: The following properties of determinants are given without proofs. Students are required to verify them by using numerical examples.1- Det[A’] = Det [A]2- Det[A.B] = Det[A].[B]3- Interchanging any two columns (or rows) of A changes the sign of the determinant of A.4- If every element of a row (or a column) of A is multiplied by a scalar k to give a new matrix B, then Det[B] = kDet[A].5- If every element of an nth order matrix A is multiplied by k to give a new matrix B, then Det[B] = k^nDet[A].6- A determinant is unaltered in value when to any row (column) a constant multiple of any other row (column) is added. This property can be used to cut the number of arithmetic operations for finding the determinant.Co-factors : cij = (-1)i+j Det[Aij]s are called co-factors (coefficients). Hence, c11 = Det[A11], c12 = -Det[A12], c13 = +Det[A13], and so on.Inverse of a Matrix: To find the inverse of a matrix A, take the following steps.Find co-factors of A and form a new matrix so that its elements are corresponding co-factors of A.Transpose the new matrix and call it adj A, the adjoint of A.Divide all the elements of adj A by determinant of A to get A-1.Note that, step 3 is possible only if Det[A] != 0, in which case, the matrix A is said to be nonsingular. When Det[A] = 0, the matrix is called a singular matrix, and the inverse does not exist.Example: Find the inverseA=31025463-1A <- matrix(c(3,1,0,2,5,4,6,3,-1), nrow=3, ncol = 3, byrow = TRUE)A## [,1] [,2] [,3]## [1,] 3 1 0## [2,] 2 5 4## [3,] 6 3 -1solve(A) # verify if the inverse exists## [,1] [,2] [,3]## [1,] 0.68 -0.04 -0.16## [2,] -1.04 0.12 0.48## [3,] 0.96 0.12 -0.52A%*%solve(A)## [,1] [,2] [,3]## [1,] 1.000000e+00 1.387779e-17 -5.551115e-17## [2,] 8.881784e-16 1.000000e+00 0.000000e+00## [3,] -2.220446e-16 0.000000e+00 1.000000e+00Inverse of a 2x2 Matrix: For a 2x2 matrix A, a short cut to find the inverse is to switch a11 with a22, change the sign of a12 and a21, and divide the elements of the new matrix (Adj A) by the determinant of A.Example: Find the inverse ofA=2314A <- matrix(c(2,3,1,4), nrow=2, ncol = 2, byrow = TRUE)solve(A)## [,1] [,2]## [1,] 0.8 -0.6## [2,] -0.2 0.4Properties of Inverse Matrices: The following are properties of inverse matrices. Students are required to demonstrate them using numerical examples.1- AB-1 =B-1A-1 2- A'-1 =(A-1)' 3- Det[A'-1]= 1/Det[A]]Example: Application in Econometrics In a regression model y=Xb+e, where y is a nx1 vector of dependent variable, X is a nxm matrix of independent variables, b is a mx1 vector of coefficients, and e is a nx1 vector of stochastic errors, b can be estimated as Overscript. For the given information on a 3x10 matrix X’ and a 1x10 vector y’ = (8 3 16 20 66 58 34 42 25 15) estimate the b coefficients.X’=214512117954456243911875389985895Y’=831620665834422515X <- matrix(c(2,4,5,1,5,3,4,6,8,5,2,9,12,4,9,11,3,8,7,9,5,9,11,8,5,8,9,4,7,5), nrow=10, ncol =3, byrow = TRUE)y <- matrix(c(8,3,16,20,66,58,34,42,25,15), nrow=10, ncol = 1, byrow = TRUE)solve(t(X) %*% X) %*% t(X) %*% y## [,1]## [1,] 5.8558063## [2,] -0.4157830## [3,] -0.5669177Product of Vectors: There are three types of vector products: inner products,outer product, and cross product of vectors.Inner Product or Dot Product of Vectors: The dot product or the inner product of two vectors a = {a1, a2, a3} and b = {b1, b2, b3} is a scalar number found by summing the products of corresponding elements of the two vectors. Here, the dot product of a.b = a1b1 + a2b2 + a3b3.Example - Total Revenue: The annual average price and the total quantity sold of a product is given by p = {28.50, 32.25, 33.15} and q = { 23400, 22150, 26300}, respectively. Find the total revenue (TR).Solution: Total revenue is price times quantity or the inner product of price and quantity vectors, TR = p.q’ = 28.50(23,400) + 32.25(22,150) + 33.15(26,300) = 2,253,080.P <- matrix(c(28.50,32.25,33.15), nrow=1, ncol = 3, byrow = TRUE)Q <- matrix(c(23400,22150,26300), nrow=1, ncol = 3, byrow = TRUE)TR <- sum(28.50 *23400 + 32.25 *22150 +33.15*26300)TR## [1] 2253082Outer Product of Vectors: The outer product of two vectors a and b is a matrix with elements that are the products of the corresponding elements of the two vectors.a <- matrix(c(3,1,-2), nrow=3, ncol = 1, byrow = TRUE)b <- matrix(c(2,0,5,7), nrow=1, ncol = 4, byrow = TRUE)D <- a%*% bD## [,1] [,2] [,3] [,4]## [1,] 6 0 15 21## [2,] 2 0 5 7## [3,] -4 0 -10 -14Conversion of Vectors using direct Product: The direct product or element by element product of two vectors produces a vector with elements which are the product of the corresponding elements of the two vectors. For example, the product of u = {a1, b1, c1} and v = {a2, b2, c2} is a vector w = u*v = {a1a2, b1b2, c1c2}.Example: Find u*v for u = {2, 5, 12} and v = {3, -1, 10}u <- matrix(c(2, 5, 12), nrow=1, ncol=3)v <- matrix(c(3, -1, 10), nrow=1, ncol=3)w <- u*vw## [,1] [,2] [,3]## [1,] 6 -5 120Problems: 1- GivenA=100-1B=2-101C=220-1a- Find A + C' and A' - C. b- Find A.B' and C'. B'. c- Find A'.C-1A and B.C-1.A. d- Show that [(A.B)'.C']’ = C.A.B2- Find the inverse of the following matrices,A=1032B=13210C=135024426D=1010110013 Write the following system of equations 2X1 + X2 + 3X3 = 8 X1 + X2 - X3 = 2 3X1 - 2X2 + X3 = 5 in the matrix form A*x=C, where A is the matrix of constant coefficients, X’ = [X1 X2 X3], and C is the vector of constants C' = (8 2 5), and find X = A-1C.Special Matrics: Identity MatrixThe following special matrices will be frequently referred to and used in solving problems:Identity Matrix: The unit or identity matrix is a square matrix of order nxn with units in the principal diagonal and zeros everywhere else. The following matrix is a 4x4 identity matrix.I=1000010000100001It is easy to verify that I.A = A.I = A.I=1000010000100001x <- matrix(cbind(c(1,0,0,0), c(0,1,0,0),c(0,0,1,0),c(0,0,0,1)), 4)x## [,1] [,2] [,3] [,4]## [1,] 1 0 0 0## [2,] 0 1 0 0## [3,] 0 0 1 0## [4,] 0 0 0 1Scalar Matrix: Scalar matrices have a common scalar element in the principal diagonal and zeros everywhere else. The following matrix is a 4x4 scalar matrix with a common scalar element 7.I=7000070000700007Scalar multiplication of a matrix A is equal to scalar matrix multiplication of that matrix. That is, kA = (kI)A = A(kI) = Ak.x <- matrix(cbind(c(1,0,0,0), c(0,1,0,0),c(0,0,1,0),c(0,0,0,1)), 4)7*x## [,1] [,2] [,3] [,4]## [1,] 7 0 0 0## [2,] 0 7 0 0## [3,] 0 0 7 0## [4,] 0 0 0 7Diagonal Matrix: A diagonal matrix has scalar elements, not necessarily equal, in the principal diagonal and zeros in the off-diagonal positions. The following matrix is an example of a 4x4 diagonal matrix.50000-20000100006Symmetric Matrix: If A = A', then A is called a symmetric matrix. It is obvious that A should be a square matrix. For example, ifA=538370804A’=538370804and A = A’Orthogonal Matrix: A matrix A is said to be orthogonal if Det[A] != 0 and A'A=I. Example Show thatA=22-222222is an orthogonal matrix.Solution: Det[A] = 1 ≠ 0 andA’A=1001. Therefore, A is an orthogonal matrix.Orthogonal Vectors: Two vectors u and v of the same order are called orthogonal vectors or perpendicular vectors if u'.v = 0.ExampleShow thatu=2-31v=124are orthogonal vectors.u<- matrix(c(2,-3,1),nrow=3, ncol = 1, byrow = TRUE)v<- matrix(c(1,2,4),nrow=3, ncol = 1, byrow = TRUE)t(u)## [,1] [,2] [,3]## [1,] 2 -3 1t(u)%*%v## [,1]## [1,] 0Idempotent Matrix: The matrix A is an idempotent matrix if A.A=A. That is, an idempotent matrix is one that upon multiplication by itself remains unchanged.Example: Prove that A is an Idempotent matrix.A=2313131323-1313-1323A<- matrix(c(2/3,1/3,1/3, 1/3,2/3,-(1/3),1/3,-(1/3),2/3),nrow=3, ncol = 3, byrow = TRUE)A ## [,1] [,2] [,3]## [1,] 0.6666667 0.3333333 0.3333333## [2,] 0.3333333 0.6666667 -0.3333333## [3,] 0.3333333 -0.3333333 0.6666667A%*%A## [,1] [,2] [,3]## [1,] 0.6666667 0.3333333 0.3333333## [2,] 0.3333333 0.6666667 -0.3333333## [3,] 0.3333333 -0.3333333 0.6666667 Idempotent Matrices and Statistics: A very useful device for data manipulation in statistics is a vector i which contains a column of 1s. This vector can be operated on vectors of the same order, say x, to find the sum, mean, and deviations from mean. The sum of the elements of x isi=1nXi=X1+X2+X3+...Xn=i'XSincei=1nXi=nX,X=1ni'X. The set of deviations from mean, then, isX-i1ni'X. Since1n=(i'i)-1, thusX-i1ni'X=X-i((i'i)-1i')X, where I is a unit matrix. Denotingi-i((i'i)-1i')by Mo, Mo =I-i((i'i)-1i')is called the fundamental matrix in statistics and is used in transforming data to deviation from their mean.Example:Variance Prove that the variance of a variable x, containing n observations and defined as Var(x) =i=1n(xi-x)-2can be written as x'Mox, where Mo =I-i((i'i)-1i'). Solution: The set of deviations from mean can be written as Mox. The variance, which is the sum square of deviations from mean, can be written in matrix as Mox'Mox =x'Mo'Mox. Since Mois an idempotent matrix, (Mox)'Mox = Mo, and Var(x) =x'MoxProblems: 1. Show that X(X'X)-1X and I-X(X'X)-1X' are idempotent matrices.Show that the following matrix is an orthogonal matrix.33-2266332266330-66Find vectors that are orthogonal to the following vectorsu’=10-1v’=3-25Using the fundamental matrix Mo = (I-i(i'i)-1i'), a) Prove that Mois an idempotent matrix. b) Prove that sum deviations from mean of any variable equals zero.Prove that the covariance between two variables x and y defined as COV(x,y)=i=1nxi-x)(yi-y) can be written as x'M0y, where M0=(I-i(i'i)-1i') ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download