Suppose we have F9 hex. If we want to convert it into binary, we just replace the hexadecimal numbers with their corresponding binary numbers. Like 9 has1001 in binary and F has 1111 in binary. By combining it becomes 1111 1001. But why does it give the right answer when we convert both into decimal number. Why we can't convert any base system into another base system which does not come in its power? As we form a base-3 number system and a base-9 number system. As 9=3^2 so two digits of base-3 can be represented by a single base-9 digit. But why this happens?
2 Answers
Suppose we have a number $X$ which is written as $X_2X_1X_0$ in hexidecimal. Then we have $X = 16^0X_0 + 16^1X_1 + 16^2X_2$.
$16 = 2^4$ so we rewrite that as $X = 2^0X_0 + 2^4X_1 + 2^8X_2$. Now let's suppose $X_2$ can be written $x_3x_2x_1x_0$ in binary, then $X_2 = 2^3x_3 + 2^2x_2 +2^1x_1 +2^0x_0$. Substituting we get $$ X = 2^0X_0 + 2^4X_1 + 2^8(2^3x_3 + 2^2x_2 +2^1x_1 +2^0x_0) $$ $$ X = 2^0X_0 + 2^4X_1 + 2^{11}x_3 + 2^10x_2 +2^9x_1 +2^8x_0 $$
If you repeat that process for $X_0$ and $X_1$ you'll get an expression for $X$ entirely in terms of powers of two, just by substituting in the binary expansions of its digits in hexidecimal.
The special property of base 16 that makes this possible is that 16 is a power of 2, which I used to rewrite the powers of 16 as powers of 2. This is equally possible for any other pair of bases where one is a power of the other.
Hint: a sequence of digits $a_n \dots a_0$ in base $g$ corresponds to the natural number $ a_n \cdot g^n + \dots + a_0 \cdot g^0.$ What happen if we consider this number in a base $h$ such that $g=h^k$?
Anyway, even with $2$ and $16$ one needs to be careful: for instance, $F=1111$ and $7=111$ in base $2$, but $F7 = 11110111$ and not $1111111$. Can you see why this happens?
2 0 1 8
in base 10 is20 18
in base 100=10^2. $\endgroup$