Section 4.2

The Determinant of a Square Matrix

> with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

>

Definition

The notion of "determinants" is related to the solution of linear systems.

We will define determinants of a square (n x n) matrix A in terms of determinants of (n-1 x n-1) matrices.

Case 1 (1 x 1)

A = a, det(A) = a. A is singular if and only if det(A) = 0.

Case 2 (2 x 2)

>

> A := matrix(2,2,[a,b,c,d]);

A := matrix([[a, b], [c, d]])

Case A.) Assume a is not zero.

> A:=addrow(A,1,2,-c/a);

A := matrix([[a, b], [0, -c/a*b+d]])

A is non-singular as long as the diagonal elements are not zero, i.e.

> simplify(A[1,1]*A[2,2]) <> 0;

-c*b+d*a <> 0

>

Case B.) Assume a is zero.

> A := matrix(2,2,[0,b,c,d]);

A := matrix([[0, b], [c, d]])

> A := swaprow(A,1,2);

A := matrix([[c, d], [0, b]])

> simplify(A[1,1]*A[2,2]) <> 0;

c*b <> 0

>

det(A) = ad - bc A is singular if and only if det(A) = 0.

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

The determinant of a 2x2 matrix is equal to the difference between the products of the

diagonal and the off diagonal elements.

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

Case 3 (n x n)

The process is a bit cumbersome and tedious for matrices of larger sizes. One method for

obtaining the determinant of a large matrix is referred to as the " Cofactor Expansion " :

1. Select a row (column) where the expansion will occur.

2. Find the minor of each entry in the row (column) chosen in (1). The minor M[ij] of the

element a[ij] is the matrix obtained by deleting the i-th row and the j-th column:

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

