
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Yo bc shi hsjsnb. Jsnd hjd. Shjsb
Typology: Summaries
1 / 24
This page cannot be seen from the preview
Don't miss anything!
Dept. Information & Computer Sci., University of Hawaii Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by McGraw-Hill
3.8 Matrices
Applications of Matrices n Tons of applications, including: n Solving systems of linear equations n Computer Graphics, Image Processing n Games n Models within many areas of Computational Science & Engineering n Quantum Mechanics, Quantum Computing n Many, many more…
Row and Column Order n The rows in a matrix are usually indexed 1 to m from top to bottom. n The columns are usually indexed 1 to n from left to right. n Elements are indexed by row, then by column.
m m mn n n ij
1 2 21 22 2 11 12 1
Matrix Sums n The sum A + B of two matrices A , B (which must have the same number of rows, and the same number of columns) is the matrix (also with the same shape) given by adding corresponding elements of A and B. A + B = [ a ij
⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ −
⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − 11 5 11 9 11 3 9 3 0 8 2 6
n For an m × k matrix A and a k × n matrix B , the product AB is the m × n matrix: n I.e. , the element of AB indexed ( i , j ) is given by the vector dot product of the i- th row of A and the j- th column of B (considered as vectors). n Note: Matrix multiplication is not commutative!
=
k ij i j i j ik kj i j ij
1 1 1 2 2
Matrix Product Example ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = 1 1 2 1 3 1 1 1 0 2 A and B n Because A is a 2× 3 matrix and B is a 2 × 2 matrix, the product AB is not defined.
University of HawaiiUniversity of Hawaii Matrix Multiplication: Non-Commutative n Matrix multiplication is not commutative! n A : m × n matrix and B : r × s matrix n AB is defined when n = r n BA is defined when s = m n When both AB and BA are defined, generally they are not the same size unless m = n = r = s n If both AB and BA are defined and are the same size, then A and B must be square and of the same size n Even when A and B are both n × n matrices, AB and BA are not necessarily equal
Matrix Multiplication Algorithm procedure matmul (matrices A : m × k , B : k × n ) for i := 1 to m for j := 1 to n begin c ij
for q := 1 to k c ij := _c ij
n n Identity Matrices n The identity matrix of order n, I n , is the rank- n square matrix with 1’s along the upper-left to lower-right diagonal, and 0’s everywhere else. ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ⎩ ⎨ ⎧ ≠ = = = 0 0 1 0 1 0 1 0 0 0 if 1 if [ ] i j i j n ij I δ Kronecker Delta ∀ 1 ≤ i , j ≤ n
Powers of Matrices If A is an n × n square matrix and p ≥ 0, then: n A p = AAA···A (and A 0 = I n
n Example: p times ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − − ⋅ ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − ⋅ ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − ⋅ ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − 3 2 4 3 2 1 3 2 1 0 2 1 1 0 2 1 1 0 2 1 1 0 2 1 1 0 2 1 3
Matrix Transposition n If A = [ a ij ] 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 ij ] = [ a ji ] (1 ≤ i ≤ n ,1 ≤ j ≤ m ) ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ − = − ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ − − 3 2 1 1 2 0 0 1 2 2 1 3 t
Zero-One Matrices n Useful for representing other structures. n E.g. , relations, directed graphs (later on) n All elements of a zero-one matrix are either 0 or 1. n E.g., representing False & True respectively. n The join of A , B (both m × n zero-one matrices): n A ∨ B = [ a ij ∨ b ij
n The meet of A , B : n A ∧ B = [ a ij ∧ b ij ] = [ a ij b ij
Join and Meet Example ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ∨ ∨ ∨ ∨ ∨ ∨ ∨ = 1 1 0 1 1 1 0 1 1 1 0 0 1 0 0 1 1 0 A B ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ∧ ∧ ∧ ∧ ∧ ∧ ∧ = 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 0 A B and ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = 1 1 0 0 1 0 0 1 0 1 0 1 A B