Discrete-Chapter 03 Matrices

10
1 มหาวิทยาลัยราชภัฏสวนสุนันทา (ภาคการศึกษาที2/2555) เรียบเรียงโดย .วงศ์ยศ เกิดศรี CSC1001 Discrete Mathematics Matrices - 03 1. Definition of Matrices Matrices are used throughout discrete mathematics to express relationships between elements in sets . Matrices will be used in models of communications networks and transportation systems . Many algorithms will be developed that use these matrix models. Example 1 (4 points) Define a size of m × n matrix. 1) 6 5 4 6 5 4 3 2 1 3 2 1 …………………………………………… 2) 6 7 9 7 5 3 …………………….……………… 3) 0 0 0 0 0 0 0 0 ……………………………………………….. 4) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ……………………………………... Example 2 (4 points) Is matrix equal or not? why? 1) A = 6 5 4 3 2 1 B = 0 6 5 4 0 3 2 1 ………………………………………………………………………………….. 2) A = 6 5 4 3 2 1 B = 6 2 4 3 5 1 ……………………………………………………………………………………… 3) A = 6 5 4 3 2 1 B = 6 5 4 3 2 1 ……………………………………………………………………………………… 4) A = 0 0 0 1 0 0 B = 0 0 1 0 0 0 ……………………………………………………………………………………… CHAPTER 3 เมตริกซ์ (Matrices) Introduction to Matrices 1 A matrix is a rectangular array of numbers. A matrix with m rows and n columns is called an m × n matrix. The plural of matrix is matrices. A matrix with the same number of rows as columns is called square. We use boldface uppercase letters to represent matrices. Definition 1 Two matrices are equal if they have the same number of rows and the same number of columns and the corresponding entries in every position are equal. Definition 2

Transcript of Discrete-Chapter 03 Matrices

Page 1: Discrete-Chapter 03 Matrices

1

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Matrices - 03

1. Definition of Matrices

Matrices are used throughout discrete mathematics to express relationships between elements in sets. Matrices will be used in models of communications networks and transportation systems. Many algorithms will be developed that use these matrix models.

Example 1 (4 points) Define a size of m ×n matrix.

1) ⎥⎥⎥⎥

⎢⎢⎢⎢

654654321321

…………………………………………… 2) ⎥⎦

⎤⎢⎣

⎡−−

−679

753 …………………….………………

3) ⎥⎥⎥⎥

⎢⎢⎢⎢

00000000

……………………………………………….. 4) ⎥⎥⎥

⎢⎢⎢

111111111111111

……………………………………...

Example 2 (4 points) Is matrix equal or not? why?

1) A = ⎥⎦

⎤⎢⎣

⎡654321

B = ⎥⎦

⎤⎢⎣

⎡06540321

…………………………………………………………………………………..

2) A = ⎥⎦

⎤⎢⎣

⎡654321

B = ⎥⎦

⎤⎢⎣

⎡624351

………………………………………………………………………………………

3) A = ⎥⎦

⎤⎢⎣

⎡654321

B = ⎥⎦

⎤⎢⎣

⎡654321

………………………………………………………………………………………

4) A = ⎥⎦

⎤⎢⎣

⎡000100

B = ⎥⎦

⎤⎢⎣

⎡001000

………………………………………………………………………………………

CHAPTER

3

เมตรกิซ ์

(Matrices)

Introduction to Matrices 1

A matrix is a rectangular array of numbers. A matrix with m rows and n columns is called an m × n matrix. The plural of matrix is matrices. A matrix with the same number of rows as columns is called square. We use boldface uppercase letters to represent matrices.

Definition 1

Two matrices are equal if they have the same number of rows and the same number of columns and the corresponding entries in every position are equal.

Definition 2

Page 2: Discrete-Chapter 03 Matrices

2

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 03 - Matrices

Example 3 (8 points) Let A is 5 × 4 matrix

A =

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

87654321101086427531

1) Write W is 1 × 4 matrix at the 3rd row of A 2) Write X is 1 × 4 matrix at the 5th row of A

3) Write Y is 5 × 1 matrix at the 4th column of A 4) Write Z is 5 × 1 matrix at the 1st column of A

2. Matrix Arithmetic

Let m and n be positive integers and let

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

mnmm

n

n

aaa

aaaaaa

L

MMMM

L

L

21

22221

11211

