Now in this video we're going to go over Kramer's rule and we're going to apply it to solve a system of equations with two variables and three variables. So let's start with a two variable system. So let's say if we have the two equations a1x plus B1Y, let's say that's equal to C1, and also A2X plus B2Y is equal to C2. So to calculate the value of X, X is going to be DX divided by D, where D is the determinant of a 2 by 2 matrix, and Y is equal to DY.
Divided by D So how do we find D DX and dy what do we need to do? to calculate it the determinant D is going to be a 1 a 2 B 1 B 2 And to find the answer, it's going to be a1 times b2 minus a2 times b1. That's how you can find the determinant D. Now, to get dx, replace the coefficients of x.
with c1 and c2 so it's going to be c1 c2 and then b1 b2 which is equal to c2 b1 minus b2 c1 so it's c2 b1 minus b2 c1 that's how you calculate dx To calculate dy, we need to replace the coefficients of y with c1, c2. So c1 and c2 has to be in the place of y, which is the right side. And then a1, a2 is going to be in the place of x, which is the left side.
So for dy, replace the coefficients of y with c1, c2, and make sure it goes on the right side. Now, dy is equal to a1, c2 minus a2, c1. Now let's try some examples.
So let's say if we have the equation 2x plus 3y is equal to 13. And also 3x minus 5y is equal to negative 9. So let's calculate dx, dy, and d. But let's start with d first. So to write the 2x2 matrix for D is simply going to be the coefficients that you see on the left. It's 2, 3, 3, negative 5. And to find the determinant of this 2x2 matrix, it's 2 times negative 5. minus 3 times 3. 2 times negative 5 is negative 10. 3 times 3 is 9. Negative 10 minus 9 is negative 19. So, D is equal to negative 19. Now that we have D, let's calculate DX.
So, first, we need to write the 2 by 2 matrix for DX. So this is going to be the coefficients for x and y. But to find dx, replace the coefficients of x with c1 and c2.
So this is going to be 13 and negative 9. And then the coefficients of y are 3 and negative 5. So the determinant is going to be 13 times... negative 5 so just this part right there and then minus negative 9 times 3 13 times negative 5 is negative 65 negative 3 times negative 9 is positive 27 so if you add these two numbers you should get negative 38 so DX is equal to negative 38 now we need to calculate dy Dy is equal to So this is going to be x, this is y. This time we're going to replace the coefficients of y with c1 and c2. So this is going to be 13, negative 9, and the coefficients of x are 2 and 3. So it's going to be 2 times negative 9. So 2 times negative 9 is negative 18, and 3 times 13 is negative 39. So negative 18 minus 39 is equal to negative 57. So now we have all three, dx, dy, and d. So we can calculate x and y at this point.
So x is dx over d, which is negative 38 divided by negative 19. So x is positive 2. y is equal to dy divided by d, which is negative 57 divided by negative 19, and that's equal to positive 3. So now that we have the value of x and y, which is 2, 3, let's see if it works in the solution. Let's see if the answers are correct. So let's plug in 2 and 3 into the equation.
So it's going to be 2 times 2. plus 3 times the value of y. And let's see if that's equal to 13. 2 times 2 is 4. 3 times 3 is 9. And 4 plus 9 is 13. So 13 equals 13. This is... is a solution to the equation.
Now let's try the other equation. Let's make sure that it works as well. So 3 times 2 minus 5 times 3, is that equal to negative 9? 3 times 2 is 6, 5 times 3 is 15, 6 minus 15 is negative 9. So therefore, this is the right answer. X is 2, Y is 3. Now, let's say if we have another equation.
2x minus 7y, and let's say that's equal to 1. And 3x plus y, and let's say that's equal to 13. So, go ahead and use Cramer's Rule to solve for x and y. Feel free to pause the video and work out this practice problem. So, let's calculate the determinant first. which is going to be the coefficients of x and y.
So on the left, we're going to put the coefficients for x, and on the right, we're going to put the coefficients for y. So it's 2, 3, negative 7, 1. So there's an invisible 1 that you don't see here if it's simply y. So it's going to be 2 times 1, minus, minus, 3 times negative 7. 2 times 1 is 2. Negative 3 times negative 7 is positive 21. So therefore, we can say that the determinant is 21 plus 2, which is 23. Now let's calculate dx. So the determinant for dx... as a 2x2 matrix, we're going to set it up in a similar way.
So the y coefficients are negative 7 and 1, but instead of writing the coefficients for x, if you're looking for dx, replace those coefficients with c1 and c2. So this is going to be 1 and 13. So, 1 times 1 is simply 1 minus 13 times negative 7. Negative 13 times negative 7 is positive 91, so it's 1 plus 91. Therefore, dx is equal to 92. Now let's calculate dy. So this is for x, this is for y. So x is going to be 2 and 3. And the column for y, we're going to replace the coefficients with c1 and c2. So it's going to be 1 and 13. 2 times 13. minus 3 times 1 is basically 26 minus 3 so therefore dy is equal to 23 so now that we have DX dy and D we can calculate the values for x and y So let's start with x.
We know that x is going to be dx divided by d. So that's 92 divided by 23, which is equal to 4. Now for y, y is going to be dy over d, which is 23 divided by 23. So y is equal to 1. So we have the solution 4,1. Now, just to make sure that it's correct, let's test it to see if it's going to work with the two equations that we have. So let's plug in 4 and 1. So x is 4, y is 1, and let's see if that's going to be equal to 1. 2 times 4 is 8, 7 times 1 is 7, and 8 minus 7 is indeed equal to 1. So it works for the first equation.
Now let's test drive the second one. So it's going to be 3 times 4 plus 1, and 3 times 4 is 12. 12 plus 1 is 13. So this is the correct answer to the problem. Now, how can we use Kramer's rule to solve a three-variable system? So let's say if we have the function a1x plus...
B1Y plus C1Z and let's say that's equal to D1. And so this is going to be A2, A3, B2, B3, C2, C3, D2, D3. This is going to be X. Y and Z. So if you want to calculate the determinant D, it's going to be simply A1, A2, A3.
It's basically the coefficients of everything you see on the left. So then it's going to be b1, b2, b3, and then c1, c2, c3. Now we'll talk about how to determine the value or the determinant of a 3x3 matrix later.
But let's just talk about how to set it up first. So now dx, how can we set up the 3x3 matrix for dx? So the first column is associated with x, the second column is associated with y, and the third column is associated with z.
So if you want to find dx, replace the coefficients of x with the stuff that's across the equal sign, d1, d2, d3. So it's going to look like this, d1, d2, d3, and then b1, b2, b3. And then after that, C1, C2, C3.
So that's how you can set up the 3x3 matrix for dx. Now what about for dy? So for dy, we have the x, the y, and the z column.
So this time, we're going to replace the coefficients of y with d1, d2, and d3. So this is going to be in the middle. And then on the left, the coefficients of x are going to be in the middle.
are going to remain the same. And on the right side, we're going to have C1, C2, C3. So that's how you set up the three by three matrix for dy.
Now what about dz? So at this point, you can see a pattern. So for dz, this is going to be x, y, and z. This time, we're going to replace the coefficients of z with d1, d2, d3.
So let's put that first. So that's going to be over here, d1, d2, d3. And then everything else is going to be the same. The coefficients of x are a1, a2, a3, and the coefficients of y. being 1 B 2 and B 3 Now the next thing that we need to talk about is how to solve a 3x3 matrix, how to calculate the determinant for it.
So let's say this is A1, A2, and A3. And if this is B1, B2, and B3. And if we have C1, C2, and C3. What we need to do is break down the 3x3 matrix into three smaller 2x2 matrix. So this is going to be equal to, we're going to have three smaller ones.
The middle one is going to be negative. So for the first one, eliminate A1. It's in the first row and the first column, so we're going to put that here.
Now, eliminate row 1 and column 1, and what you have left over, B2, B3, C2, C3, that's going to go in the first 2x2 matrix. Now for the next one, we're going to use B1. That's going to be in front of the second matrix. And eliminate the row and the column that intersects B1. So we're going to eliminate row 1 and column 2. And so A2, A3, and C2, C3 are going to go in the next matrix.
So it's A2, A3, C2, C3. Now for the last matrix, we need to get rid of C1. So eliminate the row and the column associated with C1.
So it's going to be what's left over. A2, A3, B2, B3. And you know how to find the determinant for a 2x2 matrix.
So for example, the first one is going to be A1 and then times B2 times C3. minus b3 times c2 and then just repeat the process so for the second one it's going to be negative b1 and then times a2c3 minus a3c2 And for the last one, it's going to be plus C1 times A2B3, and then minus B2A3. Now let's work on an example.
So let's say if we have a system of three equations. 3x minus 2y plus 1z is equal to 2. And 4x plus 3y. minus 2z is equal to 4 and finally 5x minus 3y plus 3z is equal to 8. So let's find d, dx, dy, and dz. So let's start with d.
Actually, let's put it here. So we have x, y, and z. The coefficients for x are 3, 4, and 5. And the coefficients for y are negative 2. and negative 3 and for Z it's a 1 negative 2 and 3 so now we'll need to evaluate the determinant for that 3 by 3 matrix so it's going to be the first one 3 and eliminate everything the row and column that's part of 3 so inside the 2 by 2 matrix is going to be 3, negative 3, negative 2 and 3 so first we're going to have the 3 in the front and then it's going to be 3 negative 3 negative 2 3 and then it's minus now we need to eliminate negative 2 so we're going to get rid of the row and the column that intersects that negative 2 so once we eliminate negative 2 and the row and the column associated with it four five and negative 2 3 has to go in the the 2x2 matrix so it's four five negative 23 and then plus the last one which is one and then if we eliminate the role and a column attached to one we have left over is 45 and three negative three So now let's find the determinant of each of the 2x2 matrices.
So let's start with the first one. So it's going to be 3 times 3, which is 9. And then minus negative 3 times negative 2, which is positive 6. And then negative times negative 2 is plus 2. And then what we have here is 4 times 3. which is 12 minus 5 times negative 2 which is negative 10 and then plus 1 times 4 times negative 3 which is negative 12 minus 5 times 3 which is 15 so 9 minus 6 is 3 and 3 times the 3 on the outside is equal to 9 12 minus negative 10 is the same as 12 plus 10 which is 22 times 2 that's 44 and negative 12 minus 15 is negative 27 so we have 9 plus 44 which is 53 minus 27 and that's 26 so D is equal to 26 Now, we need to calculate dx. So, let's write the appropriate matrix for it.
So, this is the column for x, y, and z. So, we need to replace the coefficients for x, the 3, 4, 5, with d1, d2, d3. So, that's going to be 2, 4, 8. And then the coefficients of y will remain the same.
So that's negative 2, 3, and negative 3. And the coefficients of z will also remain the same. So 1, negative 2, and positive 3. So now, let's break down the 3x3 matrix into three smaller matrices. So let's get rid of the 2. So it's going to be 2, and then times, and then minus the negative 2. and then times another matrix plus positive one and time something so once we get rid of the two we need to eliminate the row and the column that intersects it too so we're going to have in the first matrix is 3 negative 3 negative 23 Now, for the second one, we need to get rid of the negative 2. So, it's going to be 4, 8, negative 2, 3. Now for the last one, let's get rid of the 1. So let's eliminate row 1 and column 3. So what we have left over is 4, 8, and 3, negative 3. So let's evaluate the determinant.
So it's going to be 2. and then times 3 times 3, which is 9, minus negative 3 times negative 2, which is positive 6, and then plus 2, times... times 4 times 3 which is 12 minus 8 times negative 2 which is negative 16 plus 1 times 4 times negative 3 which is negative 12 minus 8 times 3 which is 24 so 9 minus 6 is 2 I mean 9 minus 6 is 3 not 2 but 3 times 2 is 6 12 minus negative 16 is the same as 12 plus 16 so this is 28 times 2 that's positive 56 and negative 12 minus is negative 36 so 56 minus 36 is 20 plus 6 that's 26 so DX is 26 now we need to calculate dy So dy is going to be, let's make this a little bit bigger. So this is x, y, and z.
So this time we need to replace the coefficients of y with d1, d2, and d3. So in the second column we're going to... have two four eight the first column is going to remain the same that's a three four five and the last column is going to stay one negative two and three so let's Let's rewrite it.
Starting with the first one, we have a 3, and then times the 2x2 matrix, and then minus the second one which is a 2, times another 2x2 matrix, and then plus the last one which is a 1, times something. So once we eliminate the 3. what we have left over is 48 negative 23 now once we eliminate the two we're going to have left over is 45 negative 23 And finally, if we get rid of the 1, what's left over is 4, 5, 4, 8. So it's going to be 3 and then times 4 times 3 is 12 minus 8 times negative 2 which is negative 16. And then it's minus 2 times 4 times 3 which is 12 again. and 5 times negative 2 which is negative 10 but it's minus negative 10 and then plus 1 times 4 times 8 which is 32 minus 5 times 4 which is 20 So let's go ahead and calculate this result. So 12 minus negative 16 is 12 plus 16, which is 28, and 28 times 3 is 84. minus negative 10 that's 12 plus 10 which is 22 times negative 2 that's going to be 44 negative 44 and then 32 minus 20 is positive 12 so 84 minus 44 is 40 plus 12 is 52 So, dy is equal to 52. So now, the last thing that we need to find is dx.
I mean, dz. So dz is going to be, so this is x, y, z. So we need to replace the coefficients for z with 2, 4, 8. Everything else is going to stay the same.
So now let's expand it. So it's 3, negative 2, 2. So let's start with 3 first. And then we'll have the 2 by 2 matrix minus negative 2. then plus positive 2 times another matrix So let's eliminate the 3 we have left over is 3 negative 3 4 8 Now let's get rid of the negative 2. So what we have is 4, 5, 4, 8. And finally, let's get rid of positive 2. So it's going to be 4, 5, 3, negative 3. So let's make some space. Let's get rid of this.
We don't need that anymore. And now let's find dz. So it's going to be 3 times...
3 times 8, which is 24, minus negative 3 times 4, which is negative 12, and then negative times negative 2 is positive 2. by 4 times 8 which is 32 and then minus 5 times 4 which is 20 this is a very long process and then plus 2 times 4 times negative 3 which is negative 12 minus 3 times 5 which is 15 all right so we're almost done 12 minus negative 12 that's I mean 24 minus negative 12 that's 24 plus 12 which is 36 and 3 times 36 is 108 if you make one mistake the entire problem is gone so you have to be careful with every step 32 minus 20 is 12 times 2 that's going to be 24 and negative 12 minus minus 15 is negative 27 times 2, which is negative 54. So 108 plus 24 is 132, minus 54 gives you 78. So, that's DZ. Now that we have dx, dy, dz, and d, we can now find the values of x, y, and z. So x is equal to dx divided by d, and that's going to be basically 26 divided by 26. So x is equal to 1. So let's put that as an ordered pair. Now let's move on to y. So y is dy divided by d.
And dy is equal to 52. d is 26. 52 divided by 26 is 2. So y is equal to 2 now let's calculate z So z is dz divided by D And dz is 78, d is 26, 78 divided by 26 is exactly 3, which means that z is 3. So now that we have... X, Y, and Z, which is 1, 2, and 3. Let's check it to make sure that the answer that we have is indeed the right one. Now the fact that we have whole number answers, chances are it's probably correct, but let's make sure so let's plug in x is 1 y is 2 and z is 3 let's see if that's equal to positive 2 so 3 times 1 is 3 2 times 2 is 4 and 3 minus 4 is negative 1 negative 1 plus 3 is indeed equal to 2 so therefore it works for the first equation now let's see if the solution works for the second equation so it's going to be 4 times 2 I mean times 1 X is 1 not 2 plus 3 times 2 Y is 2 and then Z is 3 so let's see if that's equivalent to 4 4 times 1 is 4 3 times 2 is 6 2 times 3 is 6 so 6 minus 6 is 0 they cancel and therefore 4 equals 4 so it works for the second second one. So everything's looking good right now and let's try the last one.
So it's 5 times 1 minus 3 times 2 plus 3 times 3. Let's see if that's equal to 8. So 5 times 1 is 5, 3 times 2 is 6, 3 times 3 is 9, and 5 minus 6 is negative 1, and negative 1 plus 9 is the same as 9 minus 1 which is 8. So 8 equals 8 the third equation works so now you know how to solve a system of equations with two variables and with three variables used in Kramer's rule so at this point you just got a go to your textbook and practice this technique and just know how to do it now granted you can just solve the system using the substitution method or the elimination method which I do have a video on that by the way you can check that out on YouTube but sometimes your teacher may want you to use Kramer's rule and you just got to do it this way it's very long but it's a method of patience