- In this video we're going to talk about the fundamentals of number systems. So, in all number systems, the first digits starts with zero. The base of the number system, like base-2, base-10, or we'll see base-16, tells us how many digits are in the number system. For example, decimal is base-10. That means there's 10 digits, starting with zero, 10 digits, zero through nine. Binary is base-2, two digits starting at zero, zero and one. Hexadecimal, this is base-16, and it has 16 digits. We're going to look at what those digits are in a moment. The first column is always the number of ones. So this will make sense in just a moment. Each of the following columns to the left of the ones column is n times the previous column, depending on the base of the number system. For example, decimal, base-10 number system, the rightmost column is the column of ones. Because it's base-10, the next column is the number of 10s, the column after that is the number of 100s, 10 times 10, the next column after that is 10 times 100, 1,000 et cetera. In base-2, first column, column of ones. The next column is two times that base-2, so two times the previous column, or two. The next column to the left of that is two times the previous column, two times two is four. Then we go two times four is eight, 16, et cetera. So base-16, again the first column is the column of ones. The next column is 16 times that or 16. Then the next column after that is 16 times 16, 256, et cetera. Don't worry, we're not going to need to go beyond that really that first column for what we need to do. But we're going to take a look at both the first and the second column in hexadecimal. Okay, so let's take a look at the hexadecimal digits. Hexadecimal is base-16. 16 digits starting with zero. So let's see what that looks like. On the left there I have the decimal numbers zero through 15, that gives us 16 digits. So let's see what those digits look like in hex. So we start off with zero, then one, two, so we use the same first 10 digits, zero through nine, that we use for base-10 decimal. We use those same digits for hexadecimal, base-16. But as you can see, we need to come up with another six digits. So what kinda symbols could we use? Well we could use hashtag, at symbol, exclamation mark, but that's not what we use. It's a lot easier to use a sequence of characters, digits, that we're already familiar with. Ah, the alphabet. So let's make 10, that'll be A, 11 B, 12 C, 13 is D, 14 is E, and 15 is F. So kinda give you an idea of that, if somebody is 10 years old in decimal, we say oh yeah we just say you're 10 years old. We use the decimal base-10 number system. But we could easily say you're A years old in hexadecimal base-16. Well when you turn 15, we say you're 15 years old in decimal. We could say you're F years old in base-16, hexadecimal. So you may be wondering, what if I want to go beyond 15? How do I handle that in hexadecimal? So let's take a look at first eight, nine, and some of the simple ones. Eight is eight in hexadecimal. Nine is nine. We said 10 is A. 14 would be E. 15 F. Now after F, we've run out of hexadecimal digits. But that's okay, so how would we do 16 in hexadecimal? Well the next column is 16 times the ones column, 16, so we'd have one 16 and zero ones. That's the same as 16 in decimal, base-10. Let's look at a couple of other examples. 17 decimal, how would that be in hexadecimal? Well that would be one 16 and one one. You just add up the number of 16s and the number of ones to get the decimal value. 20, what would that be? Let's see one 16, and what do I have left over? 16 from 20, that gives me four ones. 21, one 16, five ones, 16 plus five ones is 21. 26 would be one 16, okay. Wow what would we put in the ones column? We have one 16, so we take 16 away from 26. I've got 10 left over. How do I represent that in hexadecimal? A, so one 16 and 10 ones. There's our 12. We want to just represent a simple hexadecimal digit. 29, let's go back up to 29. Let's see, 16, that would be, how many 16s? One 16, so 16 from 29 leaves me 13. Oh, one D. Okay but we really just need to deal with the ones column in what we're going to be working with. So here's a nice chart that shows us the decimal, hexadecimal, and binary representations. So why do we use hexadecimal? Hexadecimal is commonly used in computer science, computer information systems, in representing MAC addresses, Ethernet MAC addresses, in representing IPv6 addresses. The reason is because hexadecimal is perfect for matching any four bits. If you notice in our binary here, we have four zeros to four ones. Every combination of four bits can be represented by a single hexadecimal value because from four zeros to four ones gives us 16 different unique combinations of four bits. So hexadecimal base-16 is perfect for representing this. So four bits can be represented by one hexadecimal value. Eight bits can be represented by two hexadecimal values. So here's a little exercise you can do. You can pause this video and see if you can make these conversions. But using our chart, it's quite easy. So all we have to do is take in this case the decimal and find the hexadecimal and binary values. Or take the hexadecimal value, F, and find the decimal and binary. Or the binary and find the decimal and hexadecimal value. Or the binary and find the decimal and hexadecimal value. Here are the answers. So what about two hexadecimal digits and converting that to eight bits? It's very easy. All we have to do is do one hexadecimal digit at a time. For example, two is 0010 in binary. A is 1010 in binary. So 2A is eight bits, 0010 1010. If you want a little exercise to practice this, try these examples. And here are the answers. So using this little chart, it's very easy to convert between decimal, hexadecimal, and binary.