The ith row of A is the 1 × n matrix [ ]inii aaa L21 . The j th column of A is the m × 1 matrix

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

mj

j

j

a

aa

M2

1

The (i, j )th element or entry of A is the element aij , that is, the number in the ith row and j th column of A. A convenient shorthand notation for expressing the matrix A is to write A = [aij], which indicates that A is the matrix with its (i, j )th element equal to aij.

Definition 3

Let A = [aij] and B = [bij] be m × n matrices. The sum of A and B, denoted by A + B, is the m × n matrix that has aij + bij as its (i, j )th element. In other words, A + B = [aij + bij].

Definition 4

Page 3: Discrete-Chapter 03 Matrices

3

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Matrices - 03

Example 4 (10 points) Let A and B be m × n matrices. Find A + B

A = ⎥⎦

⎤⎢⎣

⎡654321

B = ⎥⎦

⎤⎢⎣

⎡624351

Example 5 (10 points) Let A and B be m × n matrices. Find 3A + B

A = ⎥⎥⎥

⎢⎢⎢

⎡ −−−−

642043214321

B = ⎥⎥⎥

⎢⎢⎢

−−−

071111491

1752

Example 6 (10 points) Let A and B be m × n matrices. Find A - 2B

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

−−−−

−−

3561756243804321

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

−−−−−

1072241391121650

Example 7 (10 points) Let A be m × n matrix. Prove that A + A + A = 3A

A = ⎥⎥⎥

⎢⎢⎢

232130321

Let A be an m × k matrix and B be a k × n matrix. The product of A and B, denoted by AB, is the m × n matrix with its (i, j )th entry equal to the sum of the products of the corresponding elements from the ith row of A and the jth column of B. In other words, if AB = [cij ], then cij = ai1b1j + ai2b2j + … +aikbkj .

Definition 5

Page 4: Discrete-Chapter 03 Matrices

4

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 03 - Matrices

Figure: The Product of A = [aij ] and B = [bij ]

Example 8 (10 points) Let A be m × k matrix and B be k × n matrix. Find AB

A = ⎥⎦

⎤⎢⎣

⎡274512

B = ⎥⎥⎥

⎢⎢⎢

−−−

543325211322

Example 9 (10 points) Let A be m × k matrix and B be k × n matrix. Find AB

A =

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

−−−

316225433221

412

B = ⎥⎥⎥

⎢⎢⎢

−−

323112

Example 10 (10 points) Let A be m × k matrix and B be k × n matrix. Find AB

A = ⎥⎦

⎤⎢⎣

⎡443322

B = ⎥⎥⎥

⎢⎢⎢

⎡−

0321

01

Page 5: Discrete-Chapter 03 Matrices

5

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Matrices - 03

Example 11 (10 points) Let A and B be n × n matrices. Prove that AB ≠ BA

A = ⎥⎥⎥

⎢⎢⎢

232130321

B = ⎥⎥⎥

⎢⎢⎢

425121002

Example 12 (20 points) Let A, B and C be m × n matrices. Find (A + 2B)(3C)

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

1221376240432121

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

2498124112222154

C = ⎥⎥⎥⎥

⎢⎢⎢⎢

43122012

Page 6: Discrete-Chapter 03 Matrices

6

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 03 - Matrices

3. Transposes and Powers of Matrices

Example 13 (5 points) Show identity matrix I1, I2 and I4 Example 14 (10 points) Let A be m × n matrix. Prove that AIn = ImA = A

A = ⎥⎦

⎤⎢⎣

⎡443322

Example 15 (10 points) Let A be n × n matrix. Find A3

A = ⎥⎦

⎤⎢⎣

⎡1321

The identity matrix of order n is the n × n matrix In = [δij ], where δij = 1 if i = j and δij = 0 if i ≠ j . Hence

In = ⎥⎥⎥⎥

⎢⎢⎢⎢

100

010001

L

MOMM

L

L

for example I3 = ⎥⎥⎥

⎢⎢⎢

100010001

Definition 6

Multiplying a matrix by an appropriately sized identity matrix does not change this matrix. In other words, when A is an m × n matrix, we have AIn = ImA = A

Theorem 1

Powers of square matrices can be defined. When A is an n × n matrix, we have A0 = In , Ar = AAA…A

Theorem 2

r times

Page 7: Discrete-Chapter 03 Matrices

7

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Matrices - 03

Figure: A Symmetric Matrix or Square Matrix

