Presentation is loading. Please wait.

Presentation is loading. Please wait.

2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 행렬 (Matrices)

Similar presentations


Presentation on theme: "2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 행렬 (Matrices)"— Presentation transcript:

1

2 2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 행렬 (Matrices)

3 Discrete Mathematics by Yang-Sae Moon Page 2 Introduction A matrix (say MAY-trix) is a rectangular array of objects (usually numbers). ( 행렬은 수의 사각형 배열이다.) An m  n (“m by n”) matrix has exactly m horizontal rows, and n vertical columns. (m 개의 행과 n 개의 열을 갖는 행렬 ) Plural of matrix = matrices An n  n matrix is called a square matrix, whose order is n. ( 행과 열의 개수가 같은 행렬을 정방행렬이라 한다.) Tons of applications: Models within Computational Science & Engineering Computer Graphics, Image Processing, Network Modeling Many, many more … Matrices

4 Discrete Mathematics by Yang-Sae Moon Page 3 Matrix Equality Two matrices A and B are equal iff they have the same number of rows, the same number of columns, and all corresponding elements are equal. ( 두 행렬이 같은 수의 행과 열을 가지며 각 위치의 해당 원소의 값이 같으 면 “ 두 행렬은 같다 ” 고 정의한다.) Example Matrices

5 Discrete Mathematics by Yang-Sae Moon Page 4 Row and Column Order (1/2) The rows in a matrix are usually indexed 1 to m from top to bottom. The rows in a matrix are usually indexed 1 to m from top to bottom. ( 행은 위에서 아래로 1~m 의 색인 값을 갖는다.) The columns are usually indexed 1 to n from left to right. The columns are usually indexed 1 to n from left to right. ( 열은 왼쪽에서 오른쪽으로 1~n 의 색인 값을 갖는다.) Elements are indexed by row, then column. Elements are indexed by row, then column. ( 각 원소는 행 색인, 열 색인의 순으로 표현한다.) Matrices

6 Discrete Mathematics by Yang-Sae Moon Page 5 Row and Column Order (2/2) Let A be mn matrix Let A be m  n matrix [a i,j ], i th row = 1n matrix i th row = 1  n matrix [a i,1 a i,2 … a i,n ], j th column = m1 matrix j th column = m  1 matrix Matrices

7 Discrete Mathematics by Yang-Sae Moon Page 6 Matrix Sums mn mn The sum A+B of two m  n matrices A, B is the m  n matrix given by adding corresponding elements. (A+B 는 (i,j) 번째 원소로서 a i,j +b i,j 를 갖는 행렬이다.) A+B = C = [c i,j ] = [a i,j +b i,j ] where A = [a i,j ] and B = [b i,j ] Example Matrices

8 Discrete Mathematics by Yang-Sae Moon Page 7 Matrix Products (1/2) For an m  k matrix A and a k  n matrix B, the product AB is the m  n matrix: I.e., element (i,j) of AB is given by the vector dot product of the i th row of A and the j th column of B (considered as vectors). (AB 의 원소 (i,j) 는 A 의 i 번째 열과 B 의 j 번째 행의 곱이다.) Matrices

9 Discrete Mathematics by Yang-Sae Moon Page 8 Matrix Products (2/2) Example Matrix multiplication is not commutative! ( 교환법칙 성립 안 함 ) A = m  n matrix, B = r  s matrix AB can be defined when n = r BA can be defined when s = m Both AB and BA can be defined when m = n = r = s Matrices

10 Discrete Mathematics by Yang-Sae Moon Page 9 Matrix Multiplication Algorithm procedure matmul(matrices A: m  k, B: k  n) for i := 1 to m for j := 1 to n begin c i,j := 0 for q := 1 to k c i,j := c i,j + a i,q b q,j end {C=[c i,j ] is the product of A and B} What’s the  of its time complexity?  (m)·  (n)· (  (1)+  (k) ·  (1) ) Answer:  (mnk) Matrices

11 Discrete Mathematics by Yang-Sae Moon Page 10 Identity Matrices ( 항등 행렬 ) The identity matrix of order n, I n, is the order-n matrix with 1’s along the upper-left to lower-right diagonal and 0’s everywhere else. ((i,i) 번째 원소가 1 이고, 나머지는 모두 0 인 행렬 ) AI n = I n A = A Matrices

12 Discrete Mathematics by Yang-Sae Moon Page 11 Matrix Inverses ( 역행렬 ) For some (but not all) square matrices A, there exists a unique multiplicative inverse A -1 of A, a matrix such that A -1 A = I n. ( 정방 행렬 A 에 대해서 하나의 유일한 역행렬 A -1 이 존재한다.) If the inverse exists, it is unique, and A -1 A = AA -1. A A -1 I3I3 Matrices

13 Discrete Mathematics by Yang-Sae Moon Page 12 Matrix Transposition ( 전치 행렬 ) If A=[a i,j ] is an m  n matrix, the transpose of A (often written A t or A T ) is the n  m matrix given by A t = B = [b i,j ] = [a j,i ] (1  i  n,1  j  m) Flip across diagonal Matrices

14 Discrete Mathematics by Yang-Sae Moon Page 13 Symmetric Matrices ( 대칭 행렬 ) A square matrix A is symmetric iff A=A t. I.e.,  i,j  n: a ij = a ji. Which is symmetric? Matrices

15 Discrete Mathematics by Yang-Sae Moon Page 14 Powers of Matrices ( 멱행렬 ) If A is an n  n square matrix and p  0, then: A p  AAA···A (A 0  I n ) Example: p times Matrices

16 Discrete Mathematics by Yang-Sae Moon Page 15 Zero-One Matrices (0-1 행렬 ) Useful for representing other structures. E.g., relations, directed graphs (later in course) All elements of a zero-one matrix are 0 or 1 Representing False & True respectively. The meet of A, B (both m  n zero-one matrices): A  B :  [a ij  b ij ] (= [a ij b ij ]) The join of A, B: A  B :  [a ij  b ij ] Matrices

17 Discrete Mathematics by Yang-Sae Moon Page 16 Boolean Products ( 부울 곱 ) (1/2) Let A=[a ij ] be an m  k zero-one matrix, & let B=[b ij ] be a k  n zero-one matrix, The Boolean product of A and B is like normal matrix multiplication, but using “  ” instead “+” using “  ” instead of “∙” A⊙BA⊙B Matrices

18 Discrete Mathematics by Yang-Sae Moon Page 17 Example: Algorithm of Boolean Product ⊙ procedure Boolean product(A,B: zero-one matrices) for i := 1 to m for j := 1 to n begin c ij := 0 for q := 1 to k c ij := c ij  (a iq  b qj ) end {C = [c ij ] is the Boolean product of A and B.} Boolean Products ( 부울 곱 ) (2/2) Matrices

19 Discrete Mathematics by Yang-Sae Moon Page 18 Boolean Powers ( 부울 거듭제곱 ) For a square zero-one matrix A, and any k  0, the k th Boolean power of A is simply the Boolean product of k copies of A. (A 의 k 부울린 거듭제곱 ) A [k]  A ⊙ A ⊙ … ⊙ A, A [0]  I n Example: k times ⊙ ⊙ ⊙ Matrices

20 Discrete Mathematics by Yang-Sae Moon Page 19 Homework #4 Matrices


Download ppt "2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 행렬 (Matrices)"

Similar presentations


Ads by Google