< Return to Video

Converting directly from binary to hexadecimal

  • 0:01 - 0:03
    - [Voiceover] What I would
    like to do in this video is
  • 0:03 - 0:07
    explore the connection between
    the binary number system
  • 0:07 - 0:09
    which is clearly, or we've already
  • 0:09 - 0:11
    talked about this, is base two.
  • 0:11 - 0:15
    Explore the quotient between
    that and the hexadecimal,
  • 0:15 - 0:20
    hexadecimal number
    system, which is base 16.
  • 0:20 - 0:22
    The reason why this is interesting is
  • 0:22 - 0:26
    because 16 is a power of two.
  • 0:26 - 0:28
    What we'll see is you could always view
  • 0:28 - 0:30
    the hexadecimal number system.
  • 0:30 - 0:32
    It's almost condensed representation
  • 0:32 - 0:34
    of the binary number system.
  • 0:34 - 0:36
    This is actually why you will actually,
  • 0:36 - 0:38
    we've already talked
    about the binary system
  • 0:38 - 0:40
    is used extensively in computer science
  • 0:40 - 0:42
    and in even computer engineering.
  • 0:42 - 0:45
    It's the underlying
    things that are happening
  • 0:45 - 0:47
    or it's the representation
    used when we talk
  • 0:47 - 0:50
    about logic gates and
    transistors and things like that.
  • 0:50 - 0:53
    But hexadecimal also shows up a lot
  • 0:53 - 0:56
    because it's kind of a condensed
    representation of base two.
  • 0:56 - 0:58
    What do I mean by that?
  • 0:58 - 1:03
    Let's write out a arbitrary
    number in base two.
  • 1:04 - 1:07
    Let's say I have one, zero, one, one,
  • 1:07 - 1:12
    zero, one, one, one, zero.
  • 1:13 - 1:16
    This right over here is in binary
  • 1:16 - 1:18
    and I can even write in parenthesis .
  • 1:18 - 1:21
    This is a binary representation.
  • 1:21 - 1:26
    I want to convert this to
    hexadecimal representation.
  • 1:26 - 1:29
    I encourage you to pause the
    video and try out in your own.
  • 1:29 - 1:31
    I'll give you a clue
    on how you could think
  • 1:31 - 1:34
    about converting directly
    from base two to base 16.
  • 1:34 - 1:37
    Think about which one over
    here is in the 16s place
  • 1:37 - 1:41
    and what is the 256 place over here.
  • 1:41 - 1:45
    Then that might help you convert directly.
  • 1:45 - 1:46
    Assuming you had a go at it.
  • 1:46 - 1:50
    The really fun thing about
    between base two and base 16 is
  • 1:50 - 1:53
    you don't have to, well for any
    bases, you really don't have
  • 1:53 - 1:56
    to go through base 10
    but these in particular,
  • 1:56 - 2:00
    it's especially easy to go
    convert between these two bases.
  • 2:00 - 2:02
    The realization that you have to make is,
  • 2:02 - 2:06
    what are the powers, which
    places here are powers of 16?
  • 2:06 - 2:09
    This right over here,
    that is the ones place.
  • 2:09 - 2:11
    One way to think about it
    is all of these is going
  • 2:11 - 2:13
    to tell you how many ones we have.
  • 2:13 - 2:16
    Ones, twos, fours, and eights,
  • 2:16 - 2:18
    but another way to think
    about it is this is a count
  • 2:18 - 2:23
    of ones, all the way up
    to a potential of 15 ones.
  • 2:25 - 2:30
    This could count, this is
    going to be between zero,
  • 2:30 - 2:32
    and I'm going to write it down.
  • 2:32 - 2:35
    Actually, let me write it down in base 16.
  • 2:35 - 2:37
    It's going to be between zero and F.
  • 2:37 - 2:40
    It's going to be between zero and 15.
  • 2:40 - 2:42
    It's kind of a count between the number
  • 2:42 - 2:45
    of ones, I guess you could say.
  • 2:45 - 2:47
    Then this is the 16s place.
  • 2:47 - 2:50
    I'm going to do that in different color.
  • 2:50 - 2:54
    This right over here is the 16s place.
  • 2:54 - 2:58
    You could have between zero and 15s, 16s.
  • 2:58 - 3:02
    This is also going to
    be between zero and F,
  • 3:02 - 3:05
    when you look at this
    four digit binary numbers.
  • 3:05 - 3:07
    Once again, this whole
    thing right over here is
  • 3:07 - 3:10
    essentially going to tell
    you how many 16s you have.
  • 3:10 - 3:11
    This whole thing is going to tell you
  • 3:11 - 3:13
    how many ones you have.
  • 3:13 - 3:16
    Then the next four, we could keep going,
  • 3:16 - 3:17
    although there is only one place here.
  • 3:17 - 3:22
    We could go, this right
    over here is the 256s place.
  • 3:22 - 3:25
    This is going to be the next four digits.
  • 3:25 - 3:26
    They really have one right over here,
  • 3:26 - 3:29
    but one, two, three,
    and then the fourth one.
  • 3:29 - 3:34
    This is also going to be
    between zero and 15, 256s.
  • 3:34 - 3:36
    Hopefully, that helps you a little bit.
  • 3:36 - 3:38
    Actually, if this was
    a clue, I encourage you
  • 3:38 - 3:39
    to pause the video again (laughs) and see
  • 3:39 - 3:42
    if you can represent this in hexadecimal.
  • 3:42 - 3:46
    Let's try to work this thing together.
  • 3:46 - 3:48
    How many ones do we have?
  • 3:48 - 3:49
    What number is this?
  • 3:49 - 3:50
    These four digits right over here.
  • 3:50 - 3:55
    This is eight plus four plus two.
  • 3:55 - 3:59
    So eight plus four is 12, plus two is 14.
  • 3:59 - 4:02
    This right over here is 14.
  • 4:02 - 4:04
    How do we represent that in hexadecimal?
  • 4:04 - 4:08
    Well, 14 is one less than
    15 so it's going to be E.
  • 4:08 - 4:11
    This is going to be E.
  • 4:11 - 4:13
    This is E.
  • 4:13 - 4:18
    E is our hexadecimal
    representation of the number 14
  • 4:18 - 4:22
    comes right before our
    representation of the number 15 F.
  • 4:22 - 4:26
    Alright, now, how many 16s do we have?
  • 4:26 - 4:27
    Let's see, I have no eights.
  • 4:27 - 4:29
    I have a four, and I have a two.
  • 4:29 - 4:32
    We're going to have six 16s.
  • 4:32 - 4:35
    So we're going to have six 16s.
  • 4:35 - 4:38
    Then, how many 256s do I have?
  • 4:38 - 4:41
    I only have one 256.
  • 4:41 - 4:44
    One 256.
  • 4:44 - 4:48
    This number in hexadecimal,
    and I could write that.
  • 4:48 - 4:53
    This is in hexadecimal right
    over here, is one, six, E.
  • 4:54 - 4:56
    One, six, E.
  • 4:56 - 5:01
    I guess you could call this 256 E,
  • 5:01 - 5:06
    16 E.
  • 5:06 - 5:08
    I guess 14.
  • 5:08 - 5:11
    I (laughs) finally have to
    come up with a better way
  • 5:11 - 5:13
    of reading this hexadecimal number.
  • 5:13 - 5:16
    If you're not curious what
    number is this, because you don't
  • 5:16 - 5:18
    have to go through decimal
    just so you could comprehend it
  • 5:18 - 5:21
    in the number system that
    you're used to operating in.
  • 5:21 - 5:24
    One that's based off from the
    number of fingers you have.
  • 5:24 - 5:26
    Feel free to do so.
Title:
Converting directly from binary to hexadecimal
Description:

Converting directly from binary to hexadecimal

more » « less
Video Language:
English
Duration:
05:27

English subtitles

Revisions