You are on page 1of 35

Vectors & Matrices

Dr. Safaa O. Al-mamory


Department of Software 1
Matrices
Definition: A matrix is a rectangular array (table) of
numbers. E.g., a general mn matrix A has the form:

 a11 a12  a1n 


a a22 
 a2 n 
A  21
 [aij ]mn
    
 
am1 am 2  amn 

Note: A can be viewed as a function aij = a(i,j),


which gives the entry in the ith row and jth column.
Equality and Special Size Matrices
Definition: Two matrices are equal if they have
the same size (same number of rows, and same
number of columns), and their corresponding
entries are equal.
For an mn matrix A:
If m = 1, A is called a row matrix (vector).
If n = 1, A is called a column matrix (vector).
If m = n, A is called a square matrix.
Vectors
 By a vector u, we mean a list of numbers, say, a1, a2, . . ,an.
Such a vector is denoted by
u = (a1, a2, . . . , an)
 If all the ai = 0, then u is called the zero vector.
 Two such vectors, u and v, are equal, written u = v, if they
have the same number of components and corresponding
components are equal.
 Examples # Vector Comments
0 (1,2) This vector has two components
1 (1,2,3) This vector has three components

2 (2,3,1) Vector #1  vector # 2


3 (0,0,0,0) Zero vector, four components
Department of Software 4
Vector Operations
 Consider two arbitrary vectors u and v with the same
number of components, say

 The sum of u and v written u + v is as follows:

 The scalar product or, simply, product, of a scalar k and the


vector u, written ku, is the vector obtained by multiplying
each component of u by k; that is,

Department of Software 5
Vector Operations (Cont.)
 The dot product or inner product of the above vectors u and
v is denoted and defined by

 The norm or length of the vector u is denoted and defined


by

 We note that ||u|| = 0 if and only if u = 0; otherwise ||u||> 0.

Department of Software 6
Vector Operations (Example)

Department of Software 7
Matrix Addition and Scalar Multiplication

Definition: Two matrices of the same size are


added by adding their corresponding entries.
I.e.: [aij]mn + [bij]mn = [aij + bij]mn
A matrix is multiplied by a scalar by multiplying
all entries of the matrix by that scalar.
I.e.: c[aij] = [caij]
Subtraction is then defined by:
A  B = A + (1)B
Example
1 2  1 1 
Find: A  2   3 
3 4  2  3
Properties of Matrix Addition and
Scalar Multiplication
Let A, B, and C be matrices of the same size, and
let O be the all-zero matrix of that size. Then
A+B=B+A
(A + B) + C = A + (B + C)
A+O=A
A + (A) = O
c(A + B) = cA + cB
(c + d)A = cA + dA
c(dA) = (cd)A
1A = A
Example

Solve:

 1 2    1 1 
2 X    
  3
 X    
 3 4      2  3 
Matrix Multiplication
Definition: If A is an mn matrix, and B is an nr
matrix, then the product AB is an mr matrix, with
the (i, j) entry being the dot product of the ith row
of A and the jth column of B.
I.e.: [aij]mn[bij]nr = [k aikbkj]mr
The identity matrix In is an nn matrix [ij] with
ij = 1 (if i = j) and 0 otherwise.
The power of an nn matrix A is defined by:
Ak = AA A (k factors) with A1 = A and A0 = In.
Matrix Multiplication (Example)
 Example 1 (One dimension multiplication)

 Example 2 (One dimension multiplication)

Department of Software 13
Matrix Multiplication (Example)

 Ex:

Department of Software 14
Example
1 2   3 1
Let A  , B   
3 6   6 2
Find AB and BA.
Notes:
 In general, AB  BA.
 AB = O does not always imply that
one of A and B is O.
Properties of Matrix Multiplication
Let A, B, and C be matrices of suitable sizes,
and let In be the nn identity matrix. Then
(AB)C = A(BC)
A(B + C) = AB + AC
(A + B)C = AC + BC
c(AB) = (cA)B = A(cB)
ImA = A = AIn, if A is mn
Example
Write down the component equations
resulting from the matrix equation:
 x
 1 2 3    7 
 4 5 6   y   8 
  z   
Note:  
Any system of m linear equations in n
unknowns can be written as a matrix
equation of the form: Amnxn1 = bm1
Example: Perform the multiplication:
6 5 4
1 0 1 2 3  3 2 1
0  
 1 4 5 6  1 0 0
0 0 0 0 0 0 1 0
 
0 0 1
Note: We can use block multiplication by
partitioning the matrices into matching
blocks as follows:  I 2 A23   B23 
O   
 1 2 O13   I 3 
Example
Let
1 1
A 
1 1

Find A2, A3 and A4. Then guess An?


Matrix Transpose
Definition: If A is an mn matrix, then its
transpose AT is the nm matrix obtained by
interchanging the rows and columns of A, i.e.
the ith column of AT is the ith row of A.
E.g.: T
1 2
3 4    1 3 5 
   2 4 6
5 6  
Properties of the Transpose
Let A and B be matrices of suitable sizes.
Then
(AT)T = A
(A + B)T = AT + BT
(cA)T = c(AT)
(AB)T = BTAT
(Ak)T = (AT)k
Symmetric Matrices
Definition: A square matrix A is said to be
symmetric iff AT = A.
Equivalently, a matrix is symmetric iff it is
symmetric about its main diagonal.
Example: Which of the following matrices is
symmetric?
1 2 3
 0 2   0 0 0 
  2 0  ,  2 4 5  , 0 0 0 
   3 5 6  
 
Facts about Symmetric Matrices
 If A and B are symmetric, then so is A + B
and kA for any scalar k.
 If A is a square matrix, then A + AT is
symmetric.
 For any matrix A, both AAT and ATA are
symmetric.

Note: A symmetric matrix must be square.


Determinant of a Matrix
 A determinant is a function from the set of square matrices
to the set of real numbers. The determinant of a square
matrix A is denoted by det A or |A|. If A is an n x n matrix,
det A is called a determinant of order n.
 For example, the determinant of the matrix A = (aij)2 x 2 is
written as

Department of Software 24
Determinant of a Matrix (Cont.)

Department of Software 25
Determinant of a Matrix (Cont.)
 Determinants of non square matrices are not defined.
 If any two rows or columns of a square matrix A are
identical, det A = 0.

Department of Software 26
Matrix Inversion
 A square matrix A is said to be invertible if there exists a
matrix B such that
AB = BA = I, (the identity matrix).
 Example:

Department of Software 27
Matrix Inversion (2 × 2 Matrix)
 Consider an arbitrary 2 × 2 matrix
 Then,

 Example:

Department of Software 28
Matrix Inversion (3 × 3 Matrix)

Department of Software 29
Matrix Inversion (3 × 3 Matrix)

Department of Software 30
Matrix Inversion (3 × 3 Matrix)

Department of Software 31
Matrix Inversion (3 × 3 Matrix)

Department of Software 32
Matrix Inversion (3 × 3 Matrix)
 a

Department of Software 33
References
1. Seymour Lipschutz, and Marc Lipson, “Schaum’s
Outlines: Discrete Mathematics,” 3rd edition, McGraw-
Hill, 2007.
2. Ralph P. Grimaldi, Discrete And Combinatorial
Mathematics, An Applied Introduction, 5th Edition,
Pearson Education, Inc., 2004.
3. Thomas Koshy, Discrete Mathematics with Applications,
Elsevier Press, 2004.
4. Wafik, Introduction to Matrix Operations and Algebra,
ppt slides, 2009.

Department of Software 34
Thank You for
Listening.

Department of Software 35

You might also like