Welcome to NRICH.

 
Binary numbers


By Frank J Bradley (M1130) on Monday, May 28, 2001 - 09:40 pm:

Please explain how numbers are shown in binary notation. For example, take the number 36.


By Dan Goodman (Dfmg2) on Tuesday, May 29, 2001 - 12:36 am:

Do you know what the binary notation means?
e.g. 100110 means 0×20 + 1×21 + 1×22 + 0×23 + 0×24 + 1×25=38.

Call the rightmost digit the 0th digit, the one to the left of that the 1st digit, to the left of that the 2nd digit, and so on. Then to convert from binary to decimal, you add up all of the 2n where the nth digit is 1.

The way to change a number from decimal to binary is to first find the largest power of 2 less than or equal to your number. In this case 32=25. Subtract this to get 36-25=36-32=4. Now try and find the highest power of 2 which is less than or equal to 4. In this case, 4 is actually a power of 2, 4=22. So 36 = 32 + 4 = 25 + 22. So if we write it in binary, the 2nd digit will be 1, the 5th digit will be 1, and 0s elsewhere. So 36 in binary is 100100.

As an exercise, try writing 255 and 170 in binary.


By The Editor:

It is perhaps worth comparing binary notation with decimal (ordinary) notation.

In decimal notation, the rightmost digit is the units (100=1), then we have the 10s (101), 100s (102), 1000s (103), etc.

In binary, we use powers of 2 instead of 10. Binary can be called base 2, and decimal can be called base 10.

There is an article all about different number bases here.