Example 16 (5 points) Let A be m × n matrix. Find At

A = ⎥⎦

⎤⎢⎣

⎡443322

Example 17 (5 points) Let A be m × n matrix. Find At

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

43122012

Example 18 (5 points) Let A be m × n matrix. Find At

A = ⎥⎥⎥

⎢⎢⎢

232130321

Let A = [aij] be an m × n matrix. The transpose of A, denoted by At, is the n × m matrix obtained by interchanging the rows and columns of A. In other words, if At = [bij], then bij = aji for i = 1, 2, … , n and j = 1, 2, … , m.

Definition 7

A square matrix A is called symmetric if A = At . Thus A = [aij] is symmetric if aij = aji for all i and j with 1 ≤ i ≤ n and 1 ≤ j ≤ n.

Definition 8

Page 8: Discrete-Chapter 03 Matrices

8

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 03 - Matrices

Example 19 (5 points) Let A be m × n matrix. Show that A is a square matrix.

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

2051030350221321

Example 20 (5 points) Let A be m × n matrix. Show that A is not a square matrix.

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

0110101100001010

Example 21 (5 points) Let A be m × n matrix. Is A a square matrix? why?

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

1111100110101101

4. Zero–One Matrices

A matrix all of whose entries are either 0 or 1 is called a zero–one matrix. This arithmetic is based on the Boolean operations ∧ and ∨ , which operate on pairs of bits, defined by

⎩⎨⎧ ==

=∧otherwise 0,

1bb if ,1bb 21

21

⎩⎨⎧ ==

=∨otherwise 0,

1bor 1b if ,1bb 21

21

Example 22 (5 points) Let A and B be m × n zero–one matrices. Find A ∨ B

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

1111100110101101

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

0110101100001010

Let A = [aij] and B = [bij] be m × n zero–one matrices. Then the join of A and B is the zero–one matrix with (i, j )th entry aij ∨ bij . The join of A and B is denoted by A ∨ B. The meet of A and B is the zero–one matrix with (i, j )th entry aij ∧ bij . The meet of A and B is denoted by A ∧ B.

Definition 9

Page 9: Discrete-Chapter 03 Matrices

9

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics Matrices - 03

Example 23 (5 points) Let A and B be m × n zero–one matrices. Find A ∨ B

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

100110110001

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

001111111001

Example 24 (5 points) Let A and B be m × n zero–one matrices. Find A ∧ B

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

1101000100111101

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

0100110100001011

Example 25 (5 points) Let A and B be m × n zero–one matrices. Find A ∧ B

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

100110110001

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

001111111001

Example 26 (10 points) Let A, B and C be m × n zero–one matrices. Find A ∨ (B ∧ C)

A = ⎥⎥⎥⎥

⎢⎢⎢⎢

1101000100111101

B = ⎥⎥⎥⎥

⎢⎢⎢⎢

0100110100001011

C = ⎥⎥⎥⎥

⎢⎢⎢⎢

0110101100001010

Let A = [aij] be an m × k zero–one matrix and B = [bij] be a k × n zero–one matrix. Then the Boolean product of A and B, denoted by A B, is the m × n matrix with (i, j)th entry cij where cij = (ai1 ∧ b1j) ∨ (ai2 ∧ b2j) ∨ … ∨ (aik ∧ bkj)

Definition 10

.

Page 10: Discrete-Chapter 03 Matrices

10

มหาวิทยาลยัราชภฏัสวนสนุนัทา (ภาคการศึกษาท่ี 2/2555) เรยีบเรยีงโดย อ.วงศย์ศ เกิดศร ี

CSC1001 Discrete Mathematics 03 - Matrices

Example 27 (10 points) Let A be m × k zero–one matrix and B be k × n zero–one matrix. Find A B

A = ⎥⎦

⎤⎢⎣

⎡001011

B = ⎥⎥⎥

⎢⎢⎢

100000111001

Example 28 (10 points) Let A be m × k zero–one matrix and B be k × n zero–one matrix. Find A B

A = ⎥⎥⎥

⎢⎢⎢

111100110

B = ⎥⎥⎥

⎢⎢⎢

110000000111110

Example 29 (10 points) Let A be m × k zero–one matrix and B be k × n zero–one matrix. Find A B

A = ⎥⎦

⎤⎢⎣

⎡000111

B = ⎥⎥⎥

⎢⎢⎢

111001

.

.

.