1 00:00:04,960 --> 00:00:08,110 One of the most important applications of matrices is to 2 00:00:08,110 --> 00:00:11,575 finding the solution of a pair of simultaneous equations. So in 3 00:00:11,575 --> 00:00:15,985 this video I'm going to show you how we can use matrices to do 4 00:00:15,985 --> 00:00:19,135 just that. Let's look at this pair of simultaneous equations 5 00:00:19,135 --> 00:00:23,545 here. X + 2 is four and three X -- 5 Y is 1. 6 00:00:24,450 --> 00:00:27,460 Provided you understand how matrices are multiplied 7 00:00:27,460 --> 00:00:32,190 together, you will be able to write these equations in what's 8 00:00:32,190 --> 00:00:34,340 called matrix form. I'll show 9 00:00:34,340 --> 00:00:41,236 you how. Supposing we write down the Matrix 1, two, 3 -- 5, and 10 00:00:41,236 --> 00:00:47,508 we multiply it by another matrix XY. Let's just see how we can do 11 00:00:47,508 --> 00:00:53,444 that. So we have a two by two matrix here and I formed it from 12 00:00:53,444 --> 00:00:57,305 the coefficients of X&Y in the simultaneous equations 1, two, 3 13 00:00:57,305 --> 00:01:03,411 -- 5. I've written this matrix here X&Y, which was which, 14 00:01:03,411 --> 00:01:06,006 contains the unknowns in the 15 00:01:06,006 --> 00:01:09,862 simultaneous equations. Now, provided you can understand how 16 00:01:09,862 --> 00:01:13,282 to do matrix multiplication, you realize that these can be 17 00:01:13,282 --> 00:01:16,702 multiplied together as follows. You pair the Elements 1, two 18 00:01:16,702 --> 00:01:20,464 with XY and multiply the paired elements together and then add. 19 00:01:21,130 --> 00:01:22,720 So it's 1 * X. 20 00:01:23,640 --> 00:01:29,928 Which is X added to 2 * y which is 2 Y. 21 00:01:29,930 --> 00:01:34,610 And you'll notice that X + 2 Y is the same as the quantity on 22 00:01:34,610 --> 00:01:36,794 the left hand side of the first 23 00:01:36,794 --> 00:01:41,762 equation. If we look at this second row here and multiply it 24 00:01:41,762 --> 00:01:47,248 by the X and the Y 3 * X -- 5 * y. 25 00:01:47,770 --> 00:01:49,174 And you'll see what we have 26 00:01:49,174 --> 00:01:52,953 here. Is the left hand side of the second equation in the 27 00:01:52,953 --> 00:01:57,874 simultaneous equations? And then we can write. This lot is equal 28 00:01:57,874 --> 00:02:03,022 to 4, one which is a matrix formed by the right hand side 29 00:02:03,022 --> 00:02:04,606 numbers in the simultaneous 30 00:02:04,606 --> 00:02:07,562 equations. So you've really got the simultaneous equations 31 00:02:07,562 --> 00:02:12,254 written down. In here you got X + 2 Y's four and three X -- 5 Y 32 00:02:12,254 --> 00:02:17,496 is 1. So these are the original simultaneous equations, but in 33 00:02:17,496 --> 00:02:19,980 matrix form. If we call this 34 00:02:19,980 --> 00:02:24,389 matrix A. And this matrix of unknowns. Let's call 35 00:02:24,389 --> 00:02:25,910 that capital X. 36 00:02:26,940 --> 00:02:30,792 And this matrix on the right hand side. Let's call that B. 37 00:02:31,330 --> 00:02:38,218 This form now have here is what we call the matrix form 38 00:02:38,218 --> 00:02:40,514 of the simultaneous equations. 39 00:02:40,520 --> 00:02:44,888 Let's think about which bits in this in this in this matrix 40 00:02:44,888 --> 00:02:49,256 form. We know which bits we don't know. Well, the matrix A1, 41 00:02:49,256 --> 00:02:53,988 two 3 -- 5 is known. It's just the matrix of coefficients of 42 00:02:53,988 --> 00:02:58,356 X&Y in the original equations, the matrix be on the right is 43 00:02:58,356 --> 00:03:02,724 this 141, which is just the matrix formed by the right hand 44 00:03:02,724 --> 00:03:04,180 side of the simultaneous 45 00:03:04,180 --> 00:03:07,912 equations. This quantity, capital X. This matrix here, 46 00:03:07,912 --> 00:03:11,672 which stands for little X little. Y that's the unknown. 47 00:03:11,672 --> 00:03:15,808 That's the thing we're trying to find, so this is the 48 00:03:15,808 --> 00:03:16,936 matrix of unknowns. 49 00:03:18,130 --> 00:03:21,718 So what we'd like to do is, like, we'd like to rearrange 50 00:03:21,718 --> 00:03:24,708 this and get X equal to something, because then we've 51 00:03:24,708 --> 00:03:27,100 got the solution of the simultaneous equations. We've 52 00:03:27,100 --> 00:03:31,286 got the unknown on its on its own on the left hand side. Now 53 00:03:31,286 --> 00:03:34,874 we can find this unknown matrix X the matrix of unknowns using 54 00:03:34,874 --> 00:03:37,864 the inverse matrix. Let's see how we can do that. 55 00:03:38,710 --> 00:03:42,961 So this is the matrix equation we want to solve. Now you might 56 00:03:42,961 --> 00:03:48,520 be tempted to say if you want to find X, then X is B / A, but 57 00:03:48,520 --> 00:03:51,790 remember there's no such thing as matrix division. You can't 58 00:03:51,790 --> 00:03:56,368 divide matrix be by a matrix A and instead we make use of the 59 00:03:56,368 --> 00:04:00,292 inverse matrix. What we'll do is we'll take this matrix form and 60 00:04:00,292 --> 00:04:04,870 we multiply both sides of it by the inverse of matrix A. So I'm 61 00:04:04,870 --> 00:04:09,121 going to take the left hand side and multiply it by the inverse. 62 00:04:09,130 --> 00:04:14,077 Of a. And do the same to the right hand side. 63 00:04:14,360 --> 00:04:17,844 So both sides of this equation have been multiplied by 8 to the 64 00:04:17,844 --> 00:04:21,642 minus one. Now remember a very important property of inverse 65 00:04:21,642 --> 00:04:26,178 matrices is that when you take A to the minus one and multiply it 66 00:04:26,178 --> 00:04:27,798 by a, the result here. 67 00:04:28,350 --> 00:04:33,486 Is an identity matrix, so ETA minus one A is an identity 68 00:04:33,486 --> 00:04:39,050 matrix, so even identity matrix times X is A to the minus 1B. 69 00:04:39,130 --> 00:04:42,529 And further property that you'll need to remember, which is very 70 00:04:42,529 --> 00:04:46,546 important, is that if you take any matrix X and you multiply it 71 00:04:46,546 --> 00:04:50,254 by an identity matrix, it leaves it identical to what it was 72 00:04:50,254 --> 00:04:53,653 before, so the left hand side just simplifies this simply to 73 00:04:53,653 --> 00:04:58,860 X. So we've come to the conclusion that if a X is B, 74 00:04:58,860 --> 00:05:04,935 then the unknown X is the inverse of a * B. So this is the 75 00:05:04,935 --> 00:05:06,960 important result that will need 76 00:05:06,960 --> 00:05:10,282 to use. To solve a pair of simultaneous equations, what 77 00:05:10,282 --> 00:05:14,050 will need to do is find the inverse of the matrix of 78 00:05:14,050 --> 00:05:17,190 coefficients and multiply that by the matrix formed by the 79 00:05:17,190 --> 00:05:20,644 elements by the numbers on the right hand side of the 80 00:05:20,644 --> 00:05:24,098 simultaneous equations. So this is the formula will need will do 81 00:05:24,098 --> 00:05:25,668 that in an example now. 82 00:05:26,710 --> 00:05:29,572 So let's continue with this example. Here are the 83 00:05:29,572 --> 00:05:32,434 simultaneous equations that we started with, and we've written 84 00:05:32,434 --> 00:05:36,568 them in matrix form like this. That's in the form ax is B. 85 00:05:36,568 --> 00:05:38,476 Well, this is the matrix. A 86 00:05:38,476 --> 00:05:42,170 matrix of coefficients. This is the matrix Capital X, the matrix 87 00:05:42,170 --> 00:05:45,615 of unknowns and B is the matrix formed by the elements on the 88 00:05:45,615 --> 00:05:51,430 right hand side. What we need to do to solve this is we need to 89 00:05:51,430 --> 00:05:55,810 find the inverse of a. So let's start by writing down the 90 00:05:55,810 --> 00:05:59,825 inverse of this matrix here. Now remember that the formula for 91 00:05:59,825 --> 00:06:04,205 the inverse matrix is as follows. 1 / a D minus BC. 92 00:06:04,205 --> 00:06:08,585 That's 1 * -- 5, which is minus 5. Subtract VC's 2346. 93 00:06:09,330 --> 00:06:13,922 We interchange the A and the D. So minus five will go up there 94 00:06:13,922 --> 00:06:18,514 and one will go down there and we change the sign of the other 95 00:06:18,514 --> 00:06:22,122 two elements. So this is the inverse of the matrix A. 96 00:06:23,110 --> 00:06:28,750 Let's just tidy it up a little bit, minus 5 -- 6 is minus 11, 97 00:06:28,750 --> 00:06:31,006 so we've got minus and 11th. 98 00:06:31,520 --> 00:06:35,584 Of the matrix minus 5 -- 2 -- 3 and one and I'm going to leave 99 00:06:35,584 --> 00:06:39,140 it in that form. I don't need to worry about taking the factor of 100 00:06:39,140 --> 00:06:40,410 minus 1 / 11 inside. 101 00:06:41,040 --> 00:06:46,094 Right, what we want to do now is find the matrix of unknowns X, 102 00:06:46,094 --> 00:06:51,148 and remember that X is given by A to the minus 1 * B. 103 00:06:51,790 --> 00:06:55,470 Eight of the minus one is now minus and 11th. 104 00:06:55,980 --> 00:07:02,740 Times minus 5 -- 2 -- 3 one multiplied by 105 00:07:02,740 --> 00:07:06,120 matrix B which was four 106 00:07:06,120 --> 00:07:11,810 one. And you'll see that all we need to do now to finish this 107 00:07:11,810 --> 00:07:15,230 off is debit of matrix multiplication. Let's leave the 108 00:07:15,230 --> 00:07:16,370 minus 11 outside. 109 00:07:16,930 --> 00:07:23,080 And over here we've got minus 5 * 4, which is minus 20 added to 110 00:07:23,080 --> 00:07:28,410 minus 2 * 1. That's added to minus two, so you've got minus 111 00:07:28,410 --> 00:07:33,100 22 there. And here pairing up this road with this column we've 112 00:07:33,100 --> 00:07:38,108 got minus 3 * 4 is minus 12 added to 1 * 1, which is minus 113 00:07:38,108 --> 00:07:40,299 12 model on which is minus 11. 114 00:07:41,270 --> 00:07:45,480 Finally, just to finish this off, every element inside the 115 00:07:45,480 --> 00:07:50,953 matrix has to be multiplied by minus in 11th or in other words 116 00:07:50,953 --> 00:07:56,426 divided by minus 11. And if we do that, this first entry will 117 00:07:56,426 --> 00:08:00,215 be minus 22 / -- 11, which is 2. 118 00:08:00,810 --> 00:08:06,564 And the second element is minus 11 / -- 11, which is 1. So 119 00:08:06,564 --> 00:08:11,085 that's the solution. This is the matrix X, which you'll remember 120 00:08:11,085 --> 00:08:16,839 is the same as the matrix XY. This means that our little X is 121 00:08:16,839 --> 00:08:21,771 2 and our little wise one, and that's the solution of the 122 00:08:21,771 --> 00:08:24,615 simultaneous equations. Those are the solutions of the two 123 00:08:24,615 --> 00:08:26,040 equations that we started with. 124 00:08:27,190 --> 00:08:30,271 Rather than just leave it there like that, what you ought to do 125 00:08:30,271 --> 00:08:33,115 to do is check that this solution is in fact correct by 126 00:08:33,115 --> 00:08:35,959 substituting X is too. And why is 1 into these equations just 127 00:08:35,959 --> 00:08:38,566 to check it's right. So for example, if you protect this 128 00:08:38,566 --> 00:08:41,884 two in here, you'll get two and two ones are two there, two and 129 00:08:41,884 --> 00:08:44,491 two is 4, so it satisfies the first equation. You should 130 00:08:44,491 --> 00:08:46,624 check that it satisfies the second equation as well.