matrices and vectors - metucourses.me.metu.edu.tr/courses/me210/transparencies/me...introduction to...

23
ME 210 Applied Mathematics for Mechanical Engineers Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 1/23 INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors

Upload: others

Post on 15-Jul-2021

23 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 1/23

INTRODUCTION TO LINEAR ALGEBRA

Matrices and Vectors

Page 2: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 2/23

INTRODUCTION TO LINEAR ALGEBRA

Matrices and Vectors

Matrix: A rectangular array of scalars (numbers, variables, or functions – real or

complex).

Elements ; i = 1,2,...,m , j = 1,2,...,n

Rows

Columns

Element ai,j

i th row j th column

Size or dimension of a matrix: m x n

Total no of rows

Total no of columns

[ ] [ ]Aa

aaa

aaa

aaa

ij

mnm2m1

2n2221

1n1211

==

L

MOMM

L

L

Page 3: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 3/23

Vector: A matrix with only one row (size 1×n, row vector ) or only one column

(size m×1, column vector) .

Equality of matrices: Two matrices [A] and [B] are said to be equal to each other

if and only if

i) they have the same dimension m×n, and

ii) their corresponding elements are equal; i.e.,

aij = bij for all i = 1, 2, …, m and j = 1, 2, …, n

Addition/Subtraction of matrices: Addition/subtraction is defined only for matrices

of the same size and result in another matrix of the same size.

For two matrices [A] and [B] of the same size [C] = [A] ± [B] implies that

cij = aij ± bij for all i = 1, 2, …, m and j = 1, 2, …, n

Page 4: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 4/23

Example:

Given

4 6 3 5 1 0 4 5 6 1 3 0 1 5 3[ ] [ ] = + = =

0 1 2 3 1 0 0 3 1 1 2 0 3 2 2A B

− − − + − + + + + +

Multiplication/Division by a scalar: Multiplication/division of a matrix by a scalar k

implies that all its elements are to be multiplied/divided by the same scalar k; i.e.,

k [A] = [k aij] or [A] / k = [aij /k]

4 6 3 5 1 0 4 5 6 1 3 0 9 7 3[ ] - [ ] = + = =

0 1 2 3 1 0 0 3 1 1 2 0 3 0 2A B

− − − − + − − − − − −

−=

−=

013

015[B]and

210

364[A]

Page 5: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 5/23

Example:

Given2.7 -1.8

[A]= 0.9 3.6

Then

Some important properties of matrices: Given matrices [A], [B], and [C] of the

same size and a set of scalar constants k1, k2, and k3, the following properties hold:

[A] + [B] = [B] + [A] commutative

[A] + ([B] + [C]) = ([A] + [B]) + [C]) associative

k1 ([A] + [B]) = k1 [A] + k1 [B] distributive

(k1 + k2) [A] = k1 [A] + k2 [A]

k1 (k2 [A]) = k2 (k1 [A]) = (k1k2) [A]

−=

−=

41

23[A]

910

and7.21.8

3.65.4[A]2

Page 6: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 6/23

=[B]

The elements of [C] are given as cij = ai1 b1j + ai2 b2j + ….. + ain bnj =

Matrix multiplication: Let [A] be a m×n matrix and [B] be a p×q matrix. The matrix

product [A] [B] is defined only if n = p and it gives a matrix [C] of size m×q and

shown as [C] = [A] [B]

Note that the element cij can be

interpreted as the dot product

(inner product) of the

ith row vector of [A]

and the

jth column vector of [B].

∑=

n

1kkjikba

=[A]

Page 7: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 7/23

1 0 23 2 1 7 2 6

[ ] [ ][ ] 5 3 10 4 6 56 36 16

6 4 2

C A B

− = = =

Example:

Given

Since number of columns of [A] and number of rows of [B] match, [A] and [B] matrices are called compatible as far as [A] [B] operation is concerned.

Hence, their product becomes

=

−=

246

135

201

[B]and640

123[A]

Page 8: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 8/23

Note that, in this example, even though [A][B] multiplication is defined, [B][A]multiplication is not defined since the number of columns of [B] (which is 3) andnumber of rows of [A] (which is 2) do not match.

Matrix multiplication is not commutative .

