chapter 2b. matrices - assakkaf · 2 ' assakkaf slide no. 30 Ł a. j. clark school of...

22
1 A. J. Clark School of Engineering Department of Civil and Environmental Engineering by Dr. Ibrahim A. Assakkaf Spring 2001 ENCE 203 - Computation Methods in Civil Engineering II Department of Civil and Environmental Engineering University of Maryland, College Park CHAPTER 2b. MATRICES ' Assakkaf Slide No. 29 A. J. Clark School of Engineering Department of Civil and Environmental Engineering ENCE 203 CHAPTER 2b. MATRICES Types of Matrices Unit or Identity Matrix A unit (identity) matrix is a diagonal matrix with all the elements in the principal diagonal equal to one. The identity or unit matrix, designated by I is worthy of special consideration. For any arbitrary matrix A, the following relationships hold true: AI = A and IA = A

Upload: dominh

Post on 21-Apr-2018

218 views

Category:

Documents


3 download

TRANSCRIPT

1

� A. J. Clark School of Engineering �Department of Civil and Environmental Engineering

by

Dr. Ibrahim A. AssakkafSpring 2001

ENCE 203 - Computation Methods in Civil Engineering IIDepartment of Civil and Environmental Engineering

University of Maryland, College Park

CHAPTER 2b.MATRICES

© Assakkaf

Slide No. 29

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Unit or Identity Matrix� A unit (identity) matrix is a diagonal matrix

with all the elements in the principal diagonal equal to one.

� The identity or unit matrix, designated by Iis worthy of special consideration.

� For any arbitrary matrix A, the following relationships hold true:

AI = A and IA = A

2

© Assakkaf

Slide No. 30

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Unit or Identity Matrix� Examples:

=

1001

I

=

1000010000100001

I

=

==

=

652542321

100010001

652542321

then652542321

matrix theIf IAAIA

© Assakkaf

Slide No. 31

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Null or Zero Matrix� A null (zero) matrix is any matrix in which

all the elements have zero values. It is usually denoted as 0.

� Examples:

0000

000000

3

© Assakkaf

Slide No. 32

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Symmetric Matrix� A symmetric matrix is a square matrix in

which aij = aji.� Examples:

1181098727

102439731

a23 = a32

653542321

a13 = a31

© Assakkaf

Slide No. 33

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Skew Symmetric� A skew-symmetric matrix is square matrix

with all values on the principal diagonal equal to zero and with off-diagonal values given such that aij = -aji.

� Examples:

−−

013102320

−−

−−−−

0126912045

64029520

4

© Assakkaf

Slide No. 34

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Transposed Matrix� Given a matrix A, the transpose of A,

denoted by AT and read A-transpose, is obtained by changing all the rows of A into the columns of AT while preserving the order.

� Hence, the first row of A becomes the first column of AT, while the second row of Abecomes the second column of AT, and the last row of A becomes the last column of AT.

© Assakkaf

Slide No. 35

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Transposed Matrix� In terms of the elements,� If matrix A has r rows and c columns, then

AT will have c rows and r columns� Note that

jiTij aa =

( ) AA TT =

5

© Assakkaf

Slide No. 36

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Types of Matrices

� Examples Transposed Matrix� Thus if

� and if

=

=

963852741

en th,987654321

TAA

=

=

84736251

hen t, 87654321 TAA

© Assakkaf

Slide No. 37

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� The primary arithmetic operations are� Addition� Subtraction� Multiplication, and� Division

� Matrix algebra has operations called addition, subtraction, and multiplication.

� No division in matrix algebra, instead there is matrix inversion

6

© Assakkaf

Slide No. 38

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Equality� The simplest relationship between two

matrices is equality.� Intuitively, one feels that two matrices

should be equal if their corresponding elements are equal.

� This the case provided that the two matrices are of the same order (size).

© Assakkaf

Slide No. 39

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Equality� Two matrices A = [aij]r×c and B = [bij]r×c are

equal if they have the same order and if aij = aij for all i and j.

� Thus, the equality

implies that

=

−+

17

325yxyx

13 and 725 =−=+ yxyx

7

© Assakkaf

Slide No. 40

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Addition� If A = [aij]r×c and B = [bij]r×c are both of order

(size) r × c, then A + B is a r × c matrix [cij]r×c where

ijijij bac +=

© Assakkaf

Slide No. 41

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Addition� Examples:

−=

+−+−−++

+−+=

−+

−− 022941

