Eun Hyun Jedd2 (Matrix Multplication)

Embed Size (px)

Citation preview

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    1/47

    Matrix Multiplication

    Hyun Lee, Eun Kim, Jedd Hakimi

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    2/47

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    3/47

    2.1 Matrix Operations

    Key IdeaMatrix multiplication corresponds to

    composition of linear transformation.

    The definition of AB, is critical for the

    development of theory and application.

    Then what is the definition of AB?

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    4/47

    What is AB?

    The subscripts tell the location of an entry.If A is m x n matrix, then m represents

    the row and n represents the column. Inthe product AB, left-multiplication by Aacts on the columns of while right

    multiplication by B actions on the rows ofA. In other words..

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    5/47

    Definition of AB continues..

    Columns j Columns j

    of AB = A x of B

    Also, the following is true.

    (row i of AB)=(row i of A) x B

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    6/47

    How do we add matrix?

    Let me show you an example:suppose

    A= 2 3 B= 4 77 8 6 5 ,

    then what is A+B?

    = 2+4 7+3 = 6 10

    7+6 8+5 13 13

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    7/47

    Example of Bx

    X= 1 1 13 2 5 then.. What is 4x?

    4x= 4 4 4

    12 8 20

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    8/47

    Matrix Multiplication

    How do we multiply the matrix?When matrix x is multiply by B, we are transforming x

    into vector Bx. Lets say we multiply by Bx by A again,now we have created A(Bx). This is the key concept tomove on to next steps!

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    9/47

    We can always express A(Bx) and (AB)x to

    represent this composite mapping as a matrixthat was multiplied by a single factor.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    10/47

    Example

    IfAis a 4 x 5 matrix and Bis a 5 x 3matrix, what are the sizes ofABand BA, if

    they are defined?

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    11/47

    Remember! You cant multiply anymatrix. There are some conditions!The number of columns on the first matrix

    has to be same as the number of rows of

    the second matrix.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    12/47

    Theorem 1

    A,B, and C are the matrices of same size and let r and s

    be the scalars. A+B= B+A 1.1 (A+B)+C=A+(B+C) 1.2 A+0=A 1.3

    r(A+b)=rA+rB 1.4 (r+s)A= rA+sA 1.5 R(sA)=(rs)A 1.6

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    13/47

    Lets prove it!

    Note that all the vectors of A, B, and C hasthe same size. Lets say 2nd column of vectorof A, B, C is A2, B2, and C2(respectively).

    Then 3(A2+B2)= 3A2+3B2 The first matrix has the same size as the

    matrix on the right: The corresponding

    columns are equal so from 1.1-1.6 it can beproved using same logic as I proved 1.4

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    14/47

    A X B

    A= 3 0 B= 4 71 1 6 8

    5 2

    A x B=3(4)+0(6), 3(7)+0(8)

    1(4)+1(6), 1(7)+1(8)

    5(4)+2(6), 5(7)+2(8)= 12 21

    10 15

    32 51

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    15/47

    Row-Column Rule

    If we think of the ith row of A and the jthcolumn of B as vectors, then theelement in the ith row and the jth columnof C is, scalar product of the ith row of Aand jth column of B.

    (AB)ij=Ai1Bij+Ai2Bi2+.+AinBnj

    Rowi(AB)=rowi(a) * B

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    16/47

    Theorem 2

    A, B, and Cs are matrices they have sizesfor which the indicates sums andproducts are defined

    A(BC)=(AB)C 2.1

    A(B+C)=AB+AC 2.2

    (B+C)A=BA+CA 2.3r(AB)=(rA)B=A(rB) 2.4

    ImA=A=AIn 2.5

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    17/47

    Lets prove it

    A(BC)=(AB)C ------Associative lawFirst observe that both A(BC) and

    (AB)C are m x n matrices.

    Let Uj denote column j of AB.

    Since Uj==ABj, column j of A(BC)isAUj= A(BCj).

    Further more, column j of (AB)C

    is (AB)Cj=A(Bcj).It follows that the corresponding columns

    of A(BC) and (AB)C are equal.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    18/47

    Example of Associative Law

    A=(1,2), B= 3 4 C= 3 0 22 1 5 1 0

    AB=(1,2) 3 4 = (7,6)2 1

    (AB)C=(7,6) 3 0 2 =(51,6,4)

    5 1 0A(BC)=(1,2) 29 4 6 =(51,6,14)

    11 1 4

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    19/47

    Proof of Distributive Law

    Both (A+B)C and AC +BC are m *n matrices, andso we compare the corresponding columns ofeach matrix. For any j, ACj and BCj are the jthcolumns of AC and BC, respectively. But ..

    *jth column of (A+B)C is (A+B)Cj=ACj+BCj.

    By property of matrix jth column of AC+BC is

    equal to the above. This left distributive lawapplies to right distributive law, too.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    20/47

    Example of Distributive Law

    A=(1,2) B= 3 4 C= 4 2

    0 5 1 7

    B+C= 7 6 A(B+C)=(9,30)

    1 12

    AB=(3,14)

    AC=(6,16)

    AB+AC=(9,30)

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    21/47

    AB is not equal to BA

    A = 1 B= (3,4,1,5); AB= 3 4 1 52 6 8 2 10

    0 0 0 0 0

    1 3 4 1 5

    BA

    =(3,4,1,5) 1 = (3+8+5)=16

    2

    0

    1

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    22/47

    The Transpose of a Matrix

    Sometimes it is of interest to interchange therows and columns of a matrix

    The transpose of a matrix A=Aij is a matrixformed from A by inter changing rows andcolumns such that row i of A becomes columns Iof the transpose matrix. The transpose is

    denoted by At and At=Aji when A= Aij

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    23/47

    Example of the Transpose

    A= 1 3 At= 1 22 5 3 5

    A= 1 3 4 At= 1 00 1 0 3 1

    4 0

    It will be observed that ifAis m x n,At isn x m

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    24/47

    Matrix Powers

    If matrix A is squared it isdenoted as ..

    =A2

    Ak=A x A x A xA

    A0=1(its theconventionright??)

    Therefore, A0

    X=X (itself)Also, you we can apply that

    (Ap)x(Aq)= A(p+q)

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    25/47

    Theorem 3

    Suppose A and B represent matrices

    of appropriate sizes for the following

    sums and products.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    26/47

    Theorems (a)-(c) are obvious,

    so the proofs are not required.

    For theorem (d),

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    27/47

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    28/47

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    29/47

    2.4 Partitioned Matrices

    I see youve chosen the Red Pill

    Welcome to

    Part i t ioned Matr ices

    -Not as exciting as an action movie,

    but it might still make you sayWhoa.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    30/47

    By now youre teeming with anticipation,eager to expand your mind. Lets start

    by clearing a few things up by

    understanding what we are working with.

    Why dont I ask your first question for you

    (because you might feel silly talking to a

    computer screen):

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    31/47

    Q. What is a Part i t ioned Matr ixand what

    does it have to do with me?

    A. Ah, good question.

    Well, a Part i t ioned Matr ixis a matrix that hasbeen broken down into several smaller matrices

    But why tell you when I can show you a picture.

    Lets say I have a 5x4 Matrix called G

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    32/47

    And now a partitioned version (with the partitionlines in red):

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    33/47

    And now we name the individual parts

    (AKA: BlocksorSubmatr ices):

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    34/47

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    35/47

    Now we can rewrite G as a 3x2 Matrix:

    Now doesnt that look a lot nicer than our original G?

    Of course is does.

    Now, to address the second part of your question,

    this partitioned matrix can help us by speeding upa supercomputer or something like that. Isnt that exciting?

    Dont answer that. On to more questions

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    36/47

    Q. Can I addPart i t ioned Matr ices

    to each other?

    A. Sure, as long as the matrices being multiplied

    are identical in the way they are partitioned.Each b lockcan be added to its corresponding

    block.

    Too easy. How bout another question?

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    37/47

    Q. Can I multiply Part i t ioned Matr ices

    by a scalar?

    A. Sure, as long you multiply the scalar

    one block at a time.

    Come on, give me a harder one

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    38/47

    Q. How can I multiply Part i t ioned Matr icesby each other?

    A. Okay, now youve asked a tough one.

    The best way to explain this is through anexample. In the following example uppercase

    Letters will represent blocks.

    First matrix J partitioned like so:

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    39/47

    Or

    And Matrix K partitioned like so:

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    40/47

    Or

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    41/47

    First of all, Part i t ionedMatrices can

    Only be multiplied because the numberof vertical partitions of the first matrix

    in the equation is equal to the number

    of horizontal partitions of the second

    matrix in the equation.

    matrix:

    (Row 1:) AE+BF

    (Row 2:) CE+DF

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    42/47

    Now we expand each one of the Blocks.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    43/47

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    44/47

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    45/47

    Q. What Theorems can we get from this

    method of multiplying PartitionedMatrices?

    A. Well youre a curious one arent you?

    Well, in fact there is a theorem. Its called theColumn-row Expansion Theorem and it basicallymeans that because blocks work so well formultiplication then columns of the first matrixin a multiplication equation will correspond torows of the second matrix in that equation tomake an easier way to compute the equation.Heres the proof:

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    46/47

    For each row index Iand column indexj,

    the (i,j)- entry in column n(A) row n(B) isthe product of a(i,N)from column n(A)and b (N, j)from row n(B). Hence the(i, j)entry in the sum shown in (1) is:

    a (i, 1)b(1,j)+a (i, 2)b(2,j)++a (i,N)b(N,j)This sum is also the (i, j)-entry in the AB, by therow-column rule.

    Or you can just take my word for it.

  • 7/27/2019 Eun Hyun Jedd2 (Matrix Multplication)

    47/47

    The End

    Produce by NYU Math Masters