Matrix Algebra: Introduction On Matrices and Vectors

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T.

ALLAWI

Matrix Algebra
Introduction on Matrices and Vectors:
Matrices are rectangular patterns or arrangements of numbers (or
functions) enclosed in brackets []. These numbers (or functions) are called entries
of the matrix. For example, the following are matrices:
0 3 −8 𝑥𝑥
1 −5 3 4 2
� �, �2.1 −1 0 � , � �, [ 𝑎𝑎 𝑏𝑏 𝑐𝑐 ], �𝑦𝑦�
0.7 0 13 −5 6
12 −9 1
The first matrix has two rows and three columns, the second and third
matrices are square matrices (3 and 2 rows and columns, respectively). The fourth
and fifth matrices are called vectors, because it has just one row and one column,
respectively.
The matrices are denoted by capital bold letters 𝑨𝑨, 𝑩𝑩, 𝑪𝑪 … or by the general
entry in brackets: 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 �. An 𝑚𝑚 × 𝑛𝑛 matrix has 𝑚𝑚 rows and 𝑛𝑛 columns:
𝑎𝑎11 𝑎𝑎12 ⋯ 𝑎𝑎1𝑛𝑛
𝑎𝑎21 𝑎𝑎22 ⋯ 𝑎𝑎2𝑛𝑛
𝐀𝐀 = � ⋮ ⋮ ⋱ ⋮ �
𝑎𝑎𝑚𝑚1 𝑎𝑎𝑚𝑚2 ⋯ 𝑎𝑎𝑚𝑚𝑚𝑚
Therefore, the first matrix is 2 × 3 matrix, the second is 3 × 3 matrix, the
third is 2 × 2 matrix, the fourth is 1 × 3 matrix, and the fifth is 2 × 1 matrix.
Each entry has two subscripts, the first is called row number and the second
is called column number. If 𝑚𝑚 = 𝑛𝑛, then 𝐀𝐀 is called an 𝑛𝑛 × 𝑛𝑛 square matrix and
the entries 𝑎𝑎11 , 𝑎𝑎22 , … , 𝑎𝑎𝑛𝑛𝑛𝑛 are called the main diagonal of 𝐀𝐀. If 𝑚𝑚 ≠ 𝑛𝑛, then 𝐀𝐀 is
called a rectangular matrix.
Vectors are matrices with one row or column and their entries are called
the components of the vector. The vectors are denoted by small bold letters
𝐚𝐚, 𝐛𝐛, 𝐜𝐜 … or by the general entry in brackets: 𝐚𝐚 = [𝑎𝑎𝑖𝑖 ]. The row vector 𝐚𝐚 and the
column vector 𝐛𝐛 are of the form:
𝑏𝑏1
𝐚𝐚 = [𝑎𝑎1 𝑎𝑎2 ⋯ 𝑎𝑎𝑛𝑛 ], 𝐛𝐛 = � 𝑏𝑏2 �

𝑏𝑏𝑚𝑚

63 | P a g e
ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T. ALLAWI

Matrix Addition and Scalar Multiplication


Two matrices 𝐀𝐀 and 𝐁𝐁 are equal 𝐀𝐀 = 𝐁𝐁 if and only if they have the same
size and the corresponding entries are equal: 𝑎𝑎𝑖𝑖𝑖𝑖 = 𝑏𝑏𝑖𝑖𝑖𝑖 .
The sum of two matrices 𝐀𝐀 and 𝐁𝐁 of the same size is written 𝐀𝐀 + 𝐁𝐁 and has
the entries: 𝑎𝑎𝑖𝑖𝑖𝑖 + 𝑏𝑏𝑖𝑖𝑖𝑖 . Matrices of different sizes cannot be added.

The product of any 𝑚𝑚 × 𝑛𝑛 matrix 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 � and any scalar 𝑘𝑘 is written 𝑘𝑘𝐀𝐀 =
�𝑘𝑘𝑎𝑎𝑖𝑖𝑖𝑖 �, and the entries are obtained by multiplying each entry of 𝐀𝐀 by 𝑘𝑘. Matrix
addition and scalar multiplication are commutative and associative. The zero
matrix 𝟎𝟎 is a matrix that has all of its entries are zeros.

