Wikijunior:How Things Work/Binary Numbers
What is Binary?
Binary is a new type of number system. You see it as 1s and 0s in movies or TV shows. Computers use this number system to add, subtract, multiply, divide and do every math operation done on computers. Computers save data using binary. This book will teach you how binary works, why computers use it, and how they use it.
Why do we use Binary?
In normal math, we don't use binary. We were taught to use our normal number system. Binary is much easier to do math in than normal numbers because you only are using two symbols - 1 and 0 instead of ten symbols - 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
Computers use binary because they can only read and store an on or off charge. So, using 0 as "off" and 1 as "on," we can use numbers in electrical wiring. Think of it as this - if you had one color for every math symbol (0 to 9), you'd have ten colors. That's a lot of colors to memorize, but you have done it anyway. If you were limited to only black and white, you'd only have two colors. It would be so much easier to memorize, but you would need to make a new way of writing down numbers. Binary is just that - a new way to record and use numbers.
In first grade, you were taught that we have a ones, tens, hundreds columns and so on (they multiply by 10). Binary also has columns, but they aren't ones and tens. The columns in binary are...
* Normal numbers are called base-10, because there are 10 symbols that we use. Binary is called base-2, because it uses two symbols.
So what makes binary so easy? The answer lies in how we read the number. If we had the number 52, we have a 2 in the ones column, adding 2 times 1 to the total (2). We have a 5 in the 10s column, multiply that together and get 50, adding that to the total. Our total number is 52, like we expect. In binary, though, this is way simpler if you know how to read it fast.
Binary numbers are read from right to left, unlike normal numbers which are read left to right.
We have been trained to read these base-10 numbers really quickly. Reading binary for humans is slower since we are used to base-10. You are now starting to learn how to read base-2, so it will be slow. You will get faster over time.
Translating to Base-10
The binary number for 52 is 110100. How do you read a binary number?
- You look at the ones column. Since it has a 0 in it, you don't add anything to the total.
- Then you look at the twos column. Nothing, so we move on to the next column.
- We have a 1 in the fours column, so we add 4 to the total (total is 4).
- Skipping the eights column since it has a 0, we have come to a 1 in the sixteens column. We add 16 to the total (total is 20).
- Last, we have a 1 in the thirty-twos column. We add this to our total (total is 52).
We're done! We now have the number 52 as our total. The basics of reading a base-2 number is add each columns value to the total if there is a 1 in it. You don't have to multiply like you do in base-10 to get the total (like the 5 in the tens column from the above base-10 example), which can speed up your reading of base-2 numbers. Let's look at that in a table.
|Binary digit||Column||Binary digit's value|
Now let's look at another number.
Finding a Mystery Number
The binary number is 1011, but we don't know what it is. Let's go through the column-reading process to find out what the number is.
- The ones column has a 1 in it, so we add 1 x 1 to the total (total is 1).
- The twos column has a 1 in it, so we add 1 x 2 to the total (total is 3).
- The fours column has a 0 in it, so we add 0 x 4 to the total (total is still 3).
- The eights column has a 1 in it, so we add 1 x 8 to the total (total is 11).
We are done, so the total is the answer. The answer is 11! Here are some more numbers for you to work out.
Binary is how we use numbers in electronics. All modern computers use binary to remember numbers. How computers remember the numbers won't be taught in this book, but you will learn how the binary numbers come into play for computers remembering certain things.
Bits and Bytes
A bit is one symbol in a binary, or one value in one column. (It's short for binary digit.) A byte is eight bits put together (Why eight? It has to do with remembering letters, which you'll read later).