Decimal | Binary |

0 | 0 |

1 | 1 |

2 | 10 |

3 | 11 |

4 | 100 |

5 | 101 |

6 | 110 |

7 | 111 |

8 | 1000 |

9 | 1001 |

10 | 1010 |

11 | 1011 |

12 | 1100 |

13 | 1101 |

14 | 1110 |

15 | 1111 |

16 | 10000 |

17 | 10001 |

18 | 10010 |

19 | 10011 |

20 | 10100 |

Do you see the pattern?

In the decimal system we start with 0, and there are 10 usable digits, 0-9. In binary like mentioned there are only 2 digits 0 and 1. In decimal once you get past 9 you simply increment the first digit to the left (if it doesn't exist then pretend its a 0) and start the sequence over. For example: 00,01,02,03,04,05,06,07,08,09 from here we increment to the next digit and start the sequence over again hence we get 10,11,12,13,14, etc.

In binary its the same concept. 00,01 since 1 is our last usable digit we increment and start the sequence over hence 10,11 from here we repeat the same idea hence 100,101,110,111, etc. Now 100 shown here isn't actually 100 like we use in decimal its value is actually 4. Each place value is different, lets compare it to decimal system:

*Note: the value 3,791 is randomly used in this comparison.*

1000 | 100 | 10 | 1 |

3 | 7 | 9 | 1 |

2048 | 1024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 |

In binary it is the same process, just that the place values are different, and easy way to remember is it starts with 1 and is doubled each time. So (1x2,048) + (1x1,024) + (1x512) + (0x256) + (1x128) + (1x64) + (0x32) + (0x16) + (1x8) + (1x4) + (1x2) + (1x1) = 3,791. An obvious way to make this faster is ignore the multiplication part because if its 0 it doesn't add to the value and you can ignore it, and if its 1 just add the place value its because anything multiplied by 1 is equal to itself.

Here is a simple converter:

More information can be obtained here : http://en.wikipedia.org/wiki/Binary_number

**By the end of this lesson you will see there are 10 kind of people in this world those who know binary and those who don't.**
## No comments:

Post a Comment