Matrices - PowerPoint PPT Presentation

1 / 74
About This Presentation
Title:

Matrices

Description:

Exercise: give examples of those special matrices ... ABC=(AB)C=A(BC)); distributive with respect to addition (one can distribute a ... k(AB)=(kA)B=A(kB) Observation ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 75
Provided by: cosmin
Category:
Tags: matrices

less

Transcript and Presenter's Notes

Title: Matrices


1
Chapter 6.1
  • Matrices

2
  • Issue organizing information.
  • A medical study researches the relation between
    height and weight. A number of people are asked
    to provide their data, anonymously, and the
    results are entered in a table, which might look
    as follows (height is in inches and weight in
    pounds)

3
(No Transcript)
4
  • All the data now is present, and perfectly
    organized if one needs the heights, one looks at
    the first column for weights, the second column
    if one is interested in finding whether a person
    has certain measurements, one looks at the rows.
    It is not only the number that is important, but
    also what it represents.

5
  • We notice the following characteristics of our
    data
  • all persons have both height and weight
  • no person has more than these two
  • no person has some other data (age, for example)
  • As a result, data can be organized in a
    rectangular table

6
  • Because of its rectangular shape, this kind of
    table can be characterized by its width and
    length, namely the number of rows and the
    number of columns it has (in our example 3 rows,
    2 columns.)
  • We call such a table a 3x2 matrix (three by two
    matrix)
  • 3x2 is called the size, or order, of the matrix

7
  • Of course, we can imagine that such a table has
    more than just 3 rows, or less more than 2
    columns, or less. As long as the table stays
    rectangular, its still going to be a matrix. The
    difference is going to be in its dimensions

8
  • A 1x4 matrix
  • a 4x1 matrix
  • A 2x3 matrix
  • a 3x3 matrix

9
  • Notice two peculiarities
  • brackets and parentheses ( ) are used to
    confine the matrix (useful when one writes many
    matrices next to each other) brackets are more
    popular, so we are going to use them from now on
  • rows are always mentioned first, and columns
    second hence, a 3x2 matrix has 3 rows and 2
    columns, and NOT the other way around

10
  • We can now generalize the situation for two
    natural numbers m and n, a mxn matrix is a table
    that has m rows and n columns, and looks like
    follows

11
  • A few words about the previous table
  • each a stands for a number
  • the indices should be viewed as pairs (hence the
    upper-leftmost a has index one-one, rather than
    eleven)
  • the first index stands for the row in which that
    number is, while the second stands for the column
    (the rule row first - column second is
    preserved)

12
  • What about those strange dots? Its a common
    trick, to symbolize those many missing numbers
    (which, since we dont know what values m and n
    have, it would be impossible to put down anyway)
  • the general element of a matrix is usually
    denoted by
  • and stands for the element at the inter-section
    of row i with column j

13
  • A usual method of constructing a matrix is to use
    the indices to compute the element corresponding
    to a certain row and certain column - useful for
    when we dont want to write down the whole
    matrix, but rather present the formula for its
    elements
  • Example

14
  • stands for

15
  • Matrices come in various sizes (orders), as you
    can see - but two kinds deserve special
    attention
  • 1xn matrices, called row matrices, or row vectors
    (why? because they only have 1 row)
  • mx1 matrices, called column matrices, or column
    vectors
  • Why are they important? Because they are the
    building blocks of all matrices

16
  • (for instance, a 3x2 matrix is made out of 2
    column vectors OR out of 3 row vectors)
  • a matrix with one row and one column (that is,
    has a single element) is both row and column
    vector

17
  • Some matrices are important not because of their
    size, but rather because of the data they contain
    (usually mostly 0)
  • the zero matrix, or 0 (a bigger, bold zero sign),
    which is a matrix with all its elements zero
    (matrices of any size)
  • diagonal matrices all elements are zero, with
    the exception of those elements whose indices are
    11, 22, 33, , etc (square sizes matrices only)

18
  • (notice that if the matrix has square size - such
    a matrix is called a square matrix - those
    elements constitute the diagonal of the square
    represented by the matrix)
  • upper triangular matrices all elements below the
    diagonal are zero lower triangular matrices all
    elements above the diagonal are zero (again, only
    square matrices)
  • Exercise give examples of those special matrices

19
  • When experimenting, sometimes it is imperative
    that we obtain same results all the time. So,
    when the data used is organized as matrices, how
    can we make sure that two such matrices are
    equal?
  • The idea they have to be identical - not only
    the data must be the same, but also the
    positions must coincide

20
  • Hence, we have a two step process in establishing
    whether a matrix is equal to another
  • step one check their sizes (orders) - must have
    same number of rows and same number of columns
  • step two check each element against its
    counterpart (for example, the element of index 11
    in the first matrix must be identical to the
    element 11 in the second matrix, etc)

21
  • Examples
  • not equal, since they have different orders (even
    though its the same data!)
  • same order, but not same positioning (the
    element of index 11 in the first is not same as
    element of index 11 in the second and again,
    same data is involved)

22
  • equality, since they are identical (same order,
    same positioning)

23
  • Finally, an interesting issue the first table we
    discussed, we considered it natural to have the
    height and weight on columns, and the persons on
    each row what if we considered it otherwise?
    Have the persons correspond to columns, and the
    height and weight as rows? It would be a
    different matrix, but the information is not
    altered, nor its representation

24
  • We call such a change transposition (or, one
    matrix is the others transposed) and is denoted
    by a capital T in the upper right
  • Examples

25
  • Notice that the change does the following
  • the first row becomes the first column
  • the second row becomes the second column
  • etc

26
  • A row matrix (vector) becomes a column matrix
    (vector) and viceversa
  • the size, in general, changes can you tell for
    what kind of matrices it will not?

27
Chapter 6.2
  • Matrix Addition and Scalar Multiplication

28
  • Since matrices have numbers as components, it is
    a natural question whether it is possible to
    combine matrices using operations such as
    addition, subtraction, multiplication etc

29
  • Lets consider addition and subtraction
  • the natural way of defining those operations is
    element by element, namely
  • add element 11 of first matrix to element 11 of
    second matrix
  • add element 12 of first matrix to element 12 of
    second matrix
  • etc

30
  • (same with subtraction)
  • Example

31
(No Transcript)
32
  • Finally, another rather simple operation is
    scaling of a matrix, or, how its called,
    multiplication by a scalar
  • given a number (the scalar) and a matrix,
    multiplying the number by the matrix stands for
    multiplying ALL elements of the matrix by the
    number (scale the matrix by the given number)

33
  • Example

34
Chapter 6.3
  • Matrix Multiplication

35
  • Review problems
  • for the matrix above give the entries
  • that are equal to 3

36
  • Perform addition, if possible, for the following
    pairs of matrices

37
  • What is the transposed of the following matrix

38
  • Matrix addition is quite simple - add
    corresponding entries in two matrices
  • one idea for multiplication use same kind of
    rule!
  • Unfortunately, not natural, nor rich enough

39
  • Idea behind matrix multiplication go to the
    building blocks of matrices, namely row
    matrices and column matrices
  • define the following multiplication rule between
    a row matrix and a column matrix

40
  • Notice a few things about this definition
  • the row matrix has 4 entries, hence 4 columns
  • the column matrix has 4 entries as well, which
    correspond to 4 rows
  • the result is a matrix with only one entry, a
    number basically

41
  • Examples

42
  • Counterexample
  • does not work!!! Must have same number of entries

43
  • Lets start making things more complex, by using
    instead of just a column matrix, a matrix with
    TWO columns

44
  • If you remember, we can rewrite the matrix on the
    right so it shows how its made out of columns

45
  • Now use the same definition as before for each of
    the columns

46
  • Example

47
  • And, of course, we can complicate things even
    further, by using instead of a single row matrix,
    a two rows matrix

48
  • Again, the trick is to view the left matrix as
    made out of rows, and the right matrix as made
    out of columns

49
  • The result

50
  • Awfully complicated, right?
  • In fact, not quite - lets analyze the situation
    a bit
  • in order to be able to multiply the matrices
    using our rule we need to have the rows in the
    first matrix have same number of entries as the
    columns in the second matrix

51
  • But what does that mean? The number of entries in
    the rows of the first matrix is THE NUMBER OF
    COLUMNS of the first matrix
  • the number of entries in the columns of the
    second matrix is THE NUMBER OF ROWS of the second
    matrix
  • in conclusion we can only multiply matrices that
    have this above property satisfied - and it can
    be seen right away if one looks at the sizes

52
  • Example a 2x3 matrix can be multiplied by a 3x5
    matrix a 7x20 matrix can be multiplied by a 20x2
    matrix a 3x3 matrix CANNOT be multiplied by a
    2x3 matrix (for all the cases above, in that
    order
  • observation order is VERY important
  • lets continue - what can you say about the
    dimension of the resulting matrix?
  • The number of rows is same as number of rows of
    first matrix

53
  • The number of columns is same as number of
    columns of second matrix
  • in conclusion the inner dimension tells you
    whether the multiplication can happen, but then
    gets lost, and only the outside dimensions are
    left
  • Example a 3x5 matrix multiplied by a 5x7 matrix
    5 is same, so they can be multiplied, while the
    resulting matrix has dimensions 3x7

54
  • How about the entries of the resulting matrix? We
    had those strange formulas above but they all
    follow a logical pattern (lets look back at the
    above product) we have a 2x3 matrix multiplied
    by a 3x2 matrix the result must be a 2x2 matrix
    (the common 3 tells us the product works, and
    then just disappears) lets say we want the
    entry on the first row, second column - it is
    produced by the first row of the first matrix
    times the second column of the second matrix

55
  • The entries in the first row of the first matrix
    are so entries which have
    first index 1, and any second index
  • the entries in the second column of the second
    matrix are so entries
    which have second index 2, and any first index
  • these get to be multiplied respectively
  • what do we have?

56
  • Now we can think of what happens in the general
    case, cant we? How should the two matrices look
    - they should be of sizes mxn the first one, and
    the second one must be nxp (the common n allows
    multiplication, m and p can be anything) the
    result will be a mxp matrix
  • entries of the resulting matrix, say a general
    entry,

57
  • This entry comes from the i-th row of the first
    times the j-th column of the second
  • the i-th row of the first matrix has the
    following entries
  • the j-th column of the second matrix has the
    following entries
  • notice again the importance of the same n

58
  • Finally, the ij entry of the result is
  • notice how each term has outside indices i and
    j, while the inner index is same for both
    factors that make up that term

59
  • Observations
  • not any two matrices can be multiplied together
  • matrix multiplication has similar properties as
    number multiplication for example, it is
    associative (a product of three can be broken
    down ABC(AB)CA(BC)) distributive with respect
    to addition (one can distribute a matrix
    multiplied with a sum of other two matrices
    A(BC)ABAC)

60
  • (Counter)-observation
  • as mentioned, multiplication is not commutative,
    not even in the case it is possible (for square
    matrices, in fact)
  • yet, scaling (the multiplication by a scalar)
    commutes, and does commute within a product
    (scaling a product is same as scaling the first
    factor and then multiplying, or scaling the
    second one and then multiplying
  • k(AB)(kA)BA(kB)

61
  • Observation
  • multiplication is not commutative, yet, using
    transposition, we get some kind of commutativity
  • (the transposed of the product is the product of
    the transposed matrices, but in the reverse order)

62
  • Observation (square matrices)
  • if we multiply square matrices, say a nxn by a
    nxn, the result is also nxn - nice feature
  • for square matrices we also have the 1, the so
    called unit matrix, or identity matrix, which
    is a diagonal matrix (remember, these only
    existed if the matrix was supposed to be square!)
    with 1 on the diagonal

63
  • Question for matrix addition do we have a matrix
    which has the role of 0? The answer is YES the
    zero matrix, the 0
  • does this zero matrix have same effect as the
    zero for numbers, when used in multiplication?
    YES (if multiplication is possible)

64
  • Finally what are the real uses of this matrix
    multiplication? Mainly its about writing certain
    relations in a more compact form
  • Example
  • Alice buys 3 gallons of milk, priced at 1.5 -
    hence pays 3 x 1.54.5
  • Bob buys 3 gallons of milk, priced at 1.5 AND 2
    loaves of bread, .99 each - how much does he pay?

65
  • Of course, 3 x 1.5 2 x 0.99 6.48 - but
    its too long more compact
  • its compact in the sense of a single
    multiplication being used (at least apparently)

66
  • Another example - systems of equations

67
  • Notice something interesting we keep using the
    same x, y, z for all the rows how about we
    write those unknowns as a matrix, and try to get
    each row of the system as a matrix product.
  • First row

68
  • Second row
  • third row

69
  • Looks very much like what we did in the beginning
    so lets consolidate all these
  • the resulting matrix should be ...

70
  • Hence we can write the system as follows

71
  • This approach is going to be very useful
    because we will start discussing matrices
    properties - and we will have a very powerful
    tool for solving even monster systems of equations

72
  • Solutions for the review problems
  • for
  • 3 is in position 12 (first row, second column)
    and in position 21(second row, forst column)

73
(No Transcript)
74
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com