0% found this document useful (0 votes)
9 views12 pages

Lec 22

This document discusses Cramer's Rule, which uses determinants to find solutions to systems of linear equations when the coefficient matrix is invertible. It provides an example of applying Cramer's Rule to a 2x2 system, then defines the general form of Cramer's Rule for nxn systems, replacing columns of the coefficient matrix with the constants vector to compute the determinant of each resulting matrix.

Uploaded by

themaker1602
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

Lec 22

This document discusses Cramer's Rule, which uses determinants to find solutions to systems of linear equations when the coefficient matrix is invertible. It provides an example of applying Cramer's Rule to a 2x2 system, then defines the general form of Cramer's Rule for nxn systems, replacing columns of the coefficient matrix with the constants vector to compute the determinant of each resulting matrix.

Uploaded by

themaker1602
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Mathematics for Data Science 2

Professor Sarang Sane


Department of Mathematics
Indian Institute of Technology Madras
Lecture 07
Cramer’s Rule
(Refer Slide Time: 0:15)

Hello and welcome to the Maths 2 component of the online BSC degree on Data Science.
In today's video we are going to look at Cramer's Rule which employs the determinant in
order to find the solutions of a system of linear equations, when the coefficient matrix is
invertible. Let us go on and do an example.
(Refer Slide Time: 0:42)

So, let us look at this linear system, 4𝑥1 − 3𝑥2 = 11 and 6𝑥1 + 5𝑥2 = 7. So, let us
recall what was the matrix representation. So, that is Ax = b, so the matrix A is given by
4 −3
the coefficients, [ ] and b is the constants on the right, so it is a column vector or
6 5
11 𝑥1
column matrix [ ] and x is the unknowns [ ]. So, this is easy to compute the solution,
7 𝑥2
it has a unique solution x1 is 2 and x2 is minus 1.

Let us quickly go through how, so we can multiply the first equation by 3 to get 12𝑥1 −
9𝑥2 = 33 , we can multiply the second one by 2 to get 12𝑥1 + 10𝑥2 = 14 and then we
subtract let us say the first one from the second one, so in that case we get 19𝑥2 = −19 ,
that tells us x2 = -1 and then we can substitute in one of these expressions and get x1= 2.
So, we can easily check that this is a unique solution. So, now let us do something slightly
different and reinterpret these using determinants.
(Refer Slide Time: 2:37)

So, here is the same example and here is how we will apply Cramer’s rule. So, we look at
the coefficient matrix A. Let us compute the determinant of A, so if we do that that 4𝑥5 −
(−3𝑥6 ) = 20 + 18 = 38. So, the determinant of A is 38.

(Refer Slide Time: 3:12)

So, replace the first column of A by the column vector b and we will call that matrix Ax1
because the first column are the coefficients corresponding to x1 in the two equations. So,
11 −3
Ax1 is [ ]. Replace the second column of A by the column vector b and call Ax2, so
7 5
we are doing the same thing for the second column.

So, now the first column is the same as the first column of A and the second column is
4 11
replaced by 11, 7 so we get [ ], let us calculate determinant of Ax1, so you can do
6 7
this, 11𝑥5 − (−3𝑥7) = 76 and then let us calculate the determinant of Ax2. So, if you do
that that is 4𝑥7 − 11𝑥6 = −38, so remember that the determinant of A was calculated to
be 38. So, let us keep this in mind 38, 76 and -38. So, now what do we do?

(Refer Slide Time: 4:49)

𝑑𝑒𝑡(𝐴𝑥1 ) 76 𝑑𝑒𝑡(𝐴𝑥2 ) −38


So Cramer's rule will say, let us calculate = 38 =2 and = 38 =-1 and these are
𝑑𝑒𝑡(𝐴) 𝑑𝑒𝑡(𝐴)

exactly the solutions of x1 and x2 respectively.


(Refer Slide Time: 5:23)

So, at least in this example we have this strange method using determinants and it gives us
the actual solutions.

(Refer Slide Time: 5:54)

So, let us study what is Cramer's rule in general, so this is for when the coefficient matrix
is an invertible matrix, so what do you mean by invertible? Invertible means that the inverse
exists. So, consider the following system of linear equations of 2 variables 𝑎11 𝑥1 +
𝑎11 𝑎12
𝑎12 𝑥2 = 𝑏1 , 𝑎21 𝑥1 + 𝑎22 𝑥2 . So, the matrix representation here is 𝐴 = [𝑎 𝑎22 ] , b =
21

𝑏
[ 1 ].
𝑏2

And the assumption here is that the matrix A is invertible, meaning its inverse exists and
because its inverse exists, remember that in the previous video with determinants we have
seen that determinant of A inverse is 1/𝑑𝑒𝑡(𝐴) which in particular means that determinant
of A is non-zero, so 1/𝑑𝑒𝑡(𝐴) exists. So, let us define these 2 matrices as in the previous
𝑏1 𝑎12 𝑎 𝑏1
example. Define 𝐴𝑥1 = [ ] and 𝐴𝑥2 = [ 11 ].
𝑏2 𝑎22 𝑎21 𝑏2

(Refer Slide Time: 7:31)

And then Cramer's rule says the solution of the system of equations and I am saying the
𝑑𝑒𝑡(𝐴𝑥1 )
which means it is a unique solution, in two variables, so x1 = , note that this division
𝑑𝑒𝑡(𝐴)
𝑑𝑒𝑡(𝐴𝑥2 )
makes sense because its invertible and x2 = , again makes sense and we know
𝑑𝑒𝑡(𝐴)