Matrix Multiplication:
The product of an 𝑚𝑚 × 𝑛𝑛 matrix 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 � times 𝑝𝑝 × 𝑟𝑟 matrix 𝐁𝐁 = �𝑏𝑏𝑖𝑖𝑖𝑖 � is
defined if and only if 𝑛𝑛 = 𝑝𝑝, then the 𝑚𝑚 × 𝑟𝑟 matrix 𝑪𝑪 = 𝑨𝑨𝑨𝑨 = �𝑐𝑐𝑖𝑖𝑖𝑖 � has the
entries:
𝑛𝑛
𝑐𝑐𝑖𝑖𝑖𝑖 = � 𝑎𝑎𝑖𝑖𝑖𝑖 𝑏𝑏𝑘𝑘𝑘𝑘 , 𝑖𝑖 = 1, … , 𝑚𝑚; 𝑗𝑗 = 1, … , 𝑟𝑟.
𝑘𝑘=1

The condition 𝑛𝑛 = 𝑝𝑝 means that the second matrix 𝐁𝐁 must have as many
rows as the first matrix 𝑨𝑨 has columns, namely 𝑛𝑛.
2 0
−1 0 2
Ex1: Multiply 𝐀𝐀 = � � by 𝐁𝐁 = �−3 1�.
3 −4 1
1 2
0 4
Answer: 𝐀𝐀𝐀𝐀 = � �.
19 −2
Matrix multiplication is not commutative; i.e. 𝐀𝐀𝐀𝐀 ≠ 𝐁𝐁𝐁𝐁, so that the order
of the matrices must be observed carefully. However, matrix multiplication is
associative.

Matrix Transposition:
The transpose of an 𝑚𝑚 × 𝑛𝑛 matrix 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 � is the an 𝑛𝑛 × 𝑚𝑚 matrix 𝐀𝐀T =
�𝑎𝑎𝑗𝑗𝑗𝑗 � that has the first row of 𝐀𝐀 as its first column, the second row of 𝐀𝐀 as its
second column and so on.

64 | P a g e
ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T. ALLAWI

𝑎𝑎11 𝑎𝑎21 ⋯ 𝑎𝑎𝑚𝑚1


𝑎𝑎12 𝑎𝑎22 ⋯ 𝑎𝑎𝑚𝑚2
𝐀𝐀T = � ⋮ ⋮ ⋱ ⋮ �
𝑎𝑎1𝑛𝑛 𝑎𝑎2𝑛𝑛 ⋯ 𝑎𝑎𝑚𝑚𝑚𝑚
Transposition converts row vectors to column vectors and conversely.
Some important rules of transpositions are as follows:
(𝐀𝐀T )T = 𝐀𝐀, (𝐀𝐀𝐀𝐀)T = 𝐁𝐁 T 𝐀𝐀T

Special Matrices:
Diagonal Matrix: Diagonal matrices are square matrices that have nonzero
entries in their diagonals, i.e. 𝐀𝐀 = [𝑎𝑎𝑖𝑖𝑖𝑖 ].
Identity Matrix: Identity matrices are diagonal matrices that all of its
diagonal entries are unity. The Identity matrix is denoted as 𝐈𝐈 = [1𝑖𝑖𝑖𝑖 ].
Symmetric Matrix: Symmetric matrices are square matrices that are equal
to its transpose, i.e. 𝐀𝐀T = 𝐀𝐀.
Skew-Symmetric Matrix: Skew-Symmetric matrices are square matrices
that are equal to its negative transpose, i.e. 𝐀𝐀T = −𝐀𝐀.
0 −2 3 0 2 5 1 0
Ex2: Specify these matrices: � �,� �,� �,� �.
2 0 0 −4 5 1 0 1
Answer: Skew-symmetric, diagonal, symmetric, identity.

Determinant of the Matrix:


A determinant of order 𝑛𝑛 is a scalar associated with an 𝑛𝑛 × 𝑛𝑛 square matrix
𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 � which is written as:
𝑎𝑎11 𝑎𝑎12 ⋯ 𝑎𝑎1𝑛𝑛
𝑎𝑎21 𝑎𝑎22 ⋯ 𝑎𝑎2𝑛𝑛
𝐷𝐷 = det 𝐀𝐀 = � ⋮ ⋮ ⋱ ⋮ �
𝑎𝑎𝑛𝑛1 𝑎𝑎𝑛𝑛2 ⋯ 𝑎𝑎𝑛𝑛𝑛𝑛
𝑛𝑛
𝐷𝐷 = � (−1)𝑖𝑖+𝑗𝑗 𝑎𝑎𝑖𝑖𝑖𝑖 𝑀𝑀𝑖𝑖𝑖𝑖 , 𝑖𝑖 = 1,2, … , 𝑜𝑜𝑜𝑜 𝑛𝑛.
𝑗𝑗=1

65 | P a g e
ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T. ALLAWI

