MATRICES AND MATRIX OPERATIONS: Unit 11
Dr. Wlodzislaw Kostecki
The Papua New Guinea University of Technology (PNGUT)
Department of Electrical and Communication Engineering
Lae, Morobe Province
Papua New Guinea
Copyright © 2000 by Wlodzislaw Kostecki
All rights reserved
-------------------------------------------------------------------
(11) The determinant of a matrix
OBJECTIVES :
• To define the determinant of a square matrix and introduce the concept of the order of determinant.
• To provide examples of computation of the determinant of matrices with symbolic and numerical elements.
• To investigate the value of the determinant of some specific types of matrices.
• To investigate properties of determinants of matrices having specific values of, or specific relations between, row and column elements.
• To investigate how some operations performed on entire matrices or their components affect the determinant.
• To introduce further functions from the linalg package and show their use in matrix computations.
> restart : with(linalg, addcol, addrow, coldim, det, diag, mulcol, mulrow, multiply, rowdim, swapcol, swaprow, transpose, vandermonde) :
The determinant of a matrix is defined only for square matrices and it is the sum of certain products of the matrix elements. It is, therefore, a scalar (real number, complex number, or function, depending on the elements of the matrix).
Exemplarily, consider a square
(
×
)
matrix [
A
] given as
> A := matrix(2, 2, [ a[11], a[12], a[21], a[22] ]) : A = matrix(A) ;
The determinant of this matrix is defined as the following sum of products of the diagonal elements:
> `det(A)` := det(A) : Det(A) = `det(A)` ;
This sum is also the value of the determinant of [ A ].
* * *
N.B.
In textbooks, a common method of visualization of the determinant of [
A
] uses the symbol
,
which is followed by the
=
sign and a square array of elements arranged exactly as they are displayed above, but enclosed in a pair of vertical lines. The number of rows or columns of the array is the
order
of the determinant.
In the case of the above matrix [ A ], its determinant is of second order.
Maple does not offer this type of visualization of the determinant.
* * *
As a more advanced example, consider a
(
×
)
matrix [
B
] given as
> B := matrix(3, 3, [b[11], b[12], b[13], b[21], b[22], b[23], b[31], b[32], b[33]]) : B = matrix(B) ;
The determinant of this matrix is the third-order determinant. Its value is the following sum of products:
> `det(B)` := det(B) : Det(B) = `det(B)` ;
Numerical example
Compute the determinant of a
(
×
)
matrix [
C
] given as
> C := matrix(3, 3, [7, 18, 8, 1, 5, 7, 3, 9, 4]) : C = matrix(C) ;
The determinant of [ C ] is
> `det(C)` := det(C) : Det(C) = `det(C)` ;
* * *
N.B.
The determinant of a
(
×
)
matrix is the element itself.
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(1, 1, [a]) : A = matrix(A) ;
> `det(A)` := det(A) : Det(A) = `det(A)` ;
* * *
N.B.
The determinant of a
unit
matrix is
.
Exemplarily, consider a
(
×
)
unit matrix [
U
]:
> U := diag(1, 1, 1) : U = matrix(U) ;
The determinant of this matrix is
> `det(U)` := det(U) : Det(U) = `det(U)` ;
* * *
N.B.
If
all
the elements of a row (or of a column) in a matrix are
, then the determinant of the matrix is
.
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(3, 3, [a[11], a[12], a[13], 0, 0, 0, a[31], a[32], a[33]]) : A = matrix(A) ;
The determinant of this matrix is
> `det(A)` := det(A) : Det(A) = `det(A)` ;
and the matrix [ A ] is said to be singular .
* * *
N.B.
If
two
rows of a square matrix are
equal
, then its determinant is
.
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(4, 4, [2, 2, 3, 3, 2, 3, 3, 2, 5, 3, 7, 9, 2, 2, 3, 3]) : A = matrix(A) ;
in which the rows
and
are equal.
The determinant of this matrix is
> `det(A)` := det(A) : Det(A) = `det(A)` ;
* * *
N.B. The determinant of a matrix [ A ] raised to any positive or negative integer power is equal to the determinant raised to the same power
Det(
[
A
]
^
) = (Det
[
A
]
)^
Exemplarily, consider a
(
×
)
non-singular matrix [
A
] given as
> A := matrix(3, 3, [2, 1, 3, 4, 2, -1, 2, -1, 1]) : A = matrix(A) ;
> `det(A)` := det(A) : Det(A) = `det(A)` ;
Let the positive exponent be
and the negative exponent
.
(a) The values of
Det(
[
A
]
^
)
and
Det(
[
A
]
^(
))
are
> `det(A^3)` := det(evalm(A^3)) : `det(A^(-2))` := det(evalm(A^(-2))) :
> Det(A^3) = `det(A^3)` ; Det(A^(`-2`)) = `det(A^(-2))` ;
(b) The values of
(Det
[
A
]
)^
and
(Det
[
A
]
)^(
)
are
> `(det(A))^3` := (det(A))^3 : `(det(A))^(-2)` := (det(A))^(-2) :
> [Det(A)]^3 = `(det(A))^3` ; [Det(A)]^(`-2`) = `(det(A))^(-2)` ;
[ For integer exponentiation of matrices, refer to Unit (15). ]
* * *
N.B. The determinant of the product of any square matrices of the same order is equal to the product of the determinants of the matrices
Det( [ A ] [ B ] ) = Det [ A ] Det [ B ]
Let
(
×
)
matrices [
A
] and [
B
] be given as
> A := matrix(2, 2, [5, 4, -8, 7]) : B := matrix(2, 2, [3, 2, 5, 4]) : A = matrix(A) ; B = matrix(B) ;
(a) The determinant of the matrix product, Det( [ A ] [ B ] ) , has the value
> `det(AB)` := det(multiply(A, B)) : Det(A * B) = `det(AB)` ;
(b) The product Det [ A ] Det [ B ] is the following number:
> `det(A) det(B)` := det(A) * det(B) : Det(A) * Det(B) = `det(A) det(B)` ;
* * *
N.B. The determinant of the transpose of a square matrix is equal to the determinant of the matrix
Det(Transp [ A ] ) = Det [ A ]
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(3, 3, [1, -2, 3, 0, 4, -2, 6, -1, -1]) : A = matrix(A) ;
(a) The determinant of the matrix, Det [ A ], has the value
> `det(A)` := det(A) : Det(A) = `det(A)` ;
(b) The determinant of the matrix transpose, Det(Transp [ A ] ) , has the value
> `det(transp(A))` := det(transpose(A)) : Det(Transp(A)) = `det(transp(A))` ;
* * *
N.B. Transposition of the following matrix does not change the determinant of the matrix:
> V := matrix(3, 3, [1, 1, 1, a, b, c, a^2, b^2, c^2]) : V = matrix(V) ;
(a) The determinant of the matrix, Det [ V ], has the value
> `det(V)` := factor(det(V)) : Det(V) = `det(V)` ;
(b) The determinant of the matrix transpose, Det(Transp [ V ] ) , has the value
> `det(transp(V))` := factor(det(transpose(V))) : Det(Transp(V)) = `det(transp(V))` ;
The determinant of this matrix is called an alternate determinant or alternant . The matrix itself is the transpose of the Vandermonde matrix and may be created automatically using the vandermonde function, viz.
> V := transpose(vandermonde([a, b, c])) : V = matrix(V) ;
* * *
N.B.
If the elements of a row (or of a column) of a matrix are multiplied by a scalar
, then the value of the determinant of the matrix is multiplied by
.
Exemplarily, consider the same
(
×
)
matrix [
A
] as above and assume that a scalar
.
> lambda := 3 :
(a) Let the column
be multiplied by
. This yields the following
(
×
)
matrix [
B
]:
> j := 2 : B := mulcol(A, j, lambda) : B = matrix(B) ;
The determinant of the matrix, Det [ B ], has the value
> `det(B)` := det(B) : Det(B) = `det(B)` ;
which is
three
times that of the determinant of the matrix [
A
], i.e.
Det
[
B
]
=
Det
[
A
].
(b) Let the row
be multiplied by
. This yields the following
(
×
)
matrix [
C
]:
> i := 1 : C := mulrow(A, i, lambda) : C = matrix(C) ;
The determinant of the matrix, Det [ C ], has the value
> `det(C)` := det(C) : Det(C) = `det(C)` ;
which is
three
times that of the determinant of the matrix [
A
], i.e.
Det
[
C
]
=
Det
[
A
].
* * *
N.B.
The determinant of a
matrix multiplied by a scalar
(whether real or complex) is equal to the product of the matrix determinant and the scalar raised to the power equal to the number of rows,
, or columns,
, in the matrix
Det
(
[
A
])
=
Det
[
A
]
=
Det
[
A
]
Exemplarily, consider the same
(
×
)
matrix [
A
] as before and assume that a scalar
.
> k := 2 :
(a) The determinant of the matrix multiplied by the scalar,
Det(
[
A
]
)
, has the value
> `det(kA)` := det(k*A) : k := 'k' : Det(k * A) = `det(kA)` ; k := 2 :
Notice that the multiplication order, k A or A k , under the det function is not important .
(b) The product of the matrix determinant and the scalar raised to the power equal to the number of rows,
, or columns,
, in the matrix,
Det
[
A
] and
Det
[
A
], respectively, may be computed using either of the following alternative methods:
> `k^m det(A)` := k^rowdim(A)*det(A) : k := 'k' : k^m * Det(A) = `k^m det(A)` ; k := 2 :
> `k^n det(A)` := k^coldim(A)*det(A) : k := 'k' : k^n * Det(A) = `k^n det(A)` ;
The value of either product,
Det
[
A
] or
Det
[
A
], is
eight
times
(
)
that of the determinant of the matrix [
A
], i.e.
Det(
[
A
]
) =
Det
[
A
].
The functions coldim and rowdim return the number of columns or rows in a matrix, respectively .
* * *
N.B. If a matrix [ B ] is formed from a matrix [ A ] by interchanging two rows or two columns of [ A ], then
Det [ B ] = –Det [ A ]
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(4, 4, [-2, 4, 3, -3, -2, -3, 6, -2, -5, 3, -7, -9, -2, -3, 4, -8]) : A = matrix(A) ;
(a) The determinant of [ A ] is
> `det(A)` := det(A) : Det(A) = `det(A)` ;
(b) The matrix [
B
] formed by interchanging columns
and
of [
A
], and the determinant of [
B
] are
> B := swapcol(A, 2, 4) : B = matrix(B) ; `det(B)` := det(B) : Det(B) = `det(B)` ;
(c) The matrix [
B
] formed by interchanging rows
and
of [
A
], and the determinant of [
B
] are
> B := swaprow(A, 1, 3) : B = matrix(B) ; `det(B)` := det(B) : Det(B) = `det(B)` ;
This property is sometimes expressed in the following words:
"If two rows (or columns) of a matrix are interchanged, the determinant changes sign."
* * *
N.B. If a matrix [ B ] is formed from a square matrix [ A ] by adding to one row (or column) of [ A ] a scalar times another row (or column) of [ A ], then
Det [ B ] = Det [ A ]
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(3, 3, [4, -2, 3, 0, 4, -2, 6, -1, -3]) : A = matrix(A) ;
(a) The determinant of [ A ] is
> `det(A)` := det(A) : Det(A) = `det(A)` ;
(b) Let each element of the column
in a new matrix [
B
] be formed as a sum of the corresponding element in the same column of [
A
] and scalar
times the corresponding element of the column
of [
A
], i.e.
.
Let
.
> j[A] := 1 : j[B] := 2 : k := 4 : lambda := k^2 :
Therefore, the matrix [ B ] is
> B := addcol(A, j[A], j[B], lambda) : B = matrix(B) ;
(c) The determinant of [ B ] is
> `det(B)` := det(B) : Det(B) = `det(B)` ;
(d) Let each element of the row
in a new matrix [
B
] be formed as a sum of the corresponding element in the same row of [
A
] and scalar
times the corresponding element of the row
of [
A
], i.e.
.
Let
.
> i[A] := 3 : i[B] := 1 : k := 6 : lambda := sin(Pi/k) :
Therefore, the matrix [ B ] is
> B := addrow(A, i[A], i[B], lambda) : B = matrix(B) ;
(e) The determinant of [ B ] is
> `det(B)` := det(B) : Det(B) = `det(B)` ;
The determinants of (a), (c), and (e) are identical.
An obvious implication of the above result is that if a row (or column) of a matrix is expressible as the sum of multiples of other rows (or columns) of the matrix, then the value of the determinant
must
be
. This is so because by subtraction of this sum of multiples of other rows (or columns) in question, it is possible to produce a row (or column) containing only
elements.
Exemplarily, consider a
(
×
)
matrix [
A
] given as
> A := matrix(3, 3, [6, 18, 8, 1, 5, 7, 3, 9, 4]) : A = matrix(A) ;
Notice that the elements of the first row of [ A ] are equal to the doubled elements of the third row.
Consequently, the determinant of [ A ] is
> `det(A)` := det(A) : Det(A) = `det(A)` ;
* * *
N.B. The determinant of the following matrix
> A := matrix(3, 3, [sin(t+Pi/4), sin(t), cos(t), sin(t+Pi/4), cos(t), sin(t), 1, a, 1-a]) : A = matrix(A) ;
is independent of
and is expressible as a function of
only, i.e.
> `det(A)` := det(A) : Det(A) = `det(A)` ;
Some extra operations result in a more compact form of the above, viz.
> `det(A)` := collect(combine(expand(det(A))), cos(2*t)) : Det(A) = `det(A)` ;
* * *
N.B.
There are symmetric matrices with elements created according to a specific pattern whose determinant is
. One of them is the following matrix:
> A := matrix(3, 3, [a^2, a*b, a*c, a*b, b^2, b*c, a*c, b*c, c^2]) : A = matrix(A) ;
From the definition of the determinant, it can be easily noticed that the determinant of [
A
] is
, which is verified by the following computation:
> `det(A)` := det(A) : Det(A) = `det(A)` ;
This may not be noticeable so easily if such a symmetric matrix is given with numerical elements following the same pattern. For example, let
,
, and
in the above matrix [
A
] be given as
> a := 3*exp(2) : b := -5 : c := 7*sin(Pi/3) : 'a' = a ; 'b' = b ; 'c' = c ;
Evaluation of [
A
] with these values of
,
, and
yields the following exact symmetric matrix:
> A := map(combine, map(x->eval(x), A)) : A = matrix(A) ;
The determinant of the exact [
A
] is precisely
, viz.
> `det(A)` := det(A) : Det(A) = `det(A)` ;
while the determinant of [ A ] subjected to floating-point evaluation yielding the matrix
> A := evalf(matrix(A)) : A = matrix(A) ;
is only approximately equal to
, viz.
> `det(A)` := det(A) : Det(A) = `det(A)` ;
* * *
N.B.
The determinant of a diagonal matrix having no
elements on the diagonal equals the product of its diagonal elements
Det
[
A
]
=
Exemplarily, consider a
(
×
)
diagonal matrix [
A
] given as
> A := diag(3, -4, 2, -5) : A = matrix(A) ;
(a) The determinant of [ A ] is
> `det(A)` := det(A) : Det(A) = `det(A)` ;
(b) The product of the diagonal elements of [ A ] is
> `product(diag_el(A))` := 1 :
> for i to rowdim(A) do for j to coldim(A) do if j = i then `product(diag_el(A))` := `product(diag_el(A))` * A[i,j] fi : od : od :
> `product(diag_el(A))` := `product(diag_el(A))` : i := 'i' :
> Product(diag_el[i](A), i=1..rowdim(A)) = `product(diag_el(A))` ;
* * *
N.B. The determinant of a matrix equals the product of the eigenvalues of the matrix.
[ For the eigenvalues of a matrix, refer to Unit (21). ]
* * *
N.B.
If the determinant of a matrix of order
(
×
)
or higher is to be evaluated manually, it is necessary to introduce the notion of a
minor
and
cofactor
(
signed minor
) of an element of the matrix.
[ For the definitions of the minor and cofactor , refer to Unit (12). ]
* * *
N.B. In computing determinants of large sparse matrices, it is advisable to use the sparse optional directive. This argument specifies that the method of minor expansion should be used by the program.
[ Refer also to Unit (12) for the Laplace expansion theorem. ]
Exemplarily, compute the determinant of a
(
×
)
sparse matrix [
E
] given as
> E := array(1..6, 1..6, [(1,1)=15, (1,2)=-10, (1,3)=-5, (2,1)=-10, (2,2)=10, (3,1)=-5, (3,3)=0, (3,4)=-12, (3,5)=0, (4,3)=-12, (4,4)=12, (5,3)=-8, (5,5)=23, (5,6)=0, (6,5)=-15, (6,6)=15], sparse) : E = matrix(E) ;
The determinant of [ E ] is
> `det(E)` := det(E, sparse) : Det(E) = `det(E)` ;
* * *
Proceed to Unit (12) for " The minor and cofactor of a matrix element ".
-------------------------------------------------------------------