1)1(4)2()1(327

31)6(5

1412

36

123715

−−+

=

−−

+

tt

tttt

t4

1161035 22

8

© Assakkaf

Slide No. 42

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Addition� Examples:

=

=

112487320

and 11109531642

If BA

=+=

1211119118962

Then, BAC

© Assakkaf

Slide No. 43

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Addition� Examples:

� The following matrices A and B cannot be added since they are not of the same order.

� The equality C = A + B is not defined.

1126

and 120105

−=

−= BA

9

© Assakkaf

Slide No. 44

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Subtraction� If A = [aij]r×c and B = [bij]r×c are both of order

(size) r × c, then A - B is a r × c matrix [cij]r×c where

ijijij bac −=

© Assakkaf

Slide No. 45

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Subtraction� Example:

−=

=

112487320

and 11109531642

If BA

−=

−−−−−−−−−−−

=−=10971116922

1111102945)8(371

)3(62402 Then, BAC

10

© Assakkaf

Slide No. 46

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Commutative and Associative Laws� If A, B, and C represent matrices of the

same order, then1) A + B = B +A2) A + (B + C) = (A + B) + C3) A + 0 = A

© Assakkaf

Slide No. 47

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Commutative Law� Matrix addition is not directional

(commutative), that is

� Matrix subtraction is directional (noncommutative), that is

A + B = B +A

A - B ≠ B - A

11

© Assakkaf

Slide No. 48

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Two matrices are not multiplied together

elementwise.� It is not possible to multiply matrices of the

same order while it is possible to multiply certain matrices of different orders.

� If A and B are two matrices for which multiplication is defined, it is generally not the case that AB = BA.

© Assakkaf

Slide No. 49

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� General Rules

� Using A, B, and C to denote three matrices for the matrix product C = AB, the following are the rules for matrix multiplication:1. The number of columns in the first matrix A must

equal the number of rows in the second matrix B.2. The number of rows in the product matrix C equals

the number of rows in the first matrix A.3. The number of columns in the product matrix C

equals the number of columns in the second matrix B.

12

© Assakkaf

Slide No. 50

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� General Rules

4. The element of matrix C in row i and column j (cij) is equal to the sum of the products aik bkj:

∑=

=m

kkjikij bac

1

where m is the number of columns in AAAA, which isalso the number of rows in BBBB.

© Assakkaf

Slide No. 51

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� General Rules

5. Matrix multiplication is not commutative, that is,

6. Matrix multiplication is associative, that is,

AB ≠ BA

(AB) C = A (BC)

13

© Assakkaf

Slide No. 52

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Multiplication Terms

� Premultiplication of B by A means AB.� Premultiplication of A by B means BA.� Post multiplication of A by B means AB.� Post multiplication of B by A means BA.

© Assakkaf

Slide No. 53

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Rule 1:

The product of two matrices AB is defined if the number of columns of A equals the number of rows of BThus, if A and B are given by

−=

=011412230101

and 121016

BA

14

© Assakkaf

Slide No. 54

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Rule 1(cont�d):

then the product AB is defined since A has three columns and B has three rows. The product BA, however is not defined since Bhas four columns while A has only two rows.

When the product is written as AB, A is said to premultiply B while B is said to postmultiply A.

© Assakkaf

Slide No. 55

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Rule 2:

If the product AB is defined, then the resultant matrix will have the same number of rows as Aand the same number of columns as B.Thus, if A and B are given by

−=

=011412230101

and 121016

BA

15

© Assakkaf

Slide No. 56

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Rule 2(cont�d):

then, the product C = AB will have two rows and four columns since A has two rows and Bhas four columns.

© Assakkaf

Slide No. 57

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Easy Method for Rules 1 and 2

� Write the orders of the matrices on paper in the sequence in which the multiplication is to be carried out, that is, if AB is to be found where Ahas order (rA × cA) and B has order (rB × cB), write

(rA × cA) (rB × cB)

16

© Assakkaf

Slide No. 58

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Easy Method for Rules 1 and 2 (cont�d)

� If the two adjacent numbers (indicated by the arrows) cA and rB are equal, then the multiplication is defined.

� The order of the product matrix C = AB is obtained by canceling the adjacent numbers and using the two remaining numbers, that is, the order of C is rA × cB

( )( )BBAA crcr ××

order of C

© Assakkaf