The factor 𝑀𝑀𝑖𝑖𝑖𝑖 is called the minor of 𝑎𝑎𝑖𝑖𝑖𝑖 in 𝐷𝐷, which is the determinant of
order 𝑛𝑛 − 1, namely, the determinant of the submatrix of 𝐀𝐀 obtained from 𝐀𝐀 by
omitting the row and column of the entry 𝑎𝑎𝑖𝑖𝑖𝑖 , that is, the 𝑖𝑖th row and the 𝑗𝑗th
column.
For 𝑛𝑛 = 2:
𝑎𝑎 𝑏𝑏
𝐷𝐷 = det 𝐀𝐀 = � � = 𝑎𝑎𝑎𝑎 − 𝑏𝑏𝑏𝑏
𝑐𝑐 𝑑𝑑
For 𝑛𝑛 = 3:
𝑎𝑎11 𝑎𝑎12 𝑎𝑎13
𝐷𝐷 = det 𝐀𝐀 = �𝑎𝑎21 𝑎𝑎22 𝑎𝑎23 �
𝑎𝑎31 𝑎𝑎32 𝑎𝑎33
𝑎𝑎22 𝑎𝑎23 𝑎𝑎21 𝑎𝑎23 𝑎𝑎21 𝑎𝑎22
= 𝑎𝑎11 �𝑎𝑎 � − 𝑎𝑎 � � + 𝑎𝑎 � 𝑎𝑎32 �
32 𝑎𝑎33
12 𝑎𝑎 𝑎𝑎33 13 𝑎𝑎
31 31

1 3 0
Ex3: Find the determinant of the matrix 𝐀𝐀 = � 2 6 4�.
−1 0 2
Answer: 𝐷𝐷 = −12.

Cramer’s Rule for solving linear systems:


If a linear system of 𝑛𝑛 equations in the same number of unknowns
𝑥𝑥1 , 𝑥𝑥2 , … , 𝑥𝑥𝑛𝑛 :
𝑎𝑎11 𝑥𝑥1 + 𝑎𝑎12 𝑥𝑥2 + ⋯ + 𝑎𝑎1𝑛𝑛 𝑥𝑥𝑛𝑛 = 𝑏𝑏1
𝑎𝑎21 𝑥𝑥1 + 𝑎𝑎22 𝑥𝑥2 + ⋯ + 𝑎𝑎2𝑛𝑛 𝑥𝑥𝑛𝑛 = 𝑏𝑏2
𝑎𝑎𝑛𝑛1 𝑥𝑥1 + 𝑎𝑎𝑛𝑛2 𝑥𝑥2 + ⋯ + 𝑎𝑎𝑛𝑛𝑛𝑛 𝑥𝑥𝑛𝑛 = 𝑏𝑏𝑛𝑛
If the determinant 𝐷𝐷 = det 𝐀𝐀 is nonzero, the system has one solution. This
solution is given by the formulas:
𝐷𝐷1 𝐷𝐷2 𝐷𝐷𝑛𝑛
𝑥𝑥1 = , 𝑥𝑥2 = , … , 𝑥𝑥𝑛𝑛 =
𝐷𝐷 𝐷𝐷 𝐷𝐷
The determinant 𝐷𝐷𝑖𝑖 is the determinant obtained from 𝐷𝐷 by replacing the 𝑖𝑖th
column in 𝐷𝐷 by the column with the entries 𝑏𝑏1 , 𝑏𝑏2 , … , 𝑏𝑏𝑛𝑛 .
0 3 4 14.8
Ex4: Given the linear system 𝐀𝐀𝐀𝐀 = 𝐛𝐛, 𝐀𝐀 = �4 2 −1� , 𝐛𝐛 = �−6.3� Find
1 −1 5 13.5
the unknown vector 𝐱𝐱 using Cramer’s rule.

66 | P a g e
ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T. ALLAWI

−1.2
Answer: 𝐱𝐱 = � 0.8 �.
3.1