A := matrix([[a11, a12, a13], [a21, a22, a23], [a31...

>

The minors of entries a[11], a[12], a[13] are respectively given by

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

M11 := matrix([[a22, a23], [a32, a33]])

M12 := matrix([[a21, a23], [a31, a33]])

M13 := matrix([[a21, a22], [a31, a32]])

>

3. Compute the cofactor C[ij] of each entry in the row (column) chosen in (1).

The cofactor C[ij] of the entry a[ij] is (-1)^`i+j` *det( M[ij] );

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

C11 := a22*a33-a23*a32

C12 := -a21*a33+a23*a31

C13 := a21*a32-a22*a31

>

Finally,

4. Compute the determinant as the sum of the product of each entry and its cofactor for

each entry of the row chosen in (1)

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

`det(A)` = a11*(a22*a33-a23*a32)+a12*(-a21*a33+a23*...

>

> simplify(a11*C11 +a12*C12+a13*C13);

a11*a22*a33-a11*a23*a32-a12*a21*a33+a12*a23*a31+a13...

>

This is exactly the value we would get if we execute the Maple function det(A) .

> det(A);

a11*a22*a33-a11*a23*a32-a12*a21*a33+a12*a23*a31+a13...

>

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

The determinant of a 1 x 1 matrix is its sole entry; it is a first order determinant. Let n > 1,

and assume that determinants of order less than n have been defined. Let A=[ a[ij] ] be an

n x n matrix. The cofactor of a[ij] in A is C[ij] = (-1)^`i+j` *det( M[ij] ) where the minor M[ij] of the

element a[ij] is the matrix obtained by deleting the i-th row and the j-th column of A. The

determinant of A is

(Arcoss row i)

det(A) = a[i1]*C[i1]+a[i2]*C[i2]+a[i3]*C[i3] + . . . + a[i*n] C[i*n]

(Down Column j)

det(A) = a[1*j]*C[1*j]+a[2*j]*C[2*j]+a[3*j]*C[3*j] + . . . + a[nj]*C[nj]

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

Determinants and singular matrix.

>

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

A := matrix([[a11, a12, a13], [a21, a22, a23], [a31...

> A1 := addrow(A,1,2,-A[2,1]/A[1,1]);

A1 := matrix([[a11, a12, a13], [0, -a21/a11*a12+a22...

> A2 := addrow(A1,1,3,-A[3,1]/A[1,1]);

A2 := matrix([[a11, a12, a13], [0, -a21/a11*a12+a22...

> A3 := addrow(A2,2,3,-A2[3,2]/A2[2,2]);

A3 := matrix([[a11, a12, a13], [0, -a21/a11*a12+a22...

> simplify(A3[1,1]*A3[2,2]*A3[3,3]);

a11*a22*a33-a11*a23*a32-a12*a21*a33+a12*a23*a31+a13...

> det(A);

a11*a22*a33-a11*a23*a32-a12*a21*a33+a12*a23*a31+a13...

>

Example 1:

>

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

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

>

The minors of entries a[11], a[12], a[13] are respectively given by

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

M11 := matrix([[4, 2], [4, 1]])

M12 := matrix([[6, 2], [8, 1]])

M13 := matrix([[6, 4], [8, 4]])

The cofactor C[ij] of the entry a[ij] is (-1)^`i+j` *det( M[ij] );

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

C11 := -4

C12 := 10

C13 := -8

Determinant of A

> `det(A)` = A[1,1]*C11 +A[1,2]*C12+A[1,3]*C13;

`det(A)` = -14

>

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

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

The minors of entries a[12], a[22], a[32] are respectively given by

> M12:=minor(A,1,2);
M22:=minor(A,2,2);
M32:=minor(A,3,2);

The cofactor C[ij] of the entry a[ij] is (-1)^`i+j` *det( M[ij] );

> C12:=(-1)^3*det(M12);
C22:=(-1)^4*det(M22);
C32:=(-1)^5*det(M32);

Determinant of A

M12 := matrix([[6, 2], [8, 1]])

M22 := matrix([[2, 7], [8, 1]])

M32 := matrix([[2, 7], [6, 2]])

C12 := 10

C22 := -54

C32 := 38

> `det(A)` = A[1,2]*C12 +A[2,2]*C22+A[3,2]*C32;

`det(A)` = -14

>

Properties of Determinants

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

Property 1 : det(A) = det( A^T ).

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

Example 2:

>

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

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

> `det(A)` = det(A);

`det(A)` = -14

> `A^T` = transpose(A);

`A^T` = matrix([[2, 6, 8], [5, 4, 4], [7, 2, 1]])

> `det(A^T)` = det(transpose(A));

`det(A^T)` = -14

>

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

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

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

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

Example 3:

>

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

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

> `det(A)` = det(A);

`det(A)` = -14

> A1 := swaprow(A,1,2);

A1 := matrix([[6, 4, 2], [2, 5, 7], [8, 4, 1]])

> `det(A1)` = det(A1);

`det(A1)` = 14

>

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

Property 3 : If two rows of a square matrix A are equal, then det(A) = 0.

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

Example 4:

>

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

A := matrix([[2, 5, 7], [6, 4, 2], [6, 4, 2]])

> `det(A)` = det(evalm(A));

`det(A)` = 0

>

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

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).

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

Example 5:

>

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

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

> `det(A)` = det(A);

`det(A)` = -14

> A1 := mulrow(A,1,2);

A1 := matrix([[4, 10, 14], [6, 4, 2], [8, 4, 1]])

> `det(A1)` = det(A1);

`det(A1)` = -28

>

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

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 6:

>

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

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

> `det(A)` = det(evalm(A));

`det(A)` = -14

> A1 := addrow(A,1,2,-3);

A1 := matrix([[2, 5, 7], [0, -11, -19], [8, 4, 1]])...

> `det(A1)` = det(A1);

`det(A1)` = -14

>

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

Property 6 : A square matrix A is invertible if and only if det(A) <> 0 .

Equivalently, A is singular if and only if det(A) = 0 .

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

Example 7:

>

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

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

> `det(A)` = det(A);

`det(A)` = -14

> inverse(A);

matrix([[2/7, -23/14, 9/7], [-5/7, 27/7, -19/7], [4...

>

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

A := matrix([[1, -3, 1, -2], [2, -5, -1, -2], [0, -...

> `det(A)` = det(A);

`det(A)` = 0

> inverse(A);

Error, (in inverse) singular matrix

>

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

Property 7 : If A and B are n x n matrices then det(AB) = det(A)det(B).

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

Example 8:

>

> A:=matrix([[2,5,7],[6,4,2],[8,4,1]]); B:=matrix([[3,7,7],[9,6,2],[11,4,15]]);

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

B := matrix([[3, 7, 7], [9, 6, 2], [11, 4, 15]])

> `det(A)` = det(A);

`det(A)` = -14

> `det(B)` = det(B);

`det(B)` = -755

> `det(A)*det(B)` = det(A)*det(B);

`det(A)*det(B)` = 10570

> AB:=multiply(A,B);

AB := matrix([[128, 72, 129], [76, 74, 80], [71, 84...

> `det(AB)` = det(AB);

`det(AB)` = 10570

>

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

Property 8 : In general, det( A + B) is not equal to det(A) + det(B).

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

Example 9:

>

> A:=matrix([[2,5,7],[6,4,2],[8,4,1]]); B:=matrix([[3,7,7],[9,6,2],[11,4,15]]);

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

B := matrix([[3, 7, 7], [9, 6, 2], [11, 4, 15]])

> `det(A)` = det(A);

`det(A)` = -14

> `det(B)` = det(B);

`det(B)` = -755

> `det(A) + det(B)` = det(A) + det(B);

`det(A) + det(B)` = -769

> `A+B` := evalm(A &+ B);

`A+B` := matrix([[5, 12, 14], [15, 10, 4], [19, 8, ...

> `det(A+B)` = det(evalm(A &+ B));

`det(A+B)` = -2308

>

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

Property 9 : The determinant of a triangular matrix is equal to the product of its diagonal elements.

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

Example 10:

>

> U:=matrix([[3,5,6,7,8],[0,3,2,0,5],[0,0,2,5,0],
[0,0,0,4,7],[0,0,0,0,2]]);

> L:=transpose(U);

U := matrix([[3, 5, 6, 7, 8], [0, 3, 2, 0, 5], [0, ...

L := matrix([[3, 0, 0, 0, 0], [5, 3, 0, 0, 0], [6, ...

> `det(U)` = det(U);

`det(U)` = 144

> `det(L)` = det(L);

`det(L)` = 144

>

Summary

An nxn matrix A is nonsingular ( invertible)

if and only if

A is row equivalent to the identity matrix

if and only if

the determinant of the matrix A is not zero

if and only if

the homogeneous system associated with A has the trivial solution

if and only if

the nonhomogeneous system associated with A has a unique solution

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

Exercises

1, 5, 7, 10, 11, 13, 15-25, 27 ,29-31.