Slide No. 59

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Easy Method for Rules 1 and 2 (cont�d

� Examples:

−=

=011412230101

and 121016

BA

Order: 2 × 3 Order 3 × 4

(2 × 3) (3 × 4)

The matrix product C = AB is defined.The order of AB is 2 × 4

17

© Assakkaf

Slide No. 60

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Easy Method for Rules 1 and 2 (cont�d

� Examples:

=

−=

121016

and 011412230101

AB

Order: 2 × 3Order 3 × 4

(3 × 4) (2 × 3)

The matrix product C = BA is not defined.

© Assakkaf

Slide No. 61

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication� Rule 3:

If the matrix product AB is defined, where C is denoted by [cij], then the element cij is obtained by multiplying the elements in the ith row of Aby the corresponding elements in the jth column of B and adding.Thus, if A has order rA × cA, B has order rB × cB, cA = rB, and

18

© Assakkaf

Slide No. 62

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Rule 3 (cont�d):

then, c11 is obtained by multiplying the elements in the first row of A by the corresponding elements in the first column of Band adding; hence,

=

CCCC

C

C

BBBB

B

B

AAAA

A

A

crrr

c

c

crrr

c

c

crrr

c

c

ccc

cccccc

bbb

bbbbbb

aaa

aaaaaa

L

MMMM

K

K

L

MMMM

K

K

K

MMMM

K

K

21

22221

12111

21

22221

11211

21

22221

11211

112112111111 BA rc bababac +++= L

© Assakkaf

Slide No. 63

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Rule 3 (cont�d):

the element c12 is obtained by multiplying the elements in the first row of A by the corresponding elements in the second column of B and adding; hence,

=

CCCC

C

C

BBBB

B

B

AAAA

A

A

crrr

c

c

crrr

c

c

crrr

c

c

ccc

cccccc

bbb

bbbbbb

aaa

aaaaaa

L

MMMM

K

K

L

MMMM

K

K

K

MMMM

K

K

21

22221

12111

21

22221

11211

21

22221

11211

212212121112 BA rc bababac +++= L

19

© Assakkaf

Slide No. 64

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Rule 3 (cont�d):

the element is obtained by multiplying the elements in the first row of A by the corresponding elements in the second column of B and adding; hence,

=

CCCC

C

C

BBBB

B

B

AAAA

A

A

crrr

c

c

crrr

c

c

crrr

c

c

ccc

cccccc

bbb

bbbbbb

aaa

aaaaaa

L

MMMM

K

K

L

MMMM

K

K

K

MMMM

K

K

21

22221

12111

21

22221

11211

21

22221

11211

BBAABABACC crcrcrcrcr bababac +++= L2211

CCcrc

© Assakkaf

Slide No. 65

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Example: Matrix MultiplicationFind AB and BA if

−−=

=

1100987

and 654321

BA

(2 × 3) (3 × 2)

order (2 × 3)order (3 × 2)

The matrix product AB is defined with an order of 2 × 2

20

© Assakkaf

Slide No. 66

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Example (cont�d): Matrix Multiplication

−−

=

−+++

+++=

−++−++−−++−++−

=

=

48172111

665032-04528-33-208-0187-

)11(6)10(5)8(4)0(6)9(5)7(4)11(3)10(2)8(1)0(3)9(2)7(1

11-0109

8-7-

654321

AB

© Assakkaf

Slide No. 67

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Example (cont�d): Matrix Multiplication

=

−−=

654321

and 1100987

AB

(3 × 2) (2 × 3)

order (2 × 3)order (3 × 2)

The matrix product BA is defined with an order of 3 × 3

21

© Assakkaf

Slide No. 68

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Example (cont�d): Matrix Multiplication

−−−

−−−=

−−−+++−−−−−−

=

−+−+−++++

−+−−+−−+−=

−−=

665544876849695439

6605504406027501840948214014327

6)11(3)0(5)11(2)0(4)11(1)0()6(10)3(95)10(2)9()4(10)1(96)8(3)7(5)8(2)7(4)8(1)7(

654321

110

10987

BA

© Assakkaf

Slide No. 69

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication by a Scalar� The multiplication of a matrix A by a scalar

s has the effect of multiplying each element aij in the matrix by the scalar. The resulting elements of a matrix B can be expressed as

ijij sab =

22

© Assakkaf

Slide No. 70

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 � CHAPTER 2b. MATRICES

Matrix Operations

� Matrix Multiplication by a Scalar� Example:

Find B = sA if s = 5, and

=

11109531642

A

=

=

==

5550450155

302010

)11(5)10(5)9(5)0(5)3(5)1(5)6(5)4(5)2(5

11109031642

5sAB