Even in cases where both [A][B] and [B][A] multiplications are defined, these multiplications are usually not equal to each other; i.e.,

[A] [B] ≠ [B] [A] , in general

Note that only if the matrix [A] is of size m×n and [B] is n×m, then both [C] = [A][B] and [D] = [B][A] are defined where [C] and [D] are square matrices of different sizes m and n, respectively; therefore, not equal to each other.

If matrices [A] and [B] are both square and of the same size n, then both [C] = [A][B] and [D] = [B][A] are defined where [C] and [D] are square matrices of the same size n; but not necessarily equal to each other.

Page 9: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 9/23

Example:

Transpose of a matrix: The transpose of an m×n matrix [A] is an n×m matrix [B]

whose rows are the columns and columns are the rows of [A]. It is denoted by [A]T.

Hence, [aij]T = [aji]

Given square matrices

−=

=

02

12[B]and

30

21[A]

−−

=

=

06

12

02

12

30

21[A][B]

−−=

−=

42

72

30

21

02

12[B][A]

Example:

Given square matrices

=

=

20

12[B]and

10

11[A]

=

=

20

32

20

12

10

11[A][B]

=

=

20

32

10

11

20

12[B][A]

≠≠≠≠

=

Page 10: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 10/23

Example:

Note that [b]T is a convenient way to describe a row vector.

The following are two important properties of transpose operation.

([A] + [B])T = [A]T + [B]T

([A] [B])T = [B]T [A]T Note the change of the order

−=→

−=

01

08

45

[A]004

185[A] T [ ]257[b]

2

5

7

[b] T =→

=

Page 11: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 11/23

Examples of sparse matrices:

Square matrix: A matrix with equal number of rows and columns.

Principal (main) diagonal

Off-diagonal elements

=

−=

=

000

000

002

010

000

[C]

0050

0001

0000

0300

[B]001

200[A]

Sparse matrix: A matrix with most of its elements zero

[ ]

=

nnn2n1

2n2221

1n1211

aaa

aaa

aaa

A

L

MOMM

L

L

Page 12: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 12/23

Symmetric matrix: A square matrix whose off–

diagonal elements at symmetric locations are equal;

that is aij = aji for all i, j (=1, 2, …, n)

Note that the transpose of a symmetric matrix [A] is

equal to itself; i.e., [A]T = [A]

Skew-symmetric matrix: A square matrix whose

off–diagonal elements at symmetric locations are

equal in size but of opposite sign; that is

aij = –aji for all i, j (=1, 2, …, n)

Note that the elements of main diagonal of a

skew-symmetric [A] are all zero; i.e.,

aii = 0 for all i =1, 2, …, n

Example:

−−

−=

425

201

513

[A]

Example:

−−

−=

051

504

140

[B]

Page 13: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 13/23

Note that any square matrix, [A], can be written as [A] = [A]s + [A]sk

where

is called the symmetric part of [A], and

is called the skew-symmetric part of [A].

2[A][A]

[A]T

s+=

2[A][A]

[A]T

sk−=

Example:

−−

−=

437

101

313

[A]

−−

−=

−−

−+

−−

−=

425

201

513

413

301

713

437

101

313

21

[A]s

−=

−−

−−

−−

−=

012

100

200

413

301

713

437

101

313

21

[A]sk

Page 14: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 14/23

Triangular matrix: A square matrix whose off–diagonal elements above or below

the main diagonal are all zero.

Example: Upper triangular matrix

Lower triangular matrix

Diagonal matrix: A square matrix whose off–diagonal elements are all zero.

That is aij = 0 for all i , j = 1, 2, …, n, i ≠ j

−−

=400

210

513

[A]

−=

451

014

003

[B]

−=

400

010

003

[A]

Page 15: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 15/23

Identity (unity) matrix: A diagonal matrix whose elements in the principal diagonal

are all 1. That is aii = 1 for all i = 1, 2, …, n

Null matrix: A m×n matrix whose elements are all zero. That is,

aij = 0 for all i = 1, 2, …, m and j = 1, 2, …, n

=

=

1000

0100

0010

0001

[B]10

01[A]

=

=

=00000

00000[C]

0000

0000

0000

0000

[B]

