# How to Change Number Bases Part 2

In the previous post, we have learned how to change numbers form one base to other. In this post, we are going to discuss more examples of number bases particularly the two number systems used in computers: the binary and the hexadecimal system.

The Binary Number System

The binary number system has base 2 and only uses 1 and 0 as digits. The binary number 1101 in expanded form is $1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0$ or

8 + 4 + 0 + 1 = 13 in base 10. If we want to convert base 10 numbers to base 2, then we look for the highest multiple of the powers of 2 and subtract from the number each time until the difference is 0.

Example: Convert 74 to base 2.

The highest number that can be subtracted from 74 is $2^6 = 64$. So, just like in the previous post, we can create a table with the largest number as $2^6$ as shown below. Since, we can subtract $2^6$ from 74, we write 1 under $2^6$. Subtracting, we have $74 - 2^6 = 10$. We cannot subtract $2^5$ and $2^4$ from 10, so we write 0 under these numbers. We know that $10 = 2^3 + 2^1$, so we write 1 under them and write 0 in the remaining cells. The final answer is shown in the next table. From the table, this means that $74_{10} = 1001010_2$.

Exercises:

1.) Convert 213 to binary.
2.) Convert 100110 to decimal

The hexadecimal number system or the base 16 number system uses 0, 1, 2, all the way up to 15 as digits.

In base 10, when we talk about digit, we are taking about one number. One thing that probably comes to your mind is how do we deal with digits containing two digits in base 16? For example, in the hexadecimal number, is 14 a 1-digit number or a 2-digit number? To solve this problem, letters were used to denote digits from 10 to 15: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. That means that the expanded form of E20A is $14 \times 16^3 + 2 \times 16^2 + 0 \times 16^1 + 10 \times 16^0$

or 57344 + 512 + 0 + 10 = 58866 in base 10.

Just like in the previous examples, in converting base 10 numbers to base 16 numbers, we need to look for the highest multiples of powers of 16 and subtract each time until the difference is 0.

Example: Convert $12452_{10}$ to base 16.

We know that $16^4 = 65536$, so we can only subtract multiples of $16^3 = 4096$ from 12452. Obviously, 12452 divided by 4096 will give an integral quotient of 3, so we write 3 under $16^3$ in the table below. Now, $12452 - 3(16^3) = 12452 - 12288 = 164$. Clearly, we cannot subtract $16^2$ from 164, so we put 0 under it. Next, there are ten $16^1$ in 164, so we write A under it. Next, 164 – 10(16) = 4. So, we write 4 under $16^0$. Exercise:

Convert 18B2 to base 10.
Convert 15000 to base 16.