LECTURE 2 - Matrices
LECTURE 2 - Matrices
Chapter 2
Matrices
Definition
• A matrix is a rectangular array of numbers.
• The numbers in the array are called the elements of the
matrix.
Matrices
gements
w
7 1 3 5 6
2 3 4
A B 0 5 C 0 2 5
7 5 1 8 3 8 9 12
am
L
3/30
Row and Column 2 3 4 2Rows
A 3Columns
7 5 1
2 3 4
2 3 4 7 5 1 7 5 1
row 1 row 2 column 1 column 2 column 3
Submatrix Hiss
submatri
submatrics
1 7 4 1 7 7
1 4
A 2 3 0 P 2 3
Q 3 R
5 2
5 1 2 5 1 1
matrix A submatrice s of A
4/30
Size and Type
2 5 7 8
1 0 3 9 0 1 3
2 4 5 4 3 8 5
3 5 8 2
39 mns 3Row columns fowflu.mn columns
Size : 2 3 3 3 matrix 1 4 matrix 3 1 matrix
a square matrix a row matrix Ra column matrix
Location 681s iwis
2 3 4 The element aij is in row i , column j
A a13 4, a21 7 The element in location (1,3) is 4
7 5 1
Identity Matrices 923 1
diagonal size
Identitymatrices 1 0 0
I2 1 0 I 3 0 1 0
0 1
0 0 1
5/30
Properties:
•A specified number of rows and a specified number of
columns
•Two numbers (rows x columns) describe the dimensions
or size of the matrix.
2
Examples:
3x3 matrix
3 3
1 2 4 2 43 1 2
2x4 matrix
4 1 5 1 1
3
1 1
1x2 matrix 3 3 3 0 0 3 2
6/30
A matrix is denoted by a bold capital letter and the elements
within the matrix are denoted by lower case letters
e.g. matrix [A] with elements aij
pelements
ATAX
Amxn=
a11 a12 ... aij ain
a a22 ... aij
a2 n
21
n
mA
am1 am 2 aij amn
i goes from 1 to m
j goes from 1 to n 7/30
TYPES OF MATRICES
1 a11
4 1 a21
3
2
am1
8/30
TYPES OF MATRICES
1 1 6 0 3 5 2
9/30
TYPES OF MATRICES
3. Rectangular matrix
Contains more than one element and number of rows is not
equal to the number of columns
1 1
3 7 1 1 1 0 0
2 0 3 3 0
7 7
7 6
mn
10/30
TYPES OF MATRICES
4. Square matrix
The number of rows is equal to the number of columns
(a square matrix A has an order of m)
mxm
1 1 1 Amorder in
1911 1
9 9 0
3
0
6 6 1
922
11 1
The principal or main diagonal of a square matrix is composed of all
elements aij for which i=j
I 11/30
na
TYPES OF MATRICES
misms
5. Diagonal matrix
maindiagnole11 156
A square matrix where all the elements are zero except those on
the main diagonal
3 0 0 0
1 0 0 0
0 2 0 3 0 0
0 0 5 0
0 0 1
0 0 0 9
i.e. aij =0 for all i = j
aij = 0 for some or all i = j
12/30
TYPES OF MATRICES
1 0 0 0 is
0 1 0
0 www.a
aij 0
0 0 1 0 1 0
0 1 0
aij
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
14/30
TYPES OF MATRICES
8. Triangular matrix
A square matrix whose elements above or below the main
diagonal are all zero
1 0 0 1 0 0 1 8 9
2 1 0 2 1 0 0 1 6
5 2 3 5 2 3 0 0 3
15/30
TYPES OF MATRICES
186181
III
8a. Upper triangular matrix
A square matrix whose elements below the main
diagonal are all zero
1 7 4 4
aij aij aij 1 8 7 0
0 1 8 1 7 4
0 aij aij
0
0 0 7 8
0 aij 0 0 3
0 0 0 3
i.e. aij = 0 for all i > j
16/30
TYPES OF MATRICES
35
upper
8b. Lower triangular matrix
A square matrix whose elements above the main diagonal are all
zero
5566A
aij 0 0 1 0 0
2 1 0
aij aij 0
aij aij aij 5 2 3
i.e. aij = 0 for all i < j
17/30
TYPES OF MATRICES
9. Scalar matrix
A diagonal matrix whose main diagonal elements are
equal to the same scalar
A scalar is defined as a single number or constant
its
aij 0 0 1 0 0 6 0 0 0
0 1 0 0
0 aij 0 6 0 0
0 0 aij 0 0 1
0 0 6 0
i.e. aij = 0 for all i = j 0 0 0 6
aij = a for all i = j
18/30
2.1 Operations with Matrices
Matrix:
a11 a12 a13 a1n
a a a a
21 22 23 2n
row: m
column: n
size: m×n
19/30
i-th row vector
ri ai1 ai 2 ain row matrix
20/30
Diagonal matrix:
d1 0 0
0 d2 0
A diag(d1 , d 2 ,, d n ) M nn
0 0 d n
10 00
Trace:
1
diagnes's
If A [ aij ]nn 35
Then Tr ( A) a11 a22 ann
ALL 8169425
Diagnon
matrit
21/30
Example 1: Define the matrix
1 2 3 1 2 4
4 1 5
A 4 5 6 B=
3
7 8 9 3 3
22/30
Example 2: If
1 2 3 r1
A
4 5 6 r2
r1 1 2 3, r2 4 5 6
1 2 3
A c1 c2 c3
4 5 6
1 2 3
c1 , c2 , c3
4 5 6
23/30
www.WI
Equal matrix: Is
If A [aij ]mn , B [bij ]mn
t
Then A B if andsize
only if aij bij 1 i m, 1 j n
If A B
Then a 1, b 2, c 3, d 4
24/30
Matrix addition
0808
0 1 1 2 0 1 1 2 1 3
1 1
1 1 0o
o
8
2 3 3
2 2
0
3 3 0
2 2 0
columns
25/30
Scalar multiplication
to
Then cA [caij ]mn
Solution:
26/30
Matrix subtraction
A B A (1)B
ii www.W
2 After
Example 6: (Scalar multiplication and matrix subtraction)
1 2 4 2 0 0
A 3 0 1 B 1 4 3
2 1 2 1 3 2
28/30
Exercise 2
Find
29/30
Keywords in Section 2.1:
row vector: متجه صفي
column vector:)(متجه عمودي
diagonal matrix: مصفوفة قطرية
trace: اثر
equality of matrices: تعادل المصفوفات
matrix addition: جمع المصفوفات
scalar multiplication: ضرب بعدد ثابت
30/30