Section 4.3

Computation of determinants and Cramer's Rule

>

>

Introduction

- To compute the determinant of a n x n matrix using the cofactor expansion requires roughly n! operations.

(n! = 1 * 2 * 3 . . . * n).

- Consider a 25 x 25 matrix. This would require 25! operations or roughly operations.

- Suppose you have a super computer that can do 1 trillion operations per second. This calculation

would require 500,000 years!!

How do you find the determinant of 25 x 25 matrix?

Computation of a Determinant

********************************************************************

Computation of a determinant of a n x n matrix A:

1.) Reduce A to an echelon form, using only row additions and row interchanges.

2.) If any of the matrices appearing in the reduction contains a row of zeros, then det(A) = 0.

3.) Otherwise,

det(A) = (Product of pivots)

where r is the number of row interchanges performed.

**********************************************************************

ROW OPERATIONS

*******************************************************

Property 2 : If two different rows of a square matrix A are interchanged,

the determinant of the resulting matrix is -det(A).

*******************************************************

*******************************************************

Property 4 : If a single row of a square matrix A is multiplied by a scalar r,

the determinant of the resulting matrix is r* det(A).

*******************************************************

*******************************************************

Property 5 : If the product of one row of a square matrix A by a scalar is

added to a different row of A, the determinant of the resulting

matrix is the same as the det(A).

*******************************************************

Example 1:

>

> A := matrix([[2,5,7],[6,4,2],[8,4,1]]);

> `det(A)` = A[1,1]*A[2,2]*A[3,3];

>

Example 2:

>

> A := matrix([[1,-3,1,-2],[2,-5,-1,-2],[0,-4,5,1],[-3,10,-6,5]]);

>

Row reducing and then computing the determinant requires roughly operations.

Consider a 25 x 25 matrix. This would require = 10,500 operations. Less than

1 second to compute.

Cramer's Rule

Cramer's Rule for solving Systems of Linear Equations

Cramer's rule is a method, based on determinants, for solving a system of linear equations.

The system must be a square system and the coefficient matrix must be nonsingular;

that is; its determinant is nonzero.

Example 3: Consider the system

>

> x-3*y+4*z=2;
-x-4*y+3*z=-2;
2*x-5*y+6*z= 5;

>

The coefficient matrix is:

> C:=matrix([[1,-3,4],[-1,-4,3],[2,-5,6]]);

>

Right hand side is,

> b := matrix([[2],[-2],[5]]);

>

> evalm(C) * matrix(3,1,[x,y,z]) = evalm(b);

Construct the matrix obtained from matrix C by replacing the first column of C

with the right side of the system:

> A1:=matrix([[2,-3,4],[-2,-4,3],[5,-5,6]]);

Find the value of x

> x=det(A1)/det(C);

Construct the matrix obtained from matrix C by replacing the second column of C

with the right side of the system:

> A2:=matrix([[1,2,4],[-1,-2,3],[2,5,6]]);

Find the value of y

> y=det(A2)/det(C);

Construct the matrix obtained from matrix C by replacing the third column of C

with the right side of the system:

> A3:=matrix([[1,-3,2],[-1,-4,-2],[2,-5,5]]);

Find the value of z

> z=det(A3)/det(C);

Note that the solution coincides with the solution obtained using

> solve({x-3*y+4*z=2,-x-4*y+3*z=-2,
2*x-5*y+6*z= 5},{x,y,z});

>

***********************************************************************

The steps for finding the adjoint matrix of A.

1. Find the cofactor of each entry of the matrix A. The cofactor of an entry is defined as:

= *det( )

where the submatrix is the minor of the entry .

2. Replace each entry of matrix A by its cofactor to get a new matrix C. This matrix is

called the cofactor matrix .

3. The transpose of matrix C is called the adjoint matrix of A and is denoted by Adj(A).

***********************************************************************

Example 4: Find the adjoint of the matrix

> A:=matrix([[1,3,5],[5,3,6],[8,4,2]]);

The minors of all of the entries are respectively given by

> M11:=minor(A,1,1);
M12:=minor(A,1,2);
M13:=minor(A,1,3);

> M21:=minor(A,2,1);
M22:=minor(A,2,2);
M23:=minor(A,2,3);

> M31:=minor(A,3,1);
M32:=minor(A,3,2);
M33:=minor(A,3,3);

The cofactor of the each entry is *det( );

> C11:=(-1)^2*det(M11);
C12:=(-1)^3*det(M12);
C13:=(-1)^4*det(M13);

> C21:=(-1)^3*det(M21);
C22:=(-1)^4*det(M22);
C23:=(-1)^5*det(M23);

> C31:=(-1)^4*det(M31);
C32:=(-1)^5*det(M32);
C33:=(-1)^6*det(M33);

The cofactor matrix is,

>

> C := matrix([[C11,C12,C13],[C21,C22,C23],[C31,C32,C33]]);

>

>

>

*****************************************************

Result:

Let A=[ ] be an n x n matrix. If = *det( ) denotes the

cofactor for then

+ . . . + = det(A) if k = i

= 0 if

*****************************************************

Example 5:

>

> A:=matrix([[a11,a12,a13],[a21,a22,a23],[a31,a32,a33]]);

>

The minors of entries are respectively given by

> M11:=minor(A,1,1);
M12:=minor(A,1,2);
M13:=minor(A,1,3);

>

The cofactor of the entry is *det( );

> C11:=(-1)^2*det(M11);
C12:=(-1)^3*det(M12);
C13:=(-1)^4*det(M13);

The determinant of A.

> `det(A)` = a11*C11 +a12*C12+a13*C13;

Value should be zero.

> simplify(a21*C11 +a22*C12+a23*C13);

******************************************************************

Let A be an nxn nonsingular matrix. Then the inverse of A is given by:

*******************************************************************

Example 6 Find the inverse of the following matrix

>

> A:=matrix([[1,3,5],[5,3,6],[8,4,2]]);

The product of A with its adjoint is the matrix

>

This is the identity matrix multiplied by the determinant of the matrix A.

> det(A);