In this video, we're going to talk about how to convert a decimal number to a hexadecimal number. So how can we do this? Well first, you need to understand that the decimal number is based on a base 10 system. For example, let's say if we have the digit 49. The first digit can be anything from 0 to 9. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. And the same is true for the second digit.
We have 10 options to choose from. So the decimal system is a base 10 numbering system. Now what about the hexadecimal system? Notice that it's composed of two words, hexa and decimal. Hexa corresponds to 6. Decimal, as we can see here, corresponds to 10. And so if we add 6 and 10, this will give us 16. So the hexadecimal numbering system is a base 16 system.
Now, you need to know the numbers that corresponds from that corresponds to the hexadecimal system from the decimal system. So the number 1 in the decimal system has the same value in the hexadecimal system. So 1 corresponds to 1, 2 corresponds to 2, and 3 corresponds to 3, and so forth.
5 corresponds to 5, 6 corresponds to 6. I'm going to continue the pattern here. And I forgot one number, and that's 0. 0 corresponds to 0. I started with 1, but we should have started with 0. Now, once you get to 10, that's where it changes. 10 doesn't correspond to 10. 10 in the decimal system corresponds to A in the hexadecimal system. 11 in the decimal system... corresponds to be 12 corresponds to see 13 corresponds to D and then 14 corresponds to e 15 corresponds to F and you stop at 15 because when you include 0 going up to 15 that's 16 numbers and so the hexadecimal system is based on 16 different numbers and letters Now what we're going to do is we're going to talk about how to convert a decimal number to a hexadecimal number using a calculator because you can easily do it with a calculator very fast.
And also, just in case you get a test where it says, do this problem, no calculator. And if you get that, we need to know how to do it without a calculator. So make sure you understand the basics of long division.
If you don't... I recommend watching the video I created on long division. It's on YouTube. So if you type in long division organic chemistry tutor it should come up.
But let's begin. Let's start with 479. So how can we convert 479 which is a base 10 number that's a decimal number into a hexadecimal number. How can we do this?
The first step is to take 479 and divide it by 16. So we said we're going to use a calculator for this, so let's go ahead and do that. 479 divided by 16 is 29.9375. So here we have an integer of 29, and then we need to find the remainder.
To find the remainder, multiply 16 by.9375. So 16 times.9375, that will give you a remainder of 15. Then you start with this number, 29, and divide that by 16. So let's move on to the next row. So 29 divided by 16, that's equal to 1.8125.
So that's one remainder. And to find the remainder, multiply 16 by 0.8125. And so that will give you remainder 13. Then you need to take the 1 divided by 16 now We really don't need to do the division here because one does it go into 16? I mean 16 is going to 1 so we could say it's 0 Remained to 1 but if you did it let's say if you take in 1 and you divide it by 16 you're gonna get point 0625 so looking at this number.
You'll see that we need to put a 0 here And then if you multiply 16 by 0.0625, you'll get 1. But you really don't need to do the division. You can see that 16 goes into 1 0 times with a remainder. Now once you get a 0, this is when you stop.
So focus on these numbers 1, 13, and 15. I'm going to rewrite it, but let me get rid of this stuff first. So we had 1. 13 and 15. So the remainders, you want to convert them to hexadecimal numbers. 1 as a decimal is 1 as a hexadecimal, and based on the chart that we wrote earlier, 13 corresponds to D and 15 corresponds to F.
Now 1 is the most significant digit, and F is the least significant digit. So we need to write it in this order. from the most to the least significant digit.
So therefore, 479 in the base 10 system as a decimal is 1DF as a hexadecimal. So we can write a subscript of 16 to indicate that this is a hexadecimal number. And so that's how you can convert a decimal number to a hexadecimal number using a calculator.
Now let's try another example. 894. Feel free to pause the video. Use a calculator to convert the decimal number into a hexadecimal number. So let's start with 894 and let's divide it by 16. 894 divided by 16 is 55.875.
So that's going to be 55 remainder. and take 8.75 and multiply it by 16. And so that's going to give you a remainder of 14. Now, let's use this number, 55, or we could say this number that we have here, and let's divide that by 16. 55 divided by 16, that's 3.4375. And so we have 3 remainder, and then take.4375, multiply that by 16, and that will give you remainder 7. Now, let's take 3. 3 divided by 16, that's going to give us a number less than 1. So we can go straight to the answer.
That's going to be 16 goes into 3, 0 times, with 3 remaining. If you do 3 over 16, you'll get 0.1875. And so here you have a 0, and then 0.1875 is going to be 3. So that's the remainder of 3. If you do 0.1875 times 16, that will give you 3. Now let's convert the remainder values to hexadecimal values.
So 3 as a decimal is 3 in the hexadecimal system. 7 is still 7. Now 14 corresponds to a letter. So using a chart, 14 corresponds to E. So we're going to write it from the most significant digit to the least significant digit. Thus 894 is 3 7 E.
in the hexadecimal system. And so that's it for this example. Now let's try an example without a calculator.
Let's use a bigger number, 3284. So convert this decimal number into a hexadecimal number. So if we're going to do this without a calculator, we need to do long division. How many times does 16 go into 32?
16 goes into 32 two times. 16 times 2 is 32. So we get a remainder of 0, and so we need to bring down an 8. Now how many times does 16 go into 8? 16 goes into 8 zero times.
16 times 0 is 0, and so we still get a difference of 8. So now we need to bring down a 4. How many times does 16 go into 84? 16 goes into 84 five times. 16 times 5 is 80, and so we get a remainder of 4. So it's going to be 205, remainder 4. So then we write this 3284 divided by 16 is 205 remainder 4. So now we need to divide 205 by 16. So let's use long division. Let me do it over here.
How many times does 16 go into 20? 16 goes into 20 one time. 16 times 1 is 16. 20 minus 16 is 4. And then we need to bring down the 5. Now, how many times does 16 go into 45? 16 times 2 is 32, but 16 times 3 is 48, which is too high. So it goes into it two times.
and then 45 minus 32 is 13. So 205 divided by 16 is 12, remainder 13. Now for the last one, we need to divide 12 by 16. So 16 doesn't go into 12, it goes into 12 zero times with a remainder of 12. So now let's focus on these numbers. let's convert them to hexadecimal values so 12 in the decimal system corresponds to see in the hexadecimal system 13 corresponds to D and 4 corresponds to 4 so we're going to read it this way starting with C so it's going to be CD4 base 16 And so that's how you can convert a decimal number to a hexadecimal number using a calculator. Actually, I meant to say without using a calculator. So let's do another example like that. 7,956.
So convert this base 10 number into a hexadecimal number. So let's begin by taking 79, 56, and let's divide it by 16. So let's use long division. Now, it's good to understand your 16 times tables.
If not, keep adding 16. 16 plus 16 is 32. 32 plus 16 is 48. 48 plus 16 is 64. 64 plus 16 is 80. And then 96. And then you could add some more if you need to. So how many times does 16 go into 79? The highest number just under 79 is 64. So 16 goes into 79 four times.
16 times 4 is 64. Now 79 minus 64 is 15. And so we need to bring down the 5. In this case, we need some more numbers. 96 plus 16. is 112 and 112 plus 16 is 128. 128 plus 16 is 144 and then the next one is 160. When making a list like this you never need to go past 10. Now 16 goes into 155 nine times. 16 times 9 is 144. 155 minus 144 is 11 now let's bring down to 6 16 goes into 1 16 7 times 16 times 7 is 112 with a remainder of 4 so we could say that 7956 divided by 16 is 497 remainder 4 Now, you may want to write this information down, just in case I need to erase it to make more room.
So now let's divide 497 by 16. So how many times does 16 go into 49? 16 goes into 49 three times. 16 times 3 is 48. 49 minus 48 is 1. And then let's bring down the 7. 16 goes into 17 one time. with a remainder of 1. So now I need to erase this. So 497 divided by 16 is equal to 31 remainder 1. So now let's divide 31 by 16. So this we can do in our heads.
16 goes into 31 one time and a remainder is the difference between 31 and 16, which will be 15. So now let's convert these into hexadecimal values. So 15 corresponds to F, and then, actually no, we're not finished yet. This needs to be a 0. So now we need to divide 1 by 16. 1 divided by 16 is 0, with a remainder of 1. So now we're finished.
So don't forget that because I almost did. And you need to get a 0 here before you can finish. So a remainder of 1. 1 corresponds to 1. 15 corresponds to f. 1 corresponds to 1. And 4 corresponds. That's 4. So writing it from the most significant digit to the least significant digit, it's going to be 1, f.
1, 4, base 16. And so this is the answer. Now let's do one more example, but this time we're going to do it both ways. Let's use a bigger number, 14,259.
So let's convert this base 10 number into a base 16 number. Go ahead and try it. So first let's use a calculator.
14,259 divided by 16. And so that's going to be 891.1875, which I'm going to write that number here just to conserve space. So it's 891 remainder. And then take the decimal number and multiply it by 16. So 0.1875 times 16, that will give us...
remainder of 3. Now let's take 891 and let's divide that by 16 and so that's going to be 55.6875. So that's 55 remainder and then take.6875 multiply that by 16 so that will give us remainder 11. And then it's going to be 55 divided by 16, which is 3.4375. So we're going to get 3, and then.4375 times 16 is 7. Next, 3 divided by 16. 16 doesn't go into 3, so 16 goes into 3 zero times with a remainder of 3. And that's where we stop. Now let's get rid of this, and let's convert the remainder values into hexadecimal values.
So 3 corresponds to 3, 7 corresponds to 7, 11 corresponds to b, and 3 corresponds to 3. So writing it from bottom to top, it's going to be... 3, 7, B, 3, base, 16. And so that's how you can do it using a calculator. Now let's do it without using the calculator. So we need to take 14,259 and divide it by 16. So let's do long division.
Now, if you wrote that list that we had earlier, you'll know how many times 16 goes into 142. 16 doesn't go into 14, so we have to use 142. Now, I'm going to rewrite the list. We only need it up to 9. So this is 1, 2, 3, 4, 5, 6, 7, 8, 9. So 16 goes into 142 8 times. 128 is the highest number just under 142. So 16 times 8 is 128. And 142 minus 128, that's 14. Now, 16 goes into 145. 9 times.
16 times 9 is 144. And so we have a difference of 1. 16 goes into 19 one time, and so we get a remainder of 3. So this becomes 8, 9, 1, remainder 3. So now let's take 891, and let's divide that by 16. 16 goes into 89 five times. 16 times 5 is 80. The difference is 9. 16 goes into 91 five times as well. And so here the difference is 11. 16 doesn't go into 11, so that's the remainder. This gives us 55, the remainder 11. Now let's divide 55 by 16. 16 goes into 55 three times.
16 times 3 is 48, and the remainder is 7. So we have 55 divided by 16, which is 3, remainder 7. And then we need to divide 3 by 16, which 16 goes into 3 zero times, with 3 remaining. Now let's convert. the remainder values to hexadecimal.
So 3 corresponds to 3, 7 corresponds to 7, 11 corresponds to b, and then b corresponds to 3. So writing it in this order, we can see that it's going to give us this again. 3, 7, b, 3. And so that's how you can convert a decimal number to a hexadecimal number using both techniques.