PH05 Lecture Notes on Linear Algebra Joe Ó hógáin E-mail: johog@mathstcdie Main Text: Calculus for the Life Sciences by Bittenger, Brand and Quintanilla Other Text: Linear Algebra by Anton and Rorres
Matrices An m n real matrix A is an array of mn real numbers arranged in m rows and n columns, a a a j a n a a a j a n A = a i a i a ij a in a m a m a mj a mn The n matrix ( a i a i a in ) is called the i th row and the m matrix a j a j is called the j th column a mj A is often written just as A = (a ij ) for short and a ij is called the ij-entry or component If m = n, then A is a square matrix m n is called the size of the matrix
( ) Examples: (i) 7 is a matrix ( 0 ) 5 (ii) 6 8 is a matrix 5 0 7 5 (iii) is a 4 4 matrix 6 8 0 0 9 Definition: Two matrices A = (a ij ) and B = (b ij ) of the same size are equal if all their corresponding entries are equal ie a ij = b ij for all i and j Definition: We define addition of matrices of the same size componentwise: if A = (a ij ) and B = (b ij ) are m n matrices, then A + B = C, where C = (c ij ) with c ij = a ij + b ij for all i and j ( ) 5 Example: If A = 0 4 ( ) then A + B = 0 7 and B = ( 5 0 ), 0
Definition: Scalar Multiplication: If A = (a ij ) is an m n matrix and α is a real number, then αa is the m n matrix given by αa = (αa ij ) 5 0 6 Example: If A = 0 4, then A = 4 0 8 6 4 Definition: A square n n matrix A = (a ij ) is diagonal if a ij = 0 for all i j, ie all off-diagonal entries are 0 Example: 0 0 0 5 0 0 0 is diagonal Two particular n n diagonal matrices are the n n unit matrix I n = 0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 and the n n zero matrix 4
Theorem: For matrices A, B, C of the same size we have (i) A + B = B + A (ii) (A + B) + C = A + (B + C) (iii) α(a + B) = αa + αb Proof: Exercise (look at components) ( ) ( ) 5 0 Exercise: If A = 6 0 and B = 4, find A + B, 6A B, B A Definition:Multiplication of matrices is defined as follows: if A = (a ij ) is m p and B = (b jk ) is p n, then we define the product C = AB to be the m n matrix (c ik ), where c ik = a i b k + a i b k + + a ip b pk Note that the number of columns on the left must equal the number of rows on the right ( ) 5 Examples: (i) If A = is and B = 4 ( ) 5 5 is, then AB is defined and AB = 4 5
is ( ) 4 4 4 (ii) If A = is and B = 0 6 0 4 5 ( ) 5 0 4, then AB is defined and AB = 8 4 6 is ( 4) (iii) If A = 5 4, then AB is defined and AB = is and B = 5 4 is is Note that BA need not be defined even if AB is and if it is defined, BA AB in general Theorem: If A is an m n matrix and B, C are n p matrices and α R, then (i) A(B + C) = AB + AC (ii) A(αB) = α(ab) Proof: Exercise (again look at components) 6
Exercise: (i) If A = find AB (ii) If A = 5 0 4 find AB, BA, A B 5 and B = and B = 6 4 7
Systems of Linear Equations The system of m equations in n variables (unknowns) is a set of equations of the form a x + a x + + a n x n = b a x + a x + + a n x n = b a m x + a m x + + a mn x n = b m This system can be written in matrix form as a a a n a a a n x x = b b or simply Ax = b a m a m a mn x n b m A is called the coefficient matrix and [A b] = a a a n b a a a n b is called the augmented a m a m a mn b m matrix 8
The augmented matrix is essentially the system of equations omitting the variables and the = signs Recall the case of two variables: Examples: (i) x + y = x y = Geometrically we have two non-parallel lines and hence have a unique solution (ii) x + y = x + y = Geometrically we have two different parallel lines and hence have no solution (iii) x + y = 4x + 6y = 6 Geometrically we have two parallel lines which are the same line and hence infinitely many solutions 9
The solution set of the system is the set of all x x that satisfies all the equations We can perform the following three operations on the equations without altering the solution set: (i) Interchange any two equations; (ii) multiply any equation by a constant; (iii) add or subtract any multiple of one equation to or from another equation We solve the system by replacing it with a new system which has the same solution set but which is easier to solve We do this by using the above operations When these operations are applied to the augmented matrix they are called elementary row operations There are three types of elementary row operations: (i) R ij ; interchange the i th and j th rows (ii) αr i ; multiply the i th row by α (iii) R i + αr j ; add α times i th row to j th row Note that none of these elementary row operations will change x n 0
the solution set of the system Example: Solve the system of linear equations x + x + x = 9 x + 4x x = x + 6x 5x = 0 We perform suitable operations on the augmented matrix 9 4 6 5 0 0 7 9 7 0 7 0 4 9 0 0 7 R R 9 0 7 7 R R R R 6 5 0 0 4 9 0 0 7 9 0 4 0 0 0 R R ( )R R R
0 6 9 0 4 0 0 0 R 6R 0 0 0 4 0 0 0 0 0 0 0 The system has been reduced to 0 0 x = x = x = R +4R This is an example of a general method, called row reduction or Gaussian elimination, to solve such systems Definition: A matrix is in row-echelon form if (i) every non-zero row begins with, called a leading ; (ii) any zero rows are at the bottom; (iii) in any two successive non-zero rows the leading in the lower row occurs further to the right than the leading in the higher row The variables associated with the leading s are called leading variables
The matrix is in reduced row-echelon form if, in addition, each column that contains a leading has 0 everywhere else Examples: 4 6 7 0 4 0 0 5 ( ) 0 0 0, 0 0 0 0 0 0 reduced row-echelon form is in row-echelon form, Example: Write the matrix 0 0 0 7 4 0 6 8 4 5 6 5 0 0 0 7 4 0 6 8 4 5 6 5 0 0 0 0 0 0 0 0 0 0, are all in in reduced row-echelon form R 4 0 6 8 0 0 0 7 4 5 6 5 R
5 6 4 0 0 0 7 4 5 6 5 5 6 4 0 0 0 7 6 0 0 5 0 7 7 R R R 5R 5 6 4 0 0 0 7 0 0 5 0 7 7 5 6 4 0 0 0 7 6 0 0 0 0 5 6 4 0 0 0 7 6 This is row-echelon form 0 0 0 0 6 5 6 4 0 0 0 7 6 0 0 0 0 6 0 0 5 0 0 0 7 6 0 0 0 0 6 R +5R R + 7 R This is reduced row-echelon form 0 6 0 0 0 7 6 0 0 0 0 6 0 0 5 0 0 0 0 5 0 0 0 0 6 There are many ways in which a given matrix can be reduced R R R + R 4
to reduced row-echelon form but it can be shown that the result is always the same ie the reduced row-echelon form is unique We solve a system of linear equations by reducing the augmented matrix to reduced row-echelon form This process is called row reduction or Gaussian elimination A system of linear equations is homogeneous if all the numbers on the right-hand side are 0 ie b b = 0 0 b n 0 A homogeneous system always has at least one solution, namely x = 0, x = 0,, x n = 0 If it has more variables than equations iem < n, then not all variables can be leading variables and so we have infinitely many solutions If b b 0 0, we say the system is inhomogeneous b n 0 5
Then we can have no solution if a row in the reduced rowechelon form looks like ( 0 0 0 = 0 ), a unique solution if all variables are leading variables or infinitely many solutions if not all variables are leading variables Example: Using row reduction solve the system of linear equations x + x + x + x 4 = x x + x + x 4 = 8 x + x + x x 4 = 8 0 5 0 5 0 8 0 4 8 0 5 0 8 R R ( )R R R 0 5 0 5 0 5 0 8 0 4 8 0 0 6 04 R R R R R 6
0 4 8 0 0 8 0 6 46 0 0 0 0 0 8 R 6R R R We have reduced the system to the form x x 4 = x = x + x 4 = 8 0 6 46 0 4 8 0 0 0 0 8 8 0 0 0 0 0 x, x and x are called leading variables x 4 is called a free variable, it can have any value r, say Then x = + r, x =, x = 8 r, x 4 = r is the solution set of the system In vector form the solution set is given by R +4R x x x x 4 = 0 + r 8 0 7
Example: Using row reduction solve the system of linear equations 6 4 4 0 5 6 4 0 8 9 0 8 9 4 x + 6x + 4x = x + 4x x = 0 x + x + 5x = R +R R +R 6 4 4 0 0 8 9 4 R R 6 4 0 8 9 0 0 0 The bottom line is not true for any values of the variables, so the system has no solution 8