Inverse of a matrix:
The inverse of an 𝑛𝑛 × 𝑛𝑛 square matrix 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 � is denoted by 𝐀𝐀−1 and is
an 𝑛𝑛 × 𝑛𝑛 square matrix such that:
𝐀𝐀𝐀𝐀−1 = 𝐀𝐀−1 𝐀𝐀 = 𝐈𝐈
If 𝐀𝐀 has an inverse, then 𝐀𝐀 is called nonsingular matrix and the inverse is
unique; otherwise it is called singular.
For 𝑛𝑛 = 2:
𝑎𝑎 𝑏𝑏 1 𝑑𝑑 −𝑏𝑏
𝐀𝐀 = � � , 𝐀𝐀−1 = � �
𝑐𝑐 𝑑𝑑 𝑎𝑎𝑎𝑎 − 𝑏𝑏𝑏𝑏 −𝑐𝑐 𝑎𝑎
Generally:
T
�𝐶𝐶𝑖𝑖𝑖𝑖 �
𝐀𝐀−1 =
det 𝐀𝐀
The factor 𝐶𝐶𝑖𝑖𝑖𝑖 is called the cofactor of 𝑎𝑎𝑖𝑖𝑖𝑖 in det 𝐀𝐀.

To obtain the inverse of an 𝑛𝑛 × 𝑛𝑛 square matrix 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 �, we should do


the following:
Find the determinant of the matrix det 𝐀𝐀;
Transpose 𝐀𝐀 to get 𝐀𝐀T ;
T
Calculate the cofactor for each element in 𝐀𝐀T to get �𝐶𝐶𝑖𝑖𝑖𝑖 � ;
T
Divide �𝐶𝐶𝑖𝑖𝑖𝑖 � over det 𝐀𝐀 to get 𝐀𝐀−1 .
−1 1 2
Ex5: Given the matrix 𝐀𝐀 = � 3 −1 1�. Find 𝐀𝐀−1 .
1 3 4
−0.7 0.2 0.3
−1
Answer: 𝐀𝐀 = �−1.3 −0.2 0.7 �.
0.8 0.2 −0.2
If 𝐀𝐀 is a diagonal matrix, then its invers is a diagonal matrix with entries
which are the reciprocal of their counterpart in 𝐀𝐀.

67 | P a g e
ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T. ALLAWI

−0.5 0 0
Ex6: Given the matrix 𝐀𝐀 = � 0 4 0�. Find 𝐀𝐀−1 .
0 0 1
−2 0 0
−1
Answer: 𝐀𝐀 = � 0 0.25 0�.
0 0 1

Eigenvalues and Eigenvectors:


Let 𝐀𝐀 = �𝑎𝑎𝑖𝑖𝑖𝑖 � be an 𝑛𝑛 × 𝑛𝑛 square matrix and consider the vector equation:
𝐀𝐀𝐀𝐀 = λ𝐱𝐱
Here, 𝐱𝐱 is an unknown vector and λ is an unknown scalar. We look for
vectors 𝐱𝐱 for which the multiplication by 𝐀𝐀 has the same effect as the
multiplication by a scalar λ. A value of λ for which the above equation has a
solution 𝐱𝐱 ≠ 𝟎𝟎 is called eigenvalue, and the corresponding 𝐱𝐱 is called the
eigenvector of 𝐀𝐀 corresponding to that eigenvalue λ.
The eigenvalues of a square matrix 𝐀𝐀 are the roots of the characteristic
equation:
𝐷𝐷(λ) = det (𝐀𝐀 − λ𝐈𝐈) = 0
6 2 −2
Ex6: Given the matrix 𝐀𝐀 = � 2 5 0 �. Find the eigenvalue and
−2 0 7
eigenvectors of 𝐀𝐀 if one of the eigenvalues is λ1 = 3.
Answer: λ1 = 3; λ2 = 6; λ3 = 9; 𝐱𝐱1 = [2 −2 1]T ; 𝐱𝐱 2 =
[1 2 2] ; 𝐱𝐱 3 = [−2 −1 2]T ;
T

68 | P a g e
ENGINEERING AND NUMERICAL ANALYSIS 2015-2016 ENG. INST. DR. ZIYAD T. ALLAWI

Exercises:
1. Find the inverse of the following matrices:
4 2 1 1 0 3
4 1
� �, � 0 3 4� , � 2 1 5�
3 2
−1 1 3 −7 2 1
2. Solve the linear system 𝐀𝐀𝐀𝐀 = 𝐛𝐛 using matrix inversion:
2 1 −1 −9
2 −3 32
𝐀𝐀 = � � , 𝐛𝐛 = � � ; 𝐀𝐀 = � 3 −2 4 � , 𝐛𝐛 = � 5 �
3 7 −21
−2 −1 7 33
2 1 −3 −5
𝐀𝐀 = �1 −1 2 � , 𝐛𝐛 = � 12 �
7 −2 3 37
3. Find the eigenvalues and eigenvectors of the following matrices:
3 −2 1
7 −2 5 6
� �, � �, � 2 −4 3� , 𝜆𝜆 = 1
1 4 2 1
16 −4 1

69 | P a g e

You might also like