0

I am somewhat stuck in binary notation. A segment of the video "Binary" (Week 0) talks about representing decimal notation into binary notation. I.e: 10 represents the number 2, 11 represents 3, etc. But the video doesn't explain how is number 2 in decimal notation becomes 10 in binary, 3 = 11, etc. Could somebody explain? Or give me a pointer for resources on the net?

Thank you.

3 Answers 3

2

The binary numbering system has powers of 2 while the decimal numbering system has powers of 10. For example, the decimal value 548 is actually

(8 x 1) + (4 x 10) + (5 x 100)

or

(8 x 10^0) + (4 x 10^1) + (5 x 10^2)

As you might have noticed, the right most digit is in the ones place. The digit at the left of it is at the tens place and the digit at the left of that is at the hundreds place. As you can see the place it multiplied by 10 as we go left.

The binary system has something like that exactly except that the place is multiplied by 2. So the first place is the ones place, the second is the twos place the third is the fours place and so on.

Also, in the decimal numbering system, we can put a digit from 0 through 9 in any place. We can only put either 0 or 1 in a place when we're using the binary numbering system however.

Converting a value from decimal to binary:

We'll take the value 5 as an example for the sake of simplicity. We first write the binary places until the place is > the value we're trying to convert

8    4    2    1

then we remove that place — the place that's > the value we're trying to convert (in this case it's the 8). So we're left with

4    2    1

We then ask ourselves, how many 4s does 5 have? Obviously 1. So we put 1 under the 4s place.

4    2   1
1

Now we have 1 left (because we took 4 from 5 and 5 - 4 = 1). Now does the 1 has any 2s in it? Of course not. So we put 0 in the twos place.

4    2    1
1    0    

Lastly, the 1 has a single 1 in it so we put a 1 under the ones place. (that's a lot of ones :D )

4    2    1
1    0    1

so the decimal value 5 in binary is 101.

Converting from binary to decimal:

this one is relatively easy. We just multiply the 1 or the 0 in each place by this place and add them all.

4    2    1
1    0    1

so

(1 x 1) + (2 x 0) + (1 x 4) = 1 + 0 + 4 = 5

Hope that helps!

1
  • I found your method the easiest to understand. Straight after this I tried to beat some quizzes; spent an afternoon for these and your method stood! Thanks a lot!
    – royray
    Commented Oct 11, 2015 at 8:42
1

In any number system, only certain amount of symbols are used to represent data. This 'certain amount' is known as the base or the radix. For example, in Decimal Number System, we are allowed to use only {0,1,2,3,4,5,6,7,8,9} characters. Similarly , in Binary Number System, only {0,1} are allowed. If you want to represent any data, you can use these characters in any permutation but not any character outside this set.

Now taking your question how come 2 is represented as 10 in binary, and 3 as 11, and so on!

We know that, there would be zero in every number system. So the counting 0,1,2,3,4,5,...(for any base) will always start with a 0. From now onwards I will be talking about decimal and binary number systems(representing them by b10 and b2 respectively) and not of others, although if you put analogy for the other bases also, you will find that they also satisfy everything. Now since you know that there is 0 in both b10 and b2, how will you get 1 out of it? Simply add 1 to it. That sounds rubbish for now, but lets go ahead. You now know that 1 in b10 is equal to 1 in b2. The next question is how will you get 2 when you know that 0 and 1 exist. Simply add 1 in 1 to get 2. This works fine in b10, but what in b2 now? We can only use {0,1} in b2 and the most significant digit is already 1, so how to add another 1 to it?

Simply do this

   1 
 + 1 
-----
 1 0     <----- that's 2 in b2 
-----

Get it little farther and you will get this

  1 0                    2
+ 0 1                  + 1
------                  --- 
  1 1     <------ that's 3 in b2
------ 

  1 1                     3
+ 0 1                   + 1
------                   --- 
1 0 0     <------- that's 4 in b2
------

And so on. If you still don't get how this addition occurred, then see this. Especially 4 rules for adding 2 single digit in b2.

sample

Decimal to Binary

Now comes the fact that what to do if b2 of bigger numbers is asked? Ofc we aren't going to add 1 that many times in binary. There is a simple way to calculate corresponding b2 of a given b10.

Given any number in b10, divide it by 2, write the remainder aside, and perform same with quotient unless quotient becomes 1. Also write that 1 aside.

For example,

enter image description here

see this for details. Here is a good explanation on this conversion. I haven't talked about conversion of floating point b10 numbers, Google would be your friend in that case.

Binary to Decimal

Similarly, there is a way to calculate b10 from a given b2.

Given any number in b2, Multiply each bit with 2 raised to the power of index of that bit. The sum of all the obtained numbers is the corresponding b10 value. Index is defined as 0 and increasing by 1 leftwards from left of radix point and -1 decreasing rightwards from right of radix point.

Here is animation that illustrates this in a better way.

1
  • This system is nice...
    – Nib
    Commented Sep 16, 2014 at 5:33
0

Here's a little intro to decimal and binary but you should definitely consult other resources to be sure you understand it correctly.

The most popular number system we use today is decimal. We refer to this as a base 10 number system. What this means is that when you reach 9, and you want to go 1 more, the new number starts with two digits i.e. 10.

This is easier to think of when you consider octal (base 8). When you reach 7, and want to go 1 step further, you end up with 10 (not 8).

Confused? That's the tricky part.

You see, as you were taught in primary school, each digit for the decimal system corresponds to a power of ten (1's, 10's, 100's). For example, 354, has 4 (units), 50 (tens), and 300 (hundreds). This actually corresponds to powers of tens as mentioned: (3 * 10^2) + (5 * 10^1) + (4 * 10^0).

So this same logic applies to octal, except since we are at base 8, you use a new digit instead of 8, just like decimal. So 35 in octal is actually, (3 * 8^1) + (5 * 8^0).

Now binary is base two, so we only have two numbers, 1 and 0. This is convenient because circuits can easily model the state of a bit by having electricity running through them or not. That's why they are a good fit for us. As for representing them, 0 equals 0 since (2^0 * 0) is just 0. 10 is 2 because (2^1 * 1) + (2^0 * 0) equals 2. In general, with every new digit you stick on the left, the power of twos increases.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .