# binary, hexadecimal to decimal conversion.

I've one point that couldn't wrap in my mind when we talk about (binary, octal, hex) to decimal conversions?

For example, to convert binary 011 to decimal we multiply each bits starting from the LSB by the power of 2. $$011 = (1*2^{0})+(1*2^{1})+(0*2^{2}) = 3$$

octal to decimal $$356 (base 8) = (6*8^{0})+(5*8^{1})+(3*8^{2}) = 238$$

same thing for hex to decimal.

Here is my question, there is no such thing related to decimal for converting those numbers to decimal. So how could multiplying by their base starting from LSB convert it to decimal. That doesn't make sense.

• see this might help. Also please use mathjax. – Vineet May 16 at 8:30

## 1 Answer

• Writing a number in base two means writing it as a weighted sum of powers of two: $$a_0 2^0 + a_1 2^1 + a_2 2^2 + a_3 2^3 + \ldots + a_n 2^n$$. Once you've described the number as a sum like this, you know how to write it in base two: you just put all the coefficients together in order $$(a_n\ldots a_3a_2a_1a_0)$$.

• Writing a number in base eight means writing it as a weighted sum of powers of eight: $$b_0 8^0 + b_1 8^1 + b_2 8^2 + b_3 8^3 + \ldots + b_n 8^n$$. Once you've described the number as a sum like this, you know how to write it in base eight: you just put all the coefficients together in order $$(b_n\ldots b_3b_2b_1b_0)$$.

• If you wanted to, you could express a number in base ten as a weighted sum, too. You could write $$c_0 10^0 + c_1 10^1 + c_2 10^2 + c_3 10^3 + \ldots + c_n 10^n$$. Then the representation in base ten is just $$c_n\ldots c_3c_2c_1c_0$$.

This doesn't do much, of course. The number 1423 can be written as $$3\cdot 10^0 + 2\cdot 10^1 + 4\cdot 10^2 + 1\cdot 10^3$$. If you put the coefficients together, you get 1423 in base ten, exactly as you started with.