Section 2 Algebra of Matrices Lecture
Section 2 Algebra of Matrices Lecture
Definition 2.1 (formal) A matrix 𝐴 of 𝑚 rows and 𝑛 columns is a mapping defined on a Cartesian
product of two sets into a nonempty set 𝑉 ≠ ∅: 𝐴 ∶ {1,2, … , 𝑚} × {1,2, … , 𝑛} → 𝑉
𝐴 ∶ (𝑖, 𝑗) → 𝑎𝑖𝑗 ∈ 𝑉
Remarks.
A matrix (plural: matrices) can be informally defined as a rectangular array of elements that are
enclosed by a pair of brackets:
𝑎11 𝑎12 … 𝑎1𝑗 … 𝑎1𝑛 ← 1𝑠𝑡 𝑟𝑜𝑤
𝑎21 𝑎22 … 𝑎2𝑗 … 𝑎2𝑛 ← 2𝑛𝑑 𝑟𝑜𝑤
⋮ ⋮ ⋱ ⋮ ⋱ ⋮ ⋮
𝑎𝑖1 𝑎𝑖2 ⋯ 𝑎𝑖𝑗 ⋯ 𝑎𝑖𝑛 ← 𝑖𝑡ℎ 𝑟𝑜𝑤
𝐴 = 𝐴(𝑚,𝑛) = [𝑎𝑖𝑗 ] = ⋮ ⋮ ⋱ ⋮ ⋱ ⋮ ⋮
[𝑎𝑚1 𝑎𝑚2 ⋯ 𝑎𝑚𝑗 ⋯ 𝑎𝑚𝑛 ] ← 𝑚𝑡ℎ 𝑟𝑜𝑤
↑ ↑ ↑ ↑
1𝑠𝑡 2𝑛𝑑 𝑗𝑡ℎ 𝑛𝑡ℎ 𝑐𝑜𝑙𝑢𝑚𝑛
a row of a matrix is a horizontal vector in matrix 𝐴; [𝑎𝑖1 , 𝑎𝑖2 , … , 𝑎𝑖𝑛 ] = 𝑟𝑖 is an 𝑖th row,
a column of a matrix is a vertical vector in matrix 𝐴; [𝑎1𝑗 , 𝑎2𝑗 , … , 𝑎𝑚𝑗 ] = 𝑐𝑗 is a 𝑗th column,
the numbers 𝑎𝑖𝑗 in matrix 𝐴 are called the elements or entries or components of the matrix,
each element 𝑎𝑖𝑗 of a matrix 𝐴 has two indices: the row index 𝑖, and the column index 𝑗 (𝑎𝑖𝑗 is an
entry in the 𝑖th row and 𝑗th column),
the number of rows and columns, 𝑚 × 𝑛 (read as: “𝑚 by 𝑛”), is the dimension or size of the
matrix; in general, 𝑚 × 𝑛 matrix has 𝑚 rows and 𝑛 columns.
Example 2.1.
Beata Ciałowicz 8
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
Specific matrices
1. A column matrix or column vector of height 𝑚 (𝑚 × 1 matrix, 𝑛 = 1) is a matrix with 1 column of
5
elements: 𝐴 = [−3]
2 3×1
A row matrix or row vector of length 𝑛 (1 × 𝑛 matrix, 𝑚 = 1) is a matrix with 1 row
of elements: 𝐴 = [7 2 + 𝑖 −1 3𝑖 ]1×4
2. A zero (null) matrix is a matrix in which all entries are zero. We use the symbol 0 to represent a zero
0 0 0
matrix of any dimensions: 𝟎=[ ]
0 0 0 2×3
𝑎11 𝑎12 … 𝑎1𝑛
𝑎21 𝑎22 … 𝑎2𝑛
3. A square matrix has as many rows as columns, i.e. 𝑚 = 𝑛: 𝐴 = 𝐴(𝑛,𝑛) = [ ⋮ ⋮ ⋱ ⋮ ]
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛 𝑛×𝑛
In the square matrix 𝐴 = [𝑎𝑖𝑗 ]𝑛×𝑛 the entries for which 𝑖 = 𝑗 (elements for which the row number and
column number are equal), namely {𝑎11 , 𝑎22 , … , 𝑎𝑛𝑛 }, 𝑛 ∈ ℕ, form a principal diagonal (or main
diagonal or primary diagonal or diagonal entries) of 𝐴.
Elements {𝑎1𝑛 , 𝑎2(𝑛−1) , … , 𝑎𝑛1 } form a secondary diagonal.
The trace of the square matrix 𝐴 (𝑡𝑟𝐴) is defined as the sum of elements on the main diagonal:
𝑡𝑟𝐴 = ∑𝑛𝑖=1 𝑎𝑖𝑖 = 𝑎11 + 𝑎22 + ⋯ + 𝑎𝑛𝑛
4. An upper triangular matrix is a square matrix with all the elements below the main diagonal equal
𝑎11 𝑎12 … 𝑎1𝑛
0 𝑎22 … 𝑎2𝑛
zero: ∀𝑖, 𝑗 ∈ {1,2, … , 𝑛}; 𝑖 > 𝑗 ∶ 𝑎𝑖𝑗 = 0 𝑈 = [ ⋱ ⋮ ]
⋮ ⋮
0 0 … 𝑎𝑛𝑛 𝑛×𝑛
An lower triangular matrix is a square matrix with all the elements above the main diagonal equal
𝑎11 0 … 0
𝑎21 𝑎22 … 0
zero: ∀𝑖, 𝑗 ∈ {1,2, … , 𝑛}; 𝑖 < 𝑗 ∶ 𝑎𝑖𝑗 = 0 𝐿=[ ]
⋮ ⋮ ⋱ ⋮
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛 𝑛×𝑛
5. A diagonal matrix is a square matrix with all non-diagonal elements equal zero:
𝑎11 0 … 0
0 𝑎22 5 0 0
… 0
∀𝑖, 𝑗 ∈ {1,2, … , 𝑛}; 𝑖 ≠ 𝑗 ∶ 𝑎𝑖𝑗 = 0 𝐷 = [ ] e.g. 𝐷 = [0 3 − 𝑖 0]
⋮ ⋮ ⋱ ⋮
… 𝑎𝑛𝑛 𝑛×𝑛 0 0 4 3×3
0 0
5. The identity (unit) matrix is a diagonal matrix such that every diagonal element is equal to 1:
1 0 … 0 1 0 0
0 for 𝑖 ≠ 𝑗 1 0
𝑎𝑖𝑗 = { 𝑰 = 𝐼𝑛 = [0 1 … 0] e.g. 𝐼2 = [ ] 𝐼3 = [0 1 0]
1 for 𝑖 = 𝑗 ⋮ ⋮ ⋱ ⋮ 0 1
0 0 … 1 𝑛×𝑛 0 0 1
Notation:
𝑀(𝑚, 𝑛) is a set of all matrices of dimensions 𝑚 × 𝑛.
𝑀𝑚×𝑛 (ℝ) is a set of all real matrices of dimensions 𝑚 × 𝑛.
𝑀𝑛 (ℝ) is a set of all real square matrices of dimensions 𝑛 × 𝑛.
Beata Ciałowicz 9
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
2.2 Operations on (with) matrices and their properties
Multiplication by scalar (scalar multiplication)
Let 𝐴 = [𝑎𝑖𝑗 ] be an 𝑚 × 𝑛 matrix and 𝑘 ∈ ℝ be a real number, called a scalar. The product of the matrix 𝐴
by the scalar 𝑘, called scalar multiplication, is the 𝑚 × 𝑛 matrix:
𝑘 ∙ 𝐴 = [𝑘 ∙ 𝑎𝑖𝑗 ]𝑚×𝑛 .
Transposition
The transpose of a matrix 𝐴, denoted by 𝐴𝑇 , is found by interchanging rows and columns of 𝐴.
Remark A symmetric matrix is a square matrix 𝐴 ∈ 𝑀(𝑚, 𝑛) that is equal to its transpose: 𝐴𝑇 = 𝐴.
Beata Ciałowicz 10
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
Matrix addition and subtraction (sum of two matrices)
If 𝐴 = [𝑎𝑖𝑗 ]𝑚×𝑛 and 𝐵 = [𝑏𝑖𝑗 ]𝑚×𝑛 are two matrices of the same dimensions, then the sum and the
difference are defined as the 𝑚 × 𝑛 matrices: 𝐴 + 𝐵 = [𝑎𝑖𝑗 + 𝑏𝑖𝑗 ]𝑚×𝑛 , 𝐴 − 𝐵 = [𝑎𝑖𝑗 − 𝑏𝑖𝑗 ]𝑚×𝑛
Caution ! The sum or difference of two matrices DOES NOT EXIST if the dimensions of matrices are not
the same.
Example 2.4 Add and subtract given matrices 𝐴 and 𝐵.
Matrix multiplication has certain rule: in the multiplication of two matrices, the matrices 𝐴 and 𝐵 can only
be multiplied together to form the product 𝐴 ∙ 𝐵 if the number of columns in 𝐴 is the same as the number of
rows in 𝐵, regardless of the other dimensions.
Beata Ciałowicz 11
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
A product of row matrix and column matrix:
𝑏11
𝑏
If 𝐴 = [𝑎11 𝑎12 … 𝑎1𝑚 ] is a row matrix (1 × 𝑚) and 𝐵 = [ 21 ] is a column matrix (𝑚 × 1), then we
⋮
𝑏𝑚1
define product: 𝐴 ∙ 𝐵 = [𝑐11 ] to be 1 × 1 matrix (a number), where
𝑐11 = 𝑎11 𝑏11 + 𝑎12 𝑏21 + 𝑎13 𝑏31 + ⋯ + 𝑎1𝑚 𝑏𝑚1 .
𝐵 ∙ 𝐴 = [𝑐𝑖𝑗 ] to be 𝑚 × 𝑚 matrix, where
𝑐𝑖𝑗 = 𝑏𝑖1 ∙ 𝑎1𝑗 .
The Falck’s diagrams:
𝑏11
𝑏
𝐵= [ 21 ] 𝐴 ∙ 𝐵 = 𝐴 ∘ 𝐵 𝑇 (inner product of two vectors)
⋮
𝑏𝑚1 𝑚×1
𝐴 = [𝑎11 𝑎12 … 𝑎1𝑚 ]1×𝑚 [𝑐11 ]1×1 = 𝐴 ∙ 𝐵
Beata Ciałowicz 12
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
A product of two matrices:
If 𝐴 = [𝑎𝑖𝑗 ]𝑚×𝑝 is an 𝑚 × 𝑝 matrix and 𝐵 = [𝑏𝑖𝑗 ]𝑝×𝑛 is a 𝑝 × 𝑛 matrix, then their product
Power of a matrix
Remark If 𝐴 ∈ 𝑀(𝑛, 𝑛)is a square matrix, we can define powers of it: 𝐴2 = 𝐴 ∙ 𝐴, 𝐴3 = 𝐴2 ∙ 𝐴, and so on.
In general for any positive integer 𝑘 we have 𝐴𝑘+1 = 𝐴𝑘 ∙ 𝐴, where we take 𝐴0 = 𝐼𝑛 .
Example 2.6 For a matrix 𝐴 compute 𝐴2 .
Beata Ciałowicz 13
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
2.3 Determinant of a square matrix and its properties
Let 𝐴 ∈ 𝑀(𝑛, 𝑛).
A determinant is a number uniquely associated with a square matrix.
𝑎11 𝑎12 … 𝑎1𝑛
𝑎21 𝑎22 … 𝑎2𝑛
We will denote the determinant of the matrix 𝐴 by det 𝐴 or |𝐴| or | ⋮ ⋮ ⋱ ⋮ |
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛 𝑛×𝑛
Caution! Be careful not to confuse the notation for a matrix and that for a determinant. The symbol [… ]
(brackets) is used for a matrix; the symbol |… | (vertical bars) is used for the determinant of the matrix.
Remarks
Determinant of a matrix 𝟏 × 𝟏 (a first-order determinant)
𝐴 = [𝑎11 ] det 𝐴 = 𝑎11
Determinant of a matrix 𝟐 × 𝟐 (a second-order determinant)
𝑎11 𝑎12
𝐴 = [𝑎 ] det𝐴 = 𝑎11 𝑎22 −𝑎12 𝑎21
21 𝑎22
Determinant of a matrix 𝟑 × 𝟑 (a third-order determinant)
𝑎11 𝑎12 𝑎13
𝐴 = [𝑎21 𝑎22 𝑎23 ] (the Sarrus’ rule – ONLY FOR A MATRIX 𝟑 × 𝟑)
𝑎31 𝑎32 𝑎33
𝑎11 𝑎12 𝑎13
𝑑𝑒𝑡𝐴 = | 21 𝑎22 𝑎23 | =
𝑎
𝑎31 𝑎32 𝑎33
𝑎11 𝑎12 𝑎13
𝑎21 𝑎22 𝑎23
= (𝑎11 𝑎22 𝑎33 + 𝑎12 𝑎23 𝑎31 + 𝑎21 𝑎32 𝑎13 ) − (𝑎13 𝑎22 𝑎31 + 𝑎12 𝑎21 𝑎33 + 𝑎23 𝑎32 𝑎11 )
Example 2.8 Evaluate the determinant of the matrix 𝐴 if:
2 5
a) 𝐴 = [ ]
1 3
2 −3 4
b) 𝐵 = [1 5 −2].
4 2 6
Beata Ciałowicz 14
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
Definition 2.2
1. The minor 𝑀𝑖𝑗 of dimension 𝑛 − 1 (subdeterminant) belonging to the element 𝑎𝑖𝑗 of a square matrix 𝐴
of order 𝑛 ≥ 2 is the determinant of the matrix obtained by deleting the 𝑖th row and the 𝑗th column of 𝐴.
2. The cofactor 𝐶𝑖𝑗 of an element 𝑎𝑖𝑗 of a square matrix 𝐴 is given by
𝐶𝑖𝑗 = (−1)𝑖+𝑗 ∙ 𝑀𝑖𝑗 where 𝑀𝑖𝑗 is the minor of 𝑎𝑖𝑗 .
−2 3 0
Example 2.9 Given the determinant 𝑑𝑒𝑡 [ 5 1 −2] write the minor and cofactor of each of the
7 −4 8
following elements: 𝑎11 , 𝑎23 , 𝑎31 .
Solution:
Remark The matrix 𝐴𝐶 formed by all the cofactors of the elements in a matrix 𝐴 = [𝑎𝑖𝑗 ]𝑛×𝑛 is called the
cofactor matrix 𝐴: 𝐴𝐶 = [𝐶𝑖𝑗 ]𝑛×𝑛 .
Remark
𝑎11 𝑎12 1+1 1+2
If 𝐴 = [𝑎
21 𝑎22 ] then det𝐴 = 𝑎11 𝐶11 +𝑎12 𝐶12 = 𝑎11 (−1) 𝑎22 +𝑎12 (−1) 𝑎21 = 𝑎11 𝑎22 −𝑎12 𝑎21 .
Beata Ciałowicz 15
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
3 4 0 4
Example 2.10a Calculate a determinant of the matrix 𝐴 = [ 0 2 −2 0]
−2 1 7 0
5 −5 0 −1
Applications:
1. Calculating determinants: before expanding by cofactors we may transform a determinant with the
help of elementary transformations into a form such that it contains as many zeros as possible or into a
triangular matrix.
2. Finding the inverse of a matrix (the Gauss-Jordan reduction method).
3. Calculating the rank of a matrix (Section 3).
4. Solving general system of linear equations (the Gauss and the Gauss-Jordan elimination methods -
Section 3).
Properties:
Operation 1) changes the determinant of a matrix (det 𝐴′ = − det 𝐴).
Operation 2) changes the determinant of a matrix (det 𝐴′ = 𝑘 det 𝐴).
Operation 3) does NOT change the determinant of a matrix (det 𝐴′ = det 𝐴).
3 4 0 4
Example 2.10b Calculate a determinant of the matrix 𝐴 = [ 0 2 −2 0]
−2 1 7 0
5 −5 0 −1
Beata Ciałowicz 17
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
2.5 Inverse of a matrix
Definition 2.5. Let 𝐴 ∈ 𝑀(𝑛, 𝑛). A matrix 𝐴−1 ∈ 𝑀(𝑛, 𝑛) is called an inverse matrix of 𝐴 with respect
to multiplication (in short: inverse of 𝐴), iff: 𝐴 ∙ 𝐴−1 = 𝐴−1 ∙ 𝐴 = 𝐼.
Remarks
A square matrix 𝐴 has at most one inverse.
A square matrix 𝐴 which has the inverse matrix is called invertible (or non-singular).
If det 𝐴 = 0 then a matrix 𝐴 has no inverse (it is called singular).
Caution ! Not all square matrices are invertible.
3 5
𝐿=[ ]
2 4
2 −1 0
𝑀 = [1 −2 3]
4 0 2
Beata Ciałowicz 18
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
Inverse matrix using elementary row (column) operations (the Gauss-Jordan
reduction method)
Procedure for calculating the inverse 𝐴−1 of a matrix 𝐴 using elementary row (column) operations:
a) first we form a new matrix consisting, on the left, of the matrix 𝐴, on the right, of the corresponding
identity matrix 𝐼: [𝐴 ∶ 𝐼],
b) now we use elementary row operations to produce matrix:[𝐼 ∶ 𝐴−1 ],
c) we attempt to transform 𝐴 to an identity matrix, but whatever operations we perform, we do on the
identity matrix,
d) the matrix on the right will be 𝐴−1.
2 −1 0
Example 2.11b If possible find inverse of the given matrix 𝑀 = [1 −2 3].
4 0 2
Beata Ciałowicz 19
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
2.6 Orthogonal matrix
Definition 2.6. The inner product of two vectors 𝑋 = (𝑥1 , 𝑥2 , … , 𝑥𝑛 ), 𝑌 = (𝑦1 , 𝑦2 , … , 𝑦𝑛 ) is a scalar:
𝑋 ∘ 𝑌 = < 𝑋|𝑌 > = 𝑥1 ⋅ 𝑦1 + 𝑥2 ⋅ 𝑦2 + ⋯ + 𝑥𝑛 ⋅ 𝑦𝑛 .
Theorem 2.6. Let be given matrix 𝐴 ∈ 𝑀(𝑛, 𝑛). This matrix is an orthogonal matrix if and only if:
1. 𝐴−1 = 𝐴𝑇
2. their columns and rows (as elements of ℝ𝑛 ) form an orthonormal set of vectors.
1) 𝑨 ∙ 𝑿 = 𝑩 where 𝐴 ∈ 𝑀(𝑛, 𝑛), 𝐵 ∈ 𝑀(𝑛, 𝑝), 𝑑𝑒𝑡𝐴 ≠ 0. Solution: 𝑿 = 𝑨−𝟏 ∙ 𝑩, where 𝑋 ∈ 𝑀(𝑛, 𝑝).
2) 𝑿 ∙ 𝑨 = 𝑩 where 𝐴 ∈ 𝑀(𝑛, 𝑛), 𝐵 ∈ 𝑀(𝑝, 𝑛), 𝑑𝑒𝑡𝐴 ≠ 0. Solution: 𝑿 = 𝑩 ∙ 𝑨−𝟏 , where 𝑋 ∈ 𝑀(𝑝, 𝑛).
3) 𝑨 ∙ 𝑿 ∙ 𝑩 = 𝑪 where 𝐴 ∈ 𝑀(𝑛, 𝑛), 𝐵 ∈ 𝑀(𝑝, 𝑝), 𝐶 ∈ 𝑀(𝑛, 𝑝), 𝑑𝑒𝑡𝐴 ≠ 0, 𝑑𝑒𝑡𝐵 ≠ 0.
Solution: 𝑿 = 𝑨−𝟏 ∙ 𝑪 ∙ 𝑩−𝟏 .
Beata Ciałowicz 20
Mathematical Analysis and Linear Algebra - lecture – Section 2 – Matrix Algebra
1 −2 4 1
Example 2.13 Given 𝐴 = [ ] 𝐵=[ ] determine matrices 𝑋 and 𝑌 satisfying:
3 4 0 −3
a) 𝐴 ∙ 𝑋 = 𝐵, b) 𝑌 ∙ 𝐴 = 𝐵.
𝑇
2 −3 3 4𝑇
Example 2.14. Solve the given equation for the matrix 𝑋: ([ ] ∙ 𝑋 + 3𝐼) = [ ] ∙ [ ] − 3𝐼 2 .
−1 4 −2 1
Beata Ciałowicz 21