Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Matrices Revision: Substitution 1. Solve for one variable in one of the equations. 2. Substitute this expression into the other equation to get one equation with one unknown. 3. Back substitute the value found in step 2 into the expression from step 1. 4. Check. Solve: 2x y 1 3 x 4 y 14 Step 1: Solve equation 1 for y. Step 2: Substitute this expression into eqn 2 for y. Step 3: Solve for x. Step 4: Substitute this value for x into eqn 1 and find the corresponding y value. Step 5: Check in both equations. y 1 2 x 3 x 41 2x 14 3 x 4 8 x 14 5 x 10 x 2 y 1 2 2 y 5 Elimination 1. Adjust the coefficients. 2. Add the equations to eliminate one of the variable. Then solve for the remaining variable. 3. Back substitute the value found in step 2 into one of the original equations to solve for the other variable. 4. Check. Solve: 3 x 2y 14 x 2y 2 Step1: The coefficients on the y variables are opposites. No multiplication is needed. Step 2: Add the two equations together. Step 3: Solve for x. Step 4: Substitute this value for x into either eqn and find the corresponding y value. Step 5: Check in both equations. 3 x 2y 14 x 2y 2 4 x 16 x4 34 2y 12 2y 2y y 14 14 2 1 Definition: • In mathematics, a matrix (plural matrices) is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. • In simple terms, a table of numbers. Example: • John and Bill went to the tuck shop. John bought a pie and cake and Bill bought 2 pies, a drink and a cake. John and Bill went to the tuck shop. John bought a pie and cake and Bill bought 2 pies, a drink and a cake. John Bill Matrix Pies 1 2 Drinks 0 1 é 1 0 1 ù ê ú êë 2 1 1 úû Cakes 1 1 Basics for matrices Order of a matrix Order = ( rows ´ columns) 2´ 3 means 2 rows and 3 columns é 1 0 1 ù ê ú êë 2 1 1 úû Equality: • Two matrices are equal only if they have the same order and their corresponding elements are equal. é 4 3 ù é 4 3 ù ê ú=ê ú ë 2 1 û ë 2 1 û but é 1 2 ù é 4 3 ù ê ú¹ê ú ë 3 4 û ë 2 1 û Addition • Two matrices must be of the same order before they can be added. é 4 3 ù é -4 2 ù é ê ú+ ê ú=ê ë 2 1 û ë 3 1 û ë é =ê ë 4 - 4 3+ 2 ù ú 2 + 3 1+1 û ù 0 5 ú 5 2 û Subtraction • The negative matrix is obtained by taking the opposite value of each element in the matrix. é A =ê ë é -A = ê ë 4 -3 ù ú 2 1 û ù -4 3 ú -2 -1 û Subtraction is the same as adding the negative matrix. Example é 2 2 ù é 1 2 ù A =ê ú ú B =ê ë 1 -3 û ë 3 4 û é 1- 2 2 - 2 ù é -1 0 ù A- B =ê ú ú=ê ë 3-1 4 + 3 û ë 2 7 û Scalar Multiplication • Multiplying by a number. • Each element is multiplied by the number. é 1 2 ù é 3 6 ù 3ê ú=ê ú ë 3 4 û ë 9 12 û • Also 3( A + B) = 3A + 3B Zero Matrix • Every element in the matrix is zero. • This is the identity for addition. • Example: é 0 0 ù ê ú, ë 0 0 û é 0 0 0 ù ê ú êë 0 0 0 úû Identity or unit matrix • The elements of the leading diagonal are all 1 and all other elements are zero. • Example: é 1 0 0 ù é 1 0 ù ê ú ê ú, ê 0 1 0 ú ë 0 1 û ê 0 0 1 ú ë û Matrix Multiplication • Two matrices can be multiplied if the number of columns of the first matrix equals the number of rows of the second matrix. • Example: é 1 2 ùé 5 ù ê úê ú ë 3 4 ûë 3 û 2 ´ 2 2 ´1 Matrix Multiplication é 1 2 ùé 5 ù ê úê ú ë 3 4 ûë 3 û 2 ´ 2 2 ´1 • This forms a 2 x 1 matrix Matrix Multiplication é 1 2 ùé 5 ù é 1´ 5 + 2 ´ 3 ê úê ú=ê ë 3 4 ûë 3 û ë 3´ 5 + 4 ´ 3 2 ´ 2 2 ´1 • This forms a 2 x 1 matrix ù é 11 ù ú=ê ú û ë 27 û Remember • A linear equation with 2 variables is a line • E.g. 2x + 3y =12 2x + 3y =12 A linear equation with 3 variables is a plane. Solving problems using matrices • Scenario 1 • Two lines intersect at one point. There is a unique solution. • This means the system is independent and consistent with a unique solution. Solving problems using matrices • Two small jugs and one large jug can hold 8 cups of water. One large jug minus one small jug constitutes 2 cups of water. How many cups of water can each jug hold? Step 1: write down the equations • Two small jugs and one large jug can hold 8 cups of water. One large jug minus one small jug constitutes 2 cups of water. How many cups of water can each jug hold? • Let x = number of cups of water that the large jug holds • Let y = number of cups of water that the small jug holds Step 1: write down the equations • Two small jugs and one large jug can hold 8 cups of water. One large jug minus one small jug constitutes 2 cups of water. How many cups of water can each jug hold? x + 2y = 8 • Let x = number of cups of water that the small jug holds • Let y = number of cups of water that the large jug holds x-y=2 Step 2: Create the matrix x + 2y = 8 x-y=2 • Two small jugs and one large jug can hold 8 cups of water. One large jug minus one small jug constitutes 2 cups of water. How many cups of water can each jug hold? é 1 2 ê êë 1 -1 ù 8 ú 2 úû • Let x = number of cups of water that the small jug holds • Let y = number of cups of water that the large jug holds This is called the augmented matrix of the system x + 2y = 8 x-y=2 • Two small jugs and one large jug can hold 8 cups of water. One large jug minus one small jug constitutes 2 cups of water. How many cups of water can each jug hold? é 1 2 ê êë 1 -1 ù 8 ú 2 úû • Let x = number of cups of water that the small jug holds • Let y = number of cups of water that the large jug holds Step 2: Keep equation (1) and eliminate ‘x’ from (2) (1) ( 2) é 1 2 ê êë 1 -1 ù 8 ú 2 úû é 1 2 ê êë 0 -3 ù 1 ( ) 8 ú -6 úû ( 2 ) - (1) Step 3: Divide (2) by -3 é 1 2 ê êë 0 -3 é 1 2 ê êë 0 1 ù 1 ( ) 8 ú -6 úû ( 2 ) - (1) ù 1 ( ) 8 ú 2 úû ( 2 ) / - 3 The matrix is now in row echelon form é 1 2 ê êë 0 1 ù 8 ú 2 úû Using back substitution to solve: é 1 2 ê êë 0 1 y=2 x + 2y = 8 x=2 ù 8 ú 2 úû We could have done 1 more step é 1 2 ê êë 0 1 ù 8 ú 2 úû é 1 0 ê êë 0 1 ù 2 (1) - 2 ( 2 ) ú 2 úû ( 2) x=2 y=2 This is called reduced row echelon form é 1 0 ê êë 0 1 2 2 ù ú úû We have a unique solution (2, 2) • This means the system is independent and consistent with a unique solution. • Geometrically: The lines intersect at a unique point because the gradients are not the same. Example 2: • Solve the following equation: 3x - 4y = 2 x+y = 3 Write in matrix form: 3x - 4y = 2 x+y = 3 • Solve the following equation: é 1 1 ê êë 3 -4 ù 3 ú 2 úû é 1 the ù (1)equation: • Solve following 1 3 ê ú êë 3 -4 2 úû ( 2 ) é 1 1 ê êë 0 -7 é 1 1 ê êë 0 1 3 -7 ù (1) ú úû ( 2 ) - 3 (1) ù (1) 3 ú 1 úû ( 2 ) / - 7 • Solve the following equation: é 1 1 ê êë 0 1 ù 3 (1) ú 1 úû ( 2 ) é 1 0 ê êë 0 1 ù 2 (1) - ( 2 ) ú 1 úû ( 2 ) y =1 x=2 Solution is (1, 2) • This means the system is independent and consistent with a unique solution. Scenario 2 • The two lines don’t intersect because the lines are parallel. • The system is “independent and inconsistent and has no solution.” Example: • Solve the following x + 2y = 3 2x + 4y = 9 Write down the augmented matrix x + 2y = 3 2x + 4y = 9 é 1 2 ê êë 2 4 ù 3 ú 9 úû é 1 2 ê êë 2 4 ù 1 ( ) 3 ú 9 úû ( 2 ) é 1 2 ê êë 0 0 ù 1 ( ) 3 ú 3 úû ( 2 ) - 2 (1) The system is “independent and inconsistent and has no solution.” é 1 2 ê êë 2 4 ù 1 ( ) 3 ú 9 úû ( 2 ) é 1 2 ê êë 0 0 ù 1 ( ) 3 ú 3 úû ( 2 ) - 2 (1) The lines are parallel and hence there is no solution Scenario 3 Identical lines which intersect at an infinite number of points. The system is “dependent and consistent and has an infinite number of solutions.” Example: • Solve the following x + 2y = 3 2x + 4y = 6 Write down the augmented matrix x + 2y = 3 2x + 4y = 6 é 1 2 ê êë 2 4 ù 3 ú 6 úû é 1 2 ê êë 2 4 ù 1 ( ) 3 ú 6 úû ( 2 ) é 1 2 ê êë 0 0 ù 1 ( ) 3 ú 0 úû ( 2 ) - 2 (1) The system is “dependent and consistent and has infinite solutions.” é 1 2 ê êë 2 4 ù 1 ( ) 3 ú 6 úû ( 2 ) é 1 2 ê êë 0 0 ù 1 ( ) 3 ú 0 úû ( 2 ) - 2 (1) The lines are identical and hence there is an infinite number of solutions