explicitly what these expressions are, for 2 × 2 matrices the determinant is easy to compute.

𝑏1 𝑎22 − 𝑎12 𝑏2 𝑏2 𝑎11 − 𝑎21 𝑏1


So 𝑥1 = , 𝑥2 = . So, that is the algorithm you have to follow
𝑎11 𝑎22 − 𝑎12 𝑎21 𝑎11 𝑎22 − 𝑎12 𝑎21

for Cramer's rule to find the solutions of a system of equations where the coefficient matrix
A has non-zero determinant.
(Refer Slide Time: 8:50)

We can make this more general, so let us see Cramer's rule for 3 × 3 matrices. So, again
here the coefficient matrix must be invertible, so the determinant of A must be non-zero
because we divide by the determinant. So, here is the system of linear equations in three
variables, so recall that its matrix representation is Ax = b, where A is the coefficient matrix
and b is this column vector of constants b1, b2, b3.
(Refer Slide Time: 9:29)

So, in that case what is Cramer's rule? So, we will have to define these new matrices 𝐴𝑥1 =
𝑏1 𝑎12 𝑎13 𝑎11 𝑏1 𝑎13 𝑎11 𝑎12 𝑏1
[𝑏2 𝑎22 𝑎23 ], 𝐴𝑥2 = [𝑎21 𝑏2 𝑎23 ], 𝐴𝑥3 = [𝑎21 𝑎22 𝑏2 ] And then how do we get
𝑏3 𝑎32 𝑎33 𝑎31 𝑏3 𝑎33 𝑎31 𝑎32 𝑏3
the solution?

So, the solution meaning again its unique of the system of equations that we get x1 =
𝑑𝑒𝑡(𝐴𝑥1 ) 𝑑𝑒𝑡(𝐴𝑥2 ) 𝑑𝑒𝑡(𝐴𝑥3 )
, x2 = , x3 = . Again, it is very important that the determinant here
𝑑𝑒𝑡(𝐴) 𝑑𝑒𝑡(𝐴) 𝑑𝑒𝑡(𝐴)

must be non-zero, otherwise of course, we cannot divide and assuming that A has an
inverse ensures this or explicitly we can say that determinant of A is non-zero.

So, how did we define these 𝐴𝑥1 , 𝐴𝑥2 and 𝐴𝑥3 ? So, in the first one the first column was
replaced, in the second one the second column was replaced and in the third one the third
column was replaced. So, these and the notations should tell you which columns are
replaced because x1 means the coefficients corresponding to x1 column which is replaced.
Similarly, for x2 and x3. So, this is Cramer's rule for 3 × 3 matrices or for a system of linear
equations in three variables, maybe let us do a quick example.

(Refer Slide Time: 11:23)


So, consider this system of equations where the coefficient matrix, so I am instead of
writing down the system I am writing down the coefficient matrix and the constants. So,
1 0 3
the coefficient matrix is 𝐴 = [0 2 5] and the constants are 0, 2 and 1 respectively for
4 3 1
the three equations. So, to use Cramer’s rule first let us look at the determinant.

So, the determinant of A, so we will have to compute this, so the determinant is -37, so I
encourage you to compute this. So, since it is non-zero we can apply Cramer’s rule. So, let
us follow the next steps in the procedure for Cramer's rule. So, we have to compute these
matrices 𝐴𝑥1 , 𝐴𝑥2 and 𝐴𝑥3 . So, how do we compute these matrices? We replace the
corresponding columns by the column b.

Then we compute their determinants, so the determinant of det(𝐴𝑥1 ) = 12, you can check
this. So, here we have first row has two 0s, so this is an easy computation similarly, for
det(𝐴𝑥2 ) = - 27 and det(𝐴𝑥3 ) = -4.

(Refer Slide Time: 13:24)


And then by Cramer's rule we get that the solution to this system of equations is x1 = -
12/37, x2= 27/37 and x3 = 4/37. So, I will encourage you to substitute these x1, x2 , x3 and
check that indeed this is the solution and you can, you know do a usual method of solving
equations and check that indeed this is the solution.

(Refer Slide Time: 13:57)

So, finally let us end with Cramer's rule for the n × n system, so now if you have n equations
in a system with n unknowns. So, remember here that we should have, the coefficient
matrix has to be square first of all, so we need n equations in n unknowns, this will not
work otherwise and the second thing we need here is that the coefficient matrix is invertible
or that the determinant is non-zero.

So, this is the general system of equations, A is the coefficient matrix and b is the column
vector containing b1, b2, .., bn, then you define Axi and how do we obtain this? We obtain
this by for the ith column you replace it by the column vector b. So, if you do that then you
compute its determinant and then the solution to the system of linear equations.

𝑑𝑒𝑡(𝐴𝑥1 )
So, Cramer's rule states that xi = det(Axi)/det(A), so we compute for each i. So, x1 = ,
𝑑𝑒𝑡(𝐴)
𝑑𝑒𝑡(𝐴𝑥2 ) 𝑑𝑒𝑡(𝐴𝑥3 )
x2 = , x3 = . So, in Cramer's rule remember that we need, this is very
𝑑𝑒𝑡(𝐴) 𝑑𝑒𝑡(𝐴)

important n equations in n unknowns, that is when we can apply it and further we need that
the determinant of the coefficient matrix A is non-zero and then we can explicitly work out
what the solution is. Thank you.

You might also like