Wikijunior:How Things Work/Binary

< Wikijunior:How Things Work

Binary is a counting system used by computers to do mathematics. Instead of using 0 to 9 as digits, it only uses 1s and 0s. This is because it is easier for a computer to represent numbers with only ones and zeroes (on and off) rather than with 10 different digits.

When you use normal numbers to do normal math, you are using what is called "base ten." In base ten, every time you get to 10 in a column you have to regroup to the next column. Example: Tens|Ones

    9
   +1
   __
   10   Regroup here.

In base ten, also known as decimal, each column has a "place value" 10 times the column to the right. For example, if there was a two in the tens column, that would be 2x10=20. But the column to the left of the tens has a value ten times higher, 10x10=100. So if there was a 5 in that column, it would be equal to 5x100=500.

In binary, or "base two," you regroup each time you get to two. So the column to the left of the ones column must have a place value twice as large. Example: Sixteens|Eights|Fours|Twos|Ones

   1      0     0     1    1    

To convert this number, 10011 (binary), you would multiply each digit by its place value and add all those results together. Example: 1x16=16 | 0x 8= 0 | 0x 4= 0 | 1x 2= 2 | 1x 1= 1 |

16+0+0+2+1=19 Here we see that the binary number 10011 equals the decimal number 19.


Uses of binary numbers

Computers use binary numbers because in the simplest electrical systems, electricity can only be "on" or "off." In a computer, all of the different systems report their data to the main system by using pulses of "on" and "off." Binary numbers are also very useful to programmers because the computer often needs to ask "yes" and "no" or "true" and "false" style questions to the different systems, programs, or even the user. When binary numbers are used in this way, "1" means "on," "yes," or "true" and "0" means "off," "no," or "false."

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.