Converting between numbers basis you will need to be able to convert between decimal, binary and hexadecimal for your GCSE. We are going to look at all three conversions. But we are going to start with decimal to binary. The smallest unit that we use in binary is called a bit. And as we've already seen, it is a single digit which is either a one or a zero. This single unit is not a huge amount of use, and therefore we build up sets of them.
Eight bits together is called a byte. When you have a byte of data, each individual bit in it represents a different decimal number, with each bit being either on or off. On this slide, we have a four bit binary number. The binary number shown is 0110. When working in binary, the numbers built up from right to left rather than from left To write in decimal. to work out the decimal equivalent, we need to add in the correct decimal headings above each binary bit.
These start on the right hand side with the first one being one. As they move left, the decimal numbers double. what is actually happening is that they are moving up by powers to to the power of zero is one, two to the power of one is two to the power of two is four, two to the power of three is eight, and so on. Once you've put the decimal headings in, you end up those headings where there is a one shown in the binary number. In this case, there is a zero shown under the eight, a one shown under the four, a one shown under the two and zero shown under the one. We would therefore only add together the four and the two which gives us 60110 in binary is therefore equivalent to six in decimal.
Here we have another binary number. This binary number is eight ones. This is now using eight bits or a byte. And so we have extended the decimal headings further. Again, we have started from one on the rightmost bit. This time however, we've gone up to 128 on decimal headings to cover all of the binary bits given.
In this example, there is a one under each of the headings and therefore, we must add up all of the decimal numbers shown in order to convert the binary into decimal. When we add them all together, we get the number 255. So using one byte of data, the largest number we can get is 255. Now, it's your turn to try some questions. You will need a pen and a piece of paper. Each row is a separate question.
All you have to do is convert the binary number into its decimal equivalent by adding up the correct decimal headings. You should not use a calculator for this. Pause the video whilst you work them out as the answers are shown on the next slide. Now we can see each of the different answers. In the first question, we have a 64 and an eight. And if you add them together, we get 72.
In the second question, we have a 64, a 32, a four, a two and a one. Adding together we get 103. In the third question, we have a 6432 a six been an eight, a four and a two. If we add them together, we get 126. In the fourth question, we have a one to eight, a 64, a 16, an EIGHT and a one. Adding those together we get 217.
In question five, we have a 64 and a one and adding those together we get 65. And in the final question, we do not have any decimal numbers as every binary digit is a zero, and therefore the decimal number is a zero. Remember, only adding the decimal number if the binary digit is showing as a one, if it's showing as a zero, do not add it. Now, we're going to try some questions where we need to convert the decimal into binary. To do this, just adding a one if you need that heading, or a zero, if you don't, again, pause the video as the answers are on the following slide. Here we see the answers for the conversion from decimals into binary.
For 29, we need a 16 and an eight, a four and a one for 140 We need a 64 i 3216 and two. For 186, we need a 128, a 3216, an EIGHT and a two. For 17, we need a 16 and a one. For 212, we need a 128, a 64, a 16 and a four and a 19. We need a 16, a two and a one. conversion from binary to decimal and decimal to binary is therefore quite easy.
We also have a need to be able to convert from binary to hexadecimal. Each hexadecimal digit is made up from a group of four binary digits. If you do not have four binary digits, you would end in zeros at the front until you get to four. It is possible to see that the binary number that we have been given to convert 01101010 our first job is to split this into two groups of four. Starting from the rightmost bit, we can't left until we have four bits and we mark this off. We then repeat this for the rest of the number.
A number splits nicely into two sets of four bits, and they are 0110 and 1010. Once we have split them into groups of four, we need to change the decimal headings. The headings now go from the right, one to four, eight for each group. You can then add up the headers to get the decimal equivalent for each set. In this example, we have six for the set on the left and 10. For the set on the right.
We now convert these numbers over to hexadecimals The decimal numbers from zero to nine are the same in hexadecimal. It is only when we get to 10 that it changes. This conversion can be seen in the table on the right hand side. We then replace the decimal number with the hex equivalent. The left set is therefore six, and the right set becomes a. Our final hexadecimal number for the binary is therefore six.
Here we have another example. In this eight bit binary number, all of the digits are one. Again, we split them up into groups of four and change the headings from one to eight. Adding each group up, we get the decimal number 15. When we convert this, we get the hexadecimal F. And therefore the hexadecimal equivalent for the binary number is F F. Now a chance for you to have a go Follow the instructions on the slide and pause the video as the answer is following. The first task is to split the numbers into groups of four, and we end up with one group as 0100 and the second group as 110. converting this to a decimal, the first group is four, and the second group is 14.
If we then convert that decimal to hexadecimal, the four stays a four and 14 converts to an E. The final answer therefore is for e. Again, we have another example for you to try. Follow the instructions and pause the video as you work it out. In this one are groups of four out 1011 and 0001. The first group of forks That's to the decimal number 11. And the second group of four converts to the decimal number one. When we convert these decimal numbers to hex decimals, the 11 converts to a B, and the one stays as a one.
The final answer therefore is B one. We can then convert between decimal and binary and decimal and hexadecimal. To convert decimal to hexadecimal. First of all convert the decimal number to binary and then convert the binary to hexadecimal. We also need to be able to convert from hexadecimal to decimal. We're going to do that in just a moment.
The process is to convert the hex decimal number to four bit binary. Place the four bit binary together and renumber the binary and convert the binary back to decimal. This again is shown in some following examples. In this example, we need to Convert the hexadecimal number BC to decimal. To do the conversion, we need to convert the hexadecimal back to decimal to begin with. So b in decimal is 11, and C in decimal is 12.
We convert these to four bit binary, B becomes 1011, and C becomes 1100. We then combine these two groups back together so it becomes a one eight bit binary number. We change the decimal headings to reflect that is now one binary number. So they become 1248 1632 64 and 128. checking on the binary digits that are a one we see that we have a 128 a 3216, and eight and a four. When we add all of these together, we get the answer 188. Here we see another issue.
In this one, we have to convert the hexadecimal number six E into decimal, six and decimal is six, and E in decimal is 14. When we break these down into four bit binary, we see that the six converts to 0110 and the 14 converts to 1110. Changing this back to eight bit binary, we end up with a number 01101110. Having adjusted the headings, we find that we have a 64, a 32, an eight, a four and a two. And when we add this up together, we get 110. Now we have another question that you can try.
Again, please follow the instructions and pause the video as the answer is on the following slide. In this question, a converts to 10 and five stays the same as five When we change this to four bit binary, the A changes to 1010 and the five changed to 0101. This then becomes the eight bit binary number 10100101, which gives us a 128, a 32, a four and a one. And when you add all of these together, the answer is 165. Another one for you to try. Again, pause the video whilst you have a go.
In this question, the F converts to 15 and the seven stays seven. When these are converted to four bit binary, the F becomes 1111 and the seven becomes 0111. Changing this back to an eight bit binary number, we get 111101 One one. We therefore have a 128 a 6432, a 16, a four, a two and a one. And when you add all of these together, the answer is 247.