Hexadecimal number system | Applying mathematical reasoning | Pre-Algebra | Khan Academy

Hexadecimal number system | Applying mathematical reasoning | Pre-Algebra | Khan Academy


– [Voiceover] We’re all
familiar with the base 10 number system, were
often called the decimal number system, where we have 10 digits Zero, one, two, three, four,
five, six, seven, eight, nine. Now, we started to see that we can have alternate number system. We can have a base two number system, or it’s the binary number system, where instead of 10 digits
you only have two digits. Each place, instead of being a power of ten is going to be a power of two. Now you can imagine that
we can keep extending this. We can extend to base three,
four, five, six, seven, eight, nine, or we could even go above 10. What I want to show you
in this video is a fairly, heavily used number system
that is larger than, or that has more digits than
base 10, and that base is 16. Base 16, often called the hexadecimal. Hexadecimal number system. As you can imagine, instead of only having 10 digits, it is going to have 16. What are those digits going to be? As we’ll see, instead of
the place is being powers of two or powers of ten,
there will be powers of 16. Let’s see, we can reuse
the existing 10 digits from the decimal number system. We can reuse zero, one, two, three, four, five, six, seven, eight, nine, but then we’re going to need
to have six more digits. The convention is to use
the first six letters. A, B, C, D, E, and F. You might say this is crazy. These are letters, not numbers,
but remember these are just arbitrary squiggles of
ink on a piece of paper. These are just arbitrary symbols that we’re grown to associate with things. You’re grown to associate
this symbol right over here with eight thing, with
the word eight which you associate with when you
see that many objects. If you’re thinking in hexadecimal,
this isn’t the letter A that makes you want to
say “ah”, or the letter B that makes you want to say “bababababa”. This is, literally, this represents if you had 10 things laying around. You would say, “I have
A things over there.” If you have 11, you’d say,
“I have B things over there.” 12, C things. 13, instead of saying,
“I have 13 things there”, “I have D things there.” Instead of saying, “I have 14”, you could say, “I can
have E things there.” Instead of saying, “I have 15”, you could say, “I have F things there.” Now, how does that help? Well, let’s see if we can represent the same number 231, or 231 in decimal. If we can represent that
same number in hexadecimal. What I’ll do is I’ll give
you what the number is, and then I’ll show you how we convert it. I’ll show you the place value, and I’ll show you how we convert it. 231 in hexadecimal. 231 in hexadecimal is the number E seven. E seven. Once again, you’re
like, “This looks crazy. “This is like I’m playing
like battleship or something.” What’s E seven? This is a number and I would say yes. This is a number. Now remember, base 16. What are these place values represent? This first place represents
16 to the zero power or still represents the ones place. This is the ones place. This is seven ones. Now, what is this place here represents? Well, in base 10, that
was 10 to the first power. In base two, that was
two to the first power. On base 16, this is going to be, I’ll leave those there, in base 16, this is going
to be 16 to the first power. This is literally, well let me write out the word, this is literally sixteens. This is E sixteens plus seven ones. Let me write that down. This is E sixteens plus seven ones. That’s what this number represents. Now, if we want to start rewriting this or re-conceptualizing it in our decimal number system, what is E sixteens? Well, the E if we think
in decimal, E is 14. E is 14. This is really, we can
really think of this if you want to think them decimals. This is 14 sixteens. It’s 14 sixteens. Well, that’s just the
same thing as 14 times 16. 14 times 16 is equal to 224. Maybe I should do that in same color. This thing right over
here is going to be 224. 14 sixteens, 14 times 16
is 224 plus seven ones. Well, 224 plus 7 is
going to be give you 231. Hopefully, you can appreciate it. You can represent the same quantity in any of these different number systems. In any number that you
can represent in decimal, you can also represent
that number in binary, or in hexadecimal, or in
base three, or in base 60, or in base 31, whatever you want to do. You might have noticed the pattern. The more symbols that we have, so in base 16, you have 16 symbols, the less place values we need to represent the same quantity. One way to think about it is each of the places are
containing more information. This is one of 16 characters. While this over here is
only one of two characters. This is one of ten characters. The more symbols that
you have, the more digits that you could put in each
place, the less places that you need to represent
a given quantity. Another way to think about it
is when you have a high base, like base 16, as you take
powers of 16, the next place right over here would be 16 squared, which, of course, is two
hundred and, wait a minute, 256. You’re clearly going to be able
to represent bigger numbers faster, I guess you could
say, or with less digits. It’s just an interesting thing to observe. But hopefully, you’re
going to kick out of, as much of a kick out of base 16 as I do, and it’s actually useful. This actually is used if
you look at most web pages. If you look at the actual code for there, or I guess you could say the
formatting line, the HTML for the webpage, when they specify colors, they tend to specify in hexadecimal. That’s because they’re specifying
the colors, the intensity of the red, the green, or the
blue, between zero and 255. Two digits of hexadecimal
are perfect for that, because if you think
about it, what is F F? What would this be if you
rewrite it in the decimal number system, and I encourage you
after this video is done, I encourage you to do that to
figure that out on your own. If you really want to do something fun, let me give you another one. Try to figure out what A F three is. Again, this isn’t very specialized. I just wanted to give you another interesting thing to work on.

