Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have...

11
Matrix Arithmetic

Transcript of Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have...

Page 1: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Matrix Arithmetic

Page 2: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

A matrix M is an array of cell entries (mrow,column) and it must have rectangular dimensions (Rows x Columns).

Example:

2

5 17 2 20

5 0 6 15

21 10

r

M x

r t g

3x4 2,4 :m

3

4

15xDimensions:

Aarow,column

A

2,4 :a

Matrix

Page 3: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Scalar Multiplication

3 2 54

8 3 1

12 8 20

32 12 4

Every entry in the matrix is multiplied by the number outside the matrix (scalar).

Example:

Page 4: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Matrix Addition/SubtractionIF the matrices have the same dimensions, add

or subtract corresponding cell entries.

Examples:

a b c g h i

d e f j k l

a g b h c i

d j e k f l

5 3

12 0

4 10

5 3

12 0

4 10

b+h

8

12

14

Page 5: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Matrix Addition/Subtraction

Perform the indicated operation:

3 0.4 0

8 7 4 18 2

z w

The matrices MUST have the

same dimensions!

Page 6: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Matrix Multiplication

4 52 1 3

1 34 2 1

2 1

A

2x33x2

1

1

2

2

2 4 1 1 3 2 2 5 1 3 3 1

4 4 2 1 1 2 4 5 2 3 1 1

15 16

20 272x2

1Multiply the elements of each row of the first matrix by the elements of each column in the second matrix. 2Add the products. 3The answer goes into arow of 1st, column of 2nd.

a1,1 a1,2

a2,1 a2,2

Page 7: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Matrix Multiplication

Can we multiply these…

8

8 .1 2 5 2

0 1 52 2 0

8 17 5 5 9

4

4 5

7 2 .75 1 3

2 1

2 1 3 8 7

4 2 1 5 2

?

2x3 2x2 3x45x1

1x33x2

# of columns in 1st MUST be the

same as # of rows in 2nd!

No No

Yes

Page 8: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Matrix Multiplication

2 3 1 2 11 16

4 5 3 4 19 28

6 4 7 5 4 3 74 78 72

4 8 5 4 3 3 72 70 66

5 6 6 4 6 6 73 74 69

5 34 13 0.30 5.10

4 3 3 0.45 4.35

4 6 6 0.60 7.50

6 4 7

1 1 1 4 8 5 15 18 18

5 6 6

179

(b)

180

(a)

182

183

(b)

3x3 3x3 3x3

1x3 3x3 1x3

2x2 2x2 2x2

3x3 3x1 3x1

2 2

3 3

1 1

3 3

3 3

3 3

2 2

1 1

The dimensions of a product of matrices are the # of rows of the first matrix by the # of columns of

the second matrix.

In order to multiply matrices, the # of columns in 1st matrix MUST be the same as # of

rows in 2nd Matrix.

Page 9: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Order in Matrix Multiplication Matters

6 4 7 5 4 3 74 78 72

4 8 5 4 3 3 72 70 66

5 6 6 4 6 6 73 74 69

5 4 3 6 4 7 61 70 73

4 3 3 4 8 5 51 58 61

4 6 6 5 6 6 78 100 94

E B

B E

Page 10: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Identity Matrix

The product of a square matrix A and its identity matrix I, on the left or the right, is A.

AI = IA =A

General Form:

1 0 0 0 0

0 1 0 0 0

0 0 0 1 0

0 0 0 0 1

I Must be a

square matrix

Page 11: Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x4 3 4 15x.

Identity Matrix Example

5 8 1

5 2 8

0 7 15

5 8 1

5 2 8

0 7 15

1 0 0

0 1 0

0 0 1