< Return to Video

Inverse Matrix (part 1)

  • 0:00 - 0:01
  • 0:01 - 0:03
    We've learned about matrix
    addition, matrix subtraction,
  • 0:03 - 0:05
    matrix multiplication.
  • 0:05 - 0:07
    So you might be wondering,
    is there the
  • 0:07 - 0:09
    equivalent of matrix division?
  • 0:09 - 0:11
    And before we get into that,
    let me introduce
  • 0:11 - 0:12
    some concepts to you.
  • 0:12 - 0:14
    And then we'll see that there is
    something that maybe isn't
  • 0:14 - 0:16
    exactly division, but it's
    analogous to it.
  • 0:16 - 0:20
    So before we introduce that, I'm
    going to introduce you to
  • 0:20 - 0:22
    the concept of an
    identity matrix.
  • 0:22 - 0:24
    So an identity matrix
    is a matrix.
  • 0:24 - 0:29
    And I'll denote that
    by capital I.
  • 0:29 - 0:35
    When I multiply it times another
    matrix-- actually I
  • 0:35 - 0:37
    don't know if I should write
    that dot there-- but anyway,
  • 0:37 - 0:38
    when I multiply times
    another matrix, I
  • 0:38 - 0:40
    get that other matrix.
  • 0:40 - 0:45
    Or when I multiply that matrix
    times the identity matrix, I
  • 0:45 - 0:47
    get the matrix again.
  • 0:47 - 0:50
    And it's important to realize
    when we're doing matrix
  • 0:50 - 0:54
    multiplication, that
    direction matters.
  • 0:54 - 0:57
    I've actually given you some
    information here that-- we
  • 0:57 - 1:00
    can't just assume when we were
    doing regular multiplication
  • 1:00 - 1:02
    that, a times b is always
    equal to b times a.
  • 1:02 - 1:04
    It's important when we're doing
    matrix multiplication,
  • 1:04 - 1:08
    to confirm that it matters
    what direction you do the
  • 1:08 - 1:11
    multiplication in.
  • 1:11 - 1:15
    But anyway, and this works
    both ways only if we're
  • 1:15 - 1:20
    dealing with square matrices.
  • 1:20 - 1:23
    It can work in one direction or
    another if this matrix is
  • 1:23 - 1:24
    non-square, but it won't
    work in both.
  • 1:24 - 1:27
    And you can think about that
    just in terms of how we
  • 1:27 - 1:29
    learned matrix multiplication,
    why that happens.
  • 1:29 - 1:31
    But anyway, I've defined
    this matrix.
  • 1:31 - 1:33
    Now what does this matrix
    actually look like?
  • 1:33 - 1:35
    It's actually pretty simple.
  • 1:35 - 1:43
    If we have a 2x2 matrix, the
    identity matrix is 1, 0, 0, 1.
  • 1:43 - 1:50
    If you want 3x3, it's 1,
    0, 0, 0, 1, 0, 0, 0, 1.
  • 1:50 - 1:52
    I think you see the pattern.
  • 1:52 - 1:58
    If you want a 4x4, the identity
    matrix is 1, 0, 0, 0
  • 1:58 - 2:05
    0, 1, 0, 0, 0, 0, 1,
    0, 0, 0, 0, 1.
  • 2:05 - 2:08
    So you can see all that any
    matrix is, for a given
  • 2:08 - 2:11
    dimension-- I mean we could
    extend this to an n by n
  • 2:11 - 2:15
    matrix-- is you just have 1's
    along this top left to bottom
  • 2:15 - 2:15
    right diagonals.
  • 2:15 - 2:18
    And everything else is a 0.
  • 2:18 - 2:19
    So I've told you that.
  • 2:19 - 2:20
    Let's prove that it
    actually works.
  • 2:20 - 2:23
    Let's take this matrix
    and multiply it
  • 2:23 - 2:24
    times another matrix.
  • 2:24 - 2:26
    And confirm that that matrix
    doesn't change.
  • 2:26 - 2:31
    So if we take 1, 0, 0, 1.
  • 2:31 - 2:35
    Let's multiply it times-- let's
    do a general matrix.
  • 2:35 - 2:36
    Just so you see that this
    works for all numbers.
  • 2:36 - 2:39
    a, b, c, d.
  • 2:39 - 2:41
  • 2:41 - 2:42
    So what does that equal?
  • 2:42 - 2:45
  • 2:45 - 2:48
    We're going to multiply this
    row times this column.
  • 2:48 - 2:51
    1 times a plus 0 times c is a.
  • 2:51 - 2:52
    And that row times
    this column.
  • 2:52 - 2:55
    1 times b plus 0 times d.
  • 2:55 - 2:56
    That's b.
  • 2:56 - 2:58
    Then this row times
    this column.
  • 2:58 - 3:02
    0 times a plus 1 times c is c.
  • 3:02 - 3:04
    Then finally, this row
    times this column.
  • 3:04 - 3:07
    0 times b plus 1 times d.
  • 3:07 - 3:09
    Well, that's just d.
  • 3:09 - 3:10
    There you have it.
  • 3:10 - 3:13
    And it might be a fun exercise
    to try it the other
  • 3:13 - 3:15
    way around as well.
  • 3:15 - 3:17
    And actually it's an even better
    exercise to try this
  • 3:17 - 3:19
    with a 3x3.
  • 3:19 - 3:20
    And you'll see it
    all works out.
  • 3:20 - 3:24
    And a good exercise for you is
    to think about why it works.
  • 3:24 - 3:26
    And if you think about it, it's
    because you're getting
  • 3:26 - 3:27
    your row information from
    here and your column
  • 3:27 - 3:29
    information from here.
  • 3:29 - 3:32
    And essentially, anytime you're
    multiplying, let's say
  • 3:32 - 3:37
    this vector times this vector,
    you're multiplying the
  • 3:37 - 3:40
    corresponding terms and then
    adding them, right?
  • 3:40 - 3:42
    So if you have a 1 and a 0, the
    0 is going to cancel out
  • 3:42 - 3:45
    anything but the first term
    in this column vector.
  • 3:45 - 3:47
    So that's why you're
    just left with a.
  • 3:47 - 3:48
    And that's why it's going to
    cancel out everything but the
  • 3:48 - 3:49
    first term in this
    column vector.
  • 3:49 - 3:51
    And that's why you're
    left with just b.
  • 3:51 - 3:53
    And similarly, this will cancel
    out everything but the
  • 3:53 - 3:54
    second term.
  • 3:54 - 3:56
    That's why you're left
    with just c there.
  • 3:56 - 3:57
    This times this.
  • 3:57 - 3:58
    You're just left with c.
  • 3:58 - 3:59
    This times this.
  • 3:59 - 4:00
    You're just left with d.
  • 4:00 - 4:02
    And that same thing applies
    when you go to
  • 4:02 - 4:06
    3x3 or n by n vectors.
  • 4:06 - 4:07
    So that's interesting.
  • 4:07 - 4:09
    You have the identity vector.
  • 4:09 - 4:12
    Now if we wanted to complete
    our analogy-- so
  • 4:12 - 4:12
    let's think about it.
  • 4:12 - 4:15
    We know in regular mathematics,
    if I have 1 times
  • 4:15 - 4:18
    a, I get a.
  • 4:18 - 4:24
    And we also know that 1 over a
    times a-- this is just regular
  • 4:24 - 4:28
    math, this has nothing to do
    with matrices-- is equal to 1.
  • 4:28 - 4:30
    And you know, we call this
    the inverse of a.
  • 4:30 - 4:34
    And that's also the same thing
    as dividing by the number a.
  • 4:34 - 4:37
    So is there a matrix analogy?
  • 4:37 - 4:39
    Let me switch colors, because
    I've used this green a little
  • 4:39 - 4:40
    bit too much.
  • 4:40 - 4:45
    Is there a matrix, where if I
    were to have the matrix a, and
  • 4:45 - 4:49
    I multiply it by this matrix--
    and I'll call that the inverse
  • 4:49 - 4:52
    of a-- is there a matrix where
    I'm left with, not the number
  • 4:52 - 4:54
    1, but I'm left with
    the 1 equivalent
  • 4:54 - 4:55
    in the matrix world?
  • 4:55 - 4:59
    Where I'm left with the
    identity matrix?
  • 4:59 - 5:01
    And it would be extra nice if
    I could actually switch this
  • 5:01 - 5:03
    multiplication around.
  • 5:03 - 5:08
    So A times A inverse should
    also be equal to
  • 5:08 - 5:09
    the identity matrix.
  • 5:09 - 5:12
    And if you think about it, if
    both of these things are true,
  • 5:12 - 5:15
    then actually not only is A
    inverse the inverse of A, but
  • 5:15 - 5:17
    A is also the inverse
    of A inverse.
  • 5:17 - 5:18
    So they're each other's
    inverses.
  • 5:18 - 5:21
    That's all I meant to say.
  • 5:21 - 5:23
    And it turns out there
    is such a matrix.
  • 5:23 - 5:25
    It's called the inverse
    of A, as I've
  • 5:25 - 5:27
    said three times already.
  • 5:27 - 5:30
    And I will now show you
    how to calculate it.
  • 5:30 - 5:32
    So let's do that.
  • 5:32 - 5:35
    And we'll see calculating
    it for a 2x2 is fairly
  • 5:35 - 5:36
    straightforward.
  • 5:36 - 5:40
    Although you might think it's a
    little mysterious as to how
  • 5:40 - 5:43
    people came up with the
    mechanics of it, or the
  • 5:43 - 5:45
    algorithm for it.
  • 5:45 - 5:46
    3x3 becomes a little hairy.
  • 5:46 - 5:47
    4x4 will take you all day.
  • 5:47 - 5:52
    5x5, you're almost definitely
    going to do a careless mistake
  • 5:52 - 5:54
    if you did the inverse
    of a 5x5 matrix.
  • 5:54 - 5:57
    And that's better left
    to a computer.
  • 5:57 - 5:59
    But anyway, how do we calculate
    the matrix?
  • 5:59 - 6:01
    So let's do that, and then we'll
    confirm that it really
  • 6:01 - 6:03
    is the inverse.
  • 6:03 - 6:14
    So if I have a matrix A,
    and that is a, b, c, d.
  • 6:14 - 6:16
    And I want to calculate
    its inverse.
  • 6:16 - 6:18
    Its inverse is actually--
    and this is going
  • 6:18 - 6:19
    to seem like voodoo.
  • 6:19 - 6:21
    In future videos, I will give
    you a little bit more
  • 6:21 - 6:24
    intuition for why this works, or
    I'll actually show you how
  • 6:24 - 6:25
    this came about.
  • 6:25 - 6:29
    But for now it's almost better
    just to memorize the steps,
  • 6:29 - 6:31
    just so you have the confidence
    that you know that
  • 6:31 - 6:32
    you can calculate an inverse.
  • 6:32 - 6:38
    It's equal to 1 over this number
    times this. a times d
  • 6:38 - 6:41
    minus b times c.
  • 6:41 - 6:44
    ad minus bc.
  • 6:44 - 6:51
    And this quantity down here, ad
    minus bc, that's called the
  • 6:51 - 6:54
    determinant of the matrix A.
  • 6:54 - 6:55
    And we're going to
    multiply that.
  • 6:55 - 6:56
    This is just a number.
  • 6:56 - 6:57
    This is just a scalar
    quantity.
  • 6:57 - 7:01
    And we're going to multiply
    that by-- you switch
  • 7:01 - 7:02
    the a and the d.
  • 7:02 - 7:03
    You switch the top left
    and the bottom right.
  • 7:03 - 7:07
    So you're left with d and a.
  • 7:07 - 7:09
    And you make these two, you make
    the bottom left and the
  • 7:09 - 7:11
    top right, you make
    them negative.
  • 7:11 - 7:18
    So minus c minus b.
  • 7:18 - 7:20
    And the determinant-- once
    again, this is something that
  • 7:20 - 7:22
    you're just going to take a
    little bit on faith right now.
  • 7:22 - 7:24
    In future videos, I promise
    to give you more tuition.
  • 7:24 - 7:26
    But it's actually kind of
    sophisticated to learn what
  • 7:26 - 7:26
    the determinant is.
  • 7:26 - 7:29
    And if you're doing this in your
    high school class, you
  • 7:29 - 7:30
    kind of just have to know
    how to calculate it.
  • 7:30 - 7:32
    Although I don't like
    telling you that.
  • 7:32 - 7:34
    So what is this?
  • 7:34 - 7:36
    This is also call the
    determinant of A.
  • 7:36 - 7:38
    So you might see on an
    exam, figure out the
  • 7:38 - 7:38
    determinant of A.
  • 7:38 - 7:40
    So let me just tell you that.
  • 7:40 - 7:43
    And that's denoted by A in
    absolute value signs.
  • 7:43 - 7:48
    And that's equal
    to ad minus bc.
  • 7:48 - 7:50
    So another way of saying this,
    this could be 1 over the
  • 7:50 - 7:50
    determinant.
  • 7:50 - 7:54
    So you could write A inverse
    is equal to 1 over the
  • 7:54 - 8:03
    determinant of A times
    d minus b minus c, a.
  • 8:03 - 8:04
    Anyway you look at it.
  • 8:04 - 8:06
    But let's apply this to a real
    problem, and you'll see that
  • 8:06 - 8:08
    it's actually not so bad.
  • 8:08 - 8:13
    So let's change letters, just so
    you know it doesn't always
  • 8:13 - 8:13
    have to be an A.
  • 8:13 - 8:16
    Let's say I have a matrix B.
  • 8:16 - 8:21
    And the matrix B is 3-- I'm
    just going to pick random
  • 8:21 - 8:29
    numbers-- minus 4, 2 minus 5.
  • 8:29 - 8:31
    Let's calculate B inverse.
  • 8:31 - 8:35
    So B inverse is going to
    be equal to 1 over the
  • 8:35 - 8:36
    determinant of B.
  • 8:36 - 8:37
    What's the determinant?
  • 8:37 - 8:42
    It's 3 times minus 5 minus
    2 times minus 4.
  • 8:42 - 8:48
    So 3 times minus 5 is minus
    15, minus 2 times minus 4.
  • 8:48 - 8:50
    2 times minus 4 is minus 8.
  • 8:50 - 8:51
    We're going to subtract that.
  • 8:51 - 8:53
    So it's plus 8.
  • 8:53 - 8:56
  • 8:56 - 9:06
    And we're going to multiply
    that times what?
  • 9:06 - 9:11
    Well, we switched these two
    terms. So it's minus 5 and 3.
  • 9:11 - 9:14
    And we just make these
    two terms negative.
  • 9:14 - 9:17
    Minus 2 and 4.
  • 9:17 - 9:19
    4 was minus 4, so now
    it becomes 4.
  • 9:19 - 9:21
    And let's see if we can simplify
    this a little bit.
  • 9:21 - 9:26
    So B inverse is equal
    to minus 15 plus 8.
  • 9:26 - 9:28
    That's minus 7.
  • 9:28 - 9:30
    So this is minus 1/7.
  • 9:30 - 9:34
    So the determinant of B-- we
    could write B's determinant--
  • 9:34 - 9:36
    is equal to minus 7.
  • 9:36 - 9:45
    So that's minus 1/7 times
    minus 5, 4, minus 2, 3.
  • 9:45 - 9:48
    Which is equal to-- this is just
    a scalar, this is just a
  • 9:48 - 9:50
    number, so we multiply it times
    each of the elements--
  • 9:50 - 9:53
    so that is equal to minus,
    minus, plus.
  • 9:53 - 9:56
    That's 5/7.
  • 9:56 - 10:01
    5/7 minus 4/7.
  • 10:01 - 10:02
    Let's see.
  • 10:02 - 10:03
    Positive 2/7.
  • 10:03 - 10:06
  • 10:06 - 10:07
    And then minus 3/7.
  • 10:07 - 10:11
  • 10:11 - 10:12
    It's a little hairy.
  • 10:12 - 10:13
    We ended up with fractions
    here and things.
  • 10:13 - 10:16
    But let's confirm that this
    really is the inverse
  • 10:16 - 10:17
    of the matrix B.
  • 10:17 - 10:19
    Let's multiply them out.
  • 10:19 - 10:21
    So before I do that I have
    to create some space.
  • 10:21 - 10:30
  • 10:30 - 10:32
    I don't even need
    this anymore.
  • 10:32 - 10:34
  • 10:34 - 10:35
    There you go.
  • 10:35 - 10:35
    OK.
  • 10:35 - 10:40
    So let's confirm that that
    times this, or this times
  • 10:40 - 10:43
    that, is really equal to
    the identity matrix.
  • 10:43 - 10:44
    So let's do that.
  • 10:44 - 10:46
    So let me switch colors.
  • 10:46 - 10:54
    So B inverse is 5/7,
    if I haven't made
  • 10:54 - 10:55
    any careless mistakes.
  • 10:55 - 10:58
    Minus 4/7.
  • 10:58 - 11:01
    2/7.
  • 11:01 - 11:04
    And minus 3/7.
  • 11:04 - 11:05
    That's B inverse.
  • 11:05 - 11:07
    And let me multiply that by B.
  • 11:07 - 11:09
    3 minus 4.
  • 11:09 - 11:12
    2 minus 5.
  • 11:12 - 11:16
    And this is going to be
    the product matrix.
  • 11:16 - 11:18
    I need some space to
    do my calculations.
  • 11:18 - 11:21
  • 11:21 - 11:23
    Let me switch colors.
  • 11:23 - 11:28
    I'm going to take this row
    times this column.
  • 11:28 - 11:32
    So 5/7 times 3 is what?
  • 11:32 - 11:41
    15/7.
  • 11:41 - 11:45
    Plus minus 4/7 times 2.
  • 11:45 - 11:55
    So minus 4/7 times 2 is minus--
    let me make sure
  • 11:55 - 11:58
    that's right-- 5 times
    3 is 15/7.
  • 11:58 - 12:02
    Minus 4-- oh right, right--
    4 times 2, so minus 8/7.
  • 12:02 - 12:06
  • 12:06 - 12:08
    Now we're going to multiply this
    row times this column.
  • 12:08 - 12:17
    So 5 times minus 4
    is minus 20/7.
  • 12:17 - 12:25
    Plus minus 4/7 times minus 5.
  • 12:25 - 12:33
    That is plus 20/7.
  • 12:33 - 12:36
    My brain is starting to slow
    down, having to do matrix
  • 12:36 - 12:38
    multiplications with fractions
    with negative numbers.
  • 12:38 - 12:41
    But this is a good exercise
    for multiple
  • 12:41 - 12:42
    parts of the brain.
  • 12:42 - 12:42
    But anyway.
  • 12:42 - 12:43
    So let's go down and
    do this term.
  • 12:43 - 12:49
    So now we're going to multiply
    this row times this column.
  • 12:49 - 12:54
    So 2/7 times 3 is 6/7.
  • 12:54 - 12:57
    Plus minus 3/7 times 2.
  • 12:57 - 13:00
    So that's minus 6/7.
  • 13:00 - 13:01
    One term left.
  • 13:01 - 13:02
    Home stretch.
  • 13:02 - 13:07
    2/7 times minus 4
    is minus 8/7.
  • 13:07 - 13:14
  • 13:14 - 13:18
    Plus minus 3/7 times minus 5.
  • 13:18 - 13:25
    So those negatives cancel out,
    and we're left with plus 15/7.
  • 13:25 - 13:28
    And if we simplify,
    what do we get?
  • 13:28 - 13:32
    15/7 minus 8/8 is 7/7.
  • 13:32 - 13:33
    Well that's just 1.
  • 13:33 - 13:36
    This is 0, clearly.
  • 13:36 - 13:36
    This is 0.
  • 13:36 - 13:39
    6/7 minus 6/7 is 0.
  • 13:39 - 13:42
    And then minus 8/7 plus
    15/7, that's 7/7.
  • 13:42 - 13:44
    That's 1 again.
  • 13:44 - 13:45
    And there you have it.
  • 13:45 - 13:47
    We've actually managed to
    inverse this matrix.
  • 13:47 - 13:50
    And it was actually harder to
    prove that it was the inverse
  • 13:50 - 13:53
    by multiplying, just because we
    had to do all this fraction
  • 13:53 - 13:55
    and negative number math.
  • 13:55 - 13:57
    But hopefully that
    satisfies you.
  • 13:57 - 13:59
    And you could try it the other
    way around to confirm that if
  • 13:59 - 14:01
    you multiply it the other
    way, you'd also get
  • 14:01 - 14:02
    the identity matrix.
  • 14:02 - 14:04
    But anyway, that is how
    you calculate the
  • 14:04 - 14:06
    inverse of a 2x2.
  • 14:06 - 14:09
    And as we'll see in the next
    video, calculating by the
  • 14:09 - 14:12
    inverse of a 3x3 matrix
    is even more fun.
  • 14:12 - 14:14
    See you soon.
  • 14:14 - 14:14
Title:
Inverse Matrix (part 1)
Description:

Taking the inverse of a 2x2 matrix

more » « less
Video Language:
English
Duration:
14:14

English subtitles

Incomplete

Revisions