Menu
Log in

Computer Engineering Concepts

2.2 Base Conversion

Now that the idea of counting has been extended to any base, the next step is that of converting from one base to another. The conversion could be easily achieved for small numbers by counting up in a given base. This approach unfortunately is a time consuming process when dealing with large numbers. For example, what is 1568 in base 4? To solve this problem a systematic approach is needed.

Converting Other Bases to Decimal

To solve the base conversion problem, let us first consider converting numbers from other bases to the decimal base. For example, converting 20234 to decimal. One solution is to count up all the way to 20234 in base 4, which is not practical. Another solution is to find a mathematical relationship between the number in another base and the same number in base 10. The mathematical relationship is relatively easy to see if we compare the representations of the same quantity in the two different bases. To understand the conversion process, consider the table below that shows counting in base 2 along with its decimal equivalent.

By carefully observing the decimal and binary numbers in the table it can be seen that each new binary digit occurs at a multiple of two. Using this pattern, a conversion system can be developed for all numbers in binary. For example, consider five or binary 1012 this can be thought of as binary 1002+12 or 22+20 or 4+1.  Therefore, in any binary number each digit that is a 1 can be expressed using its decimal equivalent that is an exponents of 2. For example:

11012 = 10002 + 1002 +12 = 23 + 22 + 20 = 8 + 4 + 1 = 13

The result obtained in the example corresponds to the value in the table. The pattern can be extended further to accommodate other bases by generalizing the concept using coefficients. By adding coefficients the above example can be thought of as:

11012 = (1)23 + (1)22 + (0)21 + (1)20 = 8 + 4 + 1 = 13

This general pattern can be summarized as:

  • The base of the exponent is the same as the base of the number.
  • The exponent is one less than the position of the digit counted from the right.
  • The coefficients are the digits of the number converted to base 10.

 Example I:          Determine the decimal equivalent of 123.

 Solution:              The decimal equivalent is determined by using the generalized method of conversion.      

                               123 = (1)31 + (2)30 = 3 + 2 = 5  

The validity of this result in example I can be checked by counting in base 3 up to five.

 Example II:       Determine the decimal equivalent of A3C16.

 Solution:             The decimal equivalent is determined by using the generalized method of conversion.      

                               A3C16 = (A)(162) + (3)(161)+ (C)(160)

                               = (10)(256) + (3)(16) + (12)(1) = 2620

                               Note: A=10 & C=12 (Coefficients converted to base 10)

Converting From Decimal to Other Bases

To convert from decimal to any given base the process can be thought of as the reverse of the conversion to decimal process discussed earlier. For the sake of simplicity, consider converting thirteen from decimal to binary.

13 = 8 + 4 + 1 = 23 + 22 + 20 = (1)23 + (1)22 + (0)21 + (1)20 = 11012

The process is started by asking what highest power of the base, in this case highest power of two, is present in the decimal number. Then the process is repeated on the remainder until a remainder of zero is reached. The decimal number is then written as a sum of the exponents of the base. Then the coefficients can be easily determined, and the digits of the number in the given base are simply determined using the coefficients. The result obtained is valid because it can be verified by counting (see the binary table in the counting section for verification). If this concept is extended to any base, then the multiples of the highest power of the base would have to be considered.

 Example III:      Convert 66 to base 3.

 Solution:             66 can be expressed using coefficients and exponents of 3 as:

                               66 = (2)(33) +(1)(32) + 1(31) + 0(30)

                               Using the coefficients the number in base 3 is written as 21103.

It should be noted that the coefficients used to determine the digits in the given base will never exceed the value of the base. Again the result obtained could be verified by converting it to base 10. This conversion process can also be applied to bases that are above 10.

 Example IV:      Convert 125 to hexadecimal (base 16).

 Solution:             125 can be expressed using coefficients and exponents of 16 as:

                               125 = 7(161) + 13(160)

                               Using the coefficients the number in base 16 is written as 7D.

A faster method for converting decimal numbers to a given base is by using repeated division. In this approach the decimal number is repeatedly divided by the base to which the number is being converted to. For example, consider converting 13 to binary or base 2. Since it is base 2 the number 13 is repeatedly divided by 2. In this case 13 divided by 2 produces 6 and a remainder of 1, and then the 6 divided by 2 produces 3 and a remainder of 0, and so on. This process is repeated until 0 is reached, as shown in table 2.2.

Table 2.2 Decimal to binary conversion using repeated division

The binary representation of the number is determined by reading the digits of the remainder from the bottom up. In this case, it produces a result of 11012, which turns out to be the correct representation of 13 in binary. The validity of the result can be checked by using the coefficient method, or by counting up to 13 in binary.


2.2 Practice Questions

1.     Convert the following binary numbers to decimal.

        a. 101                 b. 110              c. 1010                       d. 1101                e. 1110

2.     Convert the following number in different bases to decimal.

        a. 134                 b. 2113               c. 537                          d. 178                  e. 1425

3.     Convert the following hexadecimal (base16) numbers to decimal.

        a. 13                   b. A5                c. 4BF                         d. C1D                 e. 2BA1

4.     Convert the following decimal numbers to binary using the coefficient method.

        a. 5                     b. 8                     c. 13                           d. 21                     e. 36

5.     Convert the following decimal numbers to binary using the repeated division method.

        a. 7                     b. 11                   c. 16                          d. 29                     e. 46

6.     Convert 83 to the following bases using repeated division method.

        a. 2                     b. 3                     c. 7                             d. 8                       e. 16

7.     Convert 121 to the following bases using the coefficient method.

        a. 2                     b. 5                     c. 6                             d. 8                       e. 16

8.     Convert 75 to the following bases.

        a. 3                     b. 6                     c. 9                             d. 12                     e. 16

9.     Show mathematically that the coefficient and repeated division methods of conversion are equivalent.

10.   Convert the following numbers to base 6. [Hint: Convert the number to decimal and then convert to base 6]

        a. 334                 b. 1223                c. 439                      d. 678                    e. 4025

11.   Convert the following numbers to binary.

        a. 213                 b. 2213                c. 436                      d. 538                    e. 2E16




GlobalEduTech Solutions

Powered by Wild Apricot Membership Software