00

00

00

[A]

Page 16: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 16/23

Note that, contrary to the case in multiplications of scalars, if the multiplication of

two square matrices gives a null matrix then this does not imply that at least one

of the matrices multiplied should be a null matrix as well.

Banded matrix: A square matrix; some of its diagonals next to the main diagonal

are not zero, but the rest of the off-diagonal elements are all zero.

−−=

=→

−−

=

=

11

11[B][A]but

00

00[A][B]

11

11[B]&

22

11[A]

Page 17: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 17/23

Example:

Consider the free (unforced) motion of the following model which may be representing

the longitudinal vibrations of a long elastic body whose both ends are fixed.

Using the Newton’s 2nd law of motion for each mass, the governing equations of motion

can be written as:

k1 k2 k3 k4 k5 k6

m1 m2 m3 m4 m5

x1 x2 x3 x4 x5

0xk)x(xkxm

0)x(xk)x(xkxm

0)x(xk)x(xkxm

0)x(xk)x(xkxm

0)x(xkxkxm

5645555

54534444

43423333

32312222

2121111

=+−+=−+−+=−+−+=−+−+

=−++

&&

&&

&&

&&

&&

Page 18: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 18/23

[ ] [ ] + [ ] [ ] = [0]M x K x&&

Mass matrixdiagonal Position vector

Stiffness matrix, symmetrical and banded

Forcing vectornull vector

Governing equation in matrix form:

=

5

4

3

2

1

m0000

0m000

00m00

000m0

0000m

[M]

=

5

4

3

2

1

x

x

x

x

x

[x]

+−−+−

−+−−+−

−+

=

655

5544

4433

3322

221

kkk000

kkkk00

0kkkk0

00kkkk

000kkk

[K]

=

0

0

0

0

0

[0]

Page 19: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 19/23

Determinants, Minors, and Cofactors

Determinant:

It is a scalar quantity and defined only for square arrays.

Every square array A of size n has a unique determinant value D and it is shown as

[A] detA

aaa

aaa

aaa

D

nnn2n1

2n2221

1n1211

===

L

MOMM

L

L

Page 20: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 20/23

Minor:

It is a determinant of an array, which is one lower size than the array of an original

determinant.

A minor is always associated with only one of the elements of an original array.

Its array is obtained by deleting the row and column of the original array containing

that particular element; that is the minor Mij of the element aij of an array of size n is

the determinant of the array of size n–1, which is formed by deleting the ith row and

jth column of the original array.

Example:

425

201

513

A

−−

−=

42

20M11 −

−=→

21

53M32 −

−=

Page 21: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 21/23

Cofactor: It is also associated with only one of the elements of an original array and defined as Cij = (–1)i+j Mij

Example:

Evaluation of Determinants:

The value of the determinant of size one is same as the scalar involved; that is aa =

The value of the determinant of size two is obtained as

211222112221

1211 aaaaaa

aa−=

425

201

513

A

−−

−=

42

20M1)(C 11

1111 −

−=−=→ +

21

53M1)(C 32

2332 −

−−=−= +

Page 22: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 22/23

Example:

exp . . . 1

1 3 06 4 2 4 2 6

D 2 6 4 1 3 0 (12 0) 3(4 4) 120 2 1 2 1 0

1 0 2stansion w r t row

= = − + = − − + = −− −

− 144444424444443

Determinants of size three and higher can be evaluated by expanding it with

respect to one of its rows or columns as

∑∑==

===n

jany1i

ijij

n

iany1j

ijij

nnn2n1

2n2221

1n1211

CaCa

aaa

aaa

aaa

D

L

MOMM

L

L

Page 23: Matrices and Vectors - METUcourses.me.metu.edu.tr/courses/me210/Transparencies/ME...INTRODUCTION TO LINEAR ALGEBRA Matrices and Vectors ME 210 Applied Mathematics for Mechanical Engineers

ME 210 Applied Mathematics for Mechanical Enginee rs

Prof. Dr. Bülent E. Platin Spring 2014 – Sections 02 & 03 23/23

END OF WEEK END OF WEEK END OF WEEK END OF WEEK END OF WEEK END OF WEEK END OF WEEK END OF WEEK 11111111