100 thoughts on “Hexadecimal number system | Applying mathematical reasoning | Pre-Algebra | Khan Academy

  1. I was about to ask if F shouldn't be 16? But not no, it starts with 0.
    So does binary etc. So not "computers start counting with 0", every number system does.
    Now I even figured out why. Because number sign are just placeholders. And the lowest value you have to represent "nothing" in order to express "no times this power of base jump".
    Only humans start counting with 1.
    Seems super logic but who's really aware of it? Mindblowing!

  2. Worked out a formula to go from B-10 to B-x, with n being the number you want to transfer:

    n : x = y,~

    y * x = z

    n – z = a

    y[B-x] + a[B-x] = n[B-x]

  3. I do have a question that E comes on 15th number and should be given a value of 15 and F should become 16.
    Please respond to me.

  4. Soooo with RGB being measured between 0 -255, im assuming that we use 255 shades of each colour to match the Hexadecimal limit. ie we chose to use hexadecimal first and then decided 255 was adequate rather than a happy coincidence??

  5. Thanks, I've got my exam tomorrow and this is somewhere which caught me out in my last mock exam.

  6. We use your website in math class at school. At first I thought is was just another stupid ass math site, but after watching this, I feel different. I'm aiming for a career in computer science in the future, and knowing this is pretty important. You illustrated the way hexadecimal works very well, and I now understand it.

  7. Why is 7 (16^0) …. i have spend loaddsss of time trying to understand why, Hexidecimal only goes up to 9, and the 10 is A?
    up to 9, its just counting and adding up the base powers! But the i dont understand why 10, 11 ect. cant be "0 1 0 1 0" as in 8 + 2 = 10??

  8. that hexadecimal system is way more complicated than it has to be. I got interested in it from watching the Martian. all you have to do is take the letter F, put the number 10 beside it, and there's your entire alphabet. There would be no need for punctuation or spaces in the message. But I guess it's not unusual for people take something simple and confused themselves with it. I'm still trying to figure how you took "FF" and got the color white.

  9. that hexadecimal system is way more complicated than it has to be. I got interested in it from watching the Martian. all you have to do is take the letter F, put the number 10 beside it, and there's your entire alphabet. There would be no need for punctuation or spaces in the message. But I guess it's not unusual for people take something simple and confused themselves with it. I'm still trying to figure how you took "FF" and got the color white.

  10. some people here are saying their ages in hexadecimal as in A,B and C and stuff. I'm 16. nothing special about that..

  11. I started texting my friend in hexadecimals just to confuse her. I said, "48 49. 49 55 53 45 48 45 58 41 44 45 43 49 4d 41 4c 53 4e 4f 57 !" which means, "HI. I USE HEXADECIMALS NOW!" It's in all caps because if it weren't, things would get a LOT more complicated.

  12. okay I grasp the concept but somehow my programming lab is giving me a problem of hexadeceimals and I keep getting it wrong >:(

    Write a hexadecimal integer literal representing the value fifteen.
    _________________________________

    I don't need the answer but I would like some explanation as to why all of my 47 responses are incorrect, I tried everything lol

  13. Foe the longest time, I wanted to know how base-37 works. This because I figured out that once bases go over 10, it goes into the Latin alphabet, but the Latin alphabet only goes up to 26 digits, so how would base-37 work?

  14. Only if my Computer Science didn't suck and have such a strong accent, I would understand her but Khan Academy makes everything more understandable. Thank you for saving me, always able to teach well unlike a teacher at my school.

  15. Hey, I made quite a good binary, octal, hexadecimal & decimal conversion page.

    http://numeralconversion.co.uk/

    Click on "Click here to see how these add together to get the total" to see how the numbers all add together to get to the total.

    The way bits group together to make hexadecimal and octal numbers is also shown.

  16. Great explanation! Really helped me out! Up until this point I've been using RGB decimal for defining colors when coding in HTML/CSS, but now I can actually understand what I am doing when I use hexadecimals!

  17. Yeah Hexadecimals are killing my test scores man -_-. fine with binary and changing to decimals. Yet, hexadecimals really i don`t get, mostly when i`m working with multiple place holders.

    If i`m changing 17 to HEX, i understand its (1*16)+(1*7)=23…. Yet why am i not doing (1*16)+(1*17) to get 33?

    what would happen if i worked with 349 or something crazy, how would i solve?

    P.S. i am self studying all this and learning from the bottom to hopefully self-learn programming with a solid base. Don`t be to harsh.

  18. I understand how you converted the E7 to 231, I just wish you showed us how you converted the 231 to E7 in the first place.

  19. What is 33.60º?
    What is 30.82º? Converted to layman sixty degrees mathematics please? Is the 'º' denoting hexadecimal rather than degrees? And if yes. Is reality that 45º is the same in hexadecimal as well as in a sexegisimal degree language system? IE is that just a mathematical coincident? TY.

  20. I'm 13 and now I can tell anyone e who knows hexadecimal anything without anyone else knowing what's going on and I now feel like some kind of super spy

Leave a Reply

Your email address will not be published. Required fields are marked *