Wikijunior:How Things Work/Binary Numbers - Wikibooks, open books for an open world (2024)

Contents

  • 1 What is Binary?
  • 2 Why do we use Binary?
  • 3 Binary Notation
  • 4 Writing Binary Numbers
    • 4.1 Writing Larger Numbers
  • 5 Translating to Base-10
  • 6 Finding a Mystery Number
    • 6.1 Storing text

What is Binary?

[edit | edit source]

Most people use ten different digits — 0 to 9 — to write numbers. For example, the numbers 15, 987630, 100, 99, and 6 are all made up of one or more of these ten digits.

This is called the decimal number system or base ten, which means that this number system has ten different digits to construct a number, as many as (most) people have fingers.

But computers are not built with the decimal number system. This is because computers are built with electronic circuits, each part of which can be either on or off. As there are only two options, they can only represent two different digits, 0 and 1. This is called the binary number system, or base two. ("Bi" means two.) All the numbers are constructed from the two digits 0 and 1. A digit in binary (that's a 0 or a 1) is also called a bit – short for binary digit.

Computers use this number system to add, subtract, multiply, divide and do all their other math and data. They even save data in the form of bits.

A bit by itself can only mean zero or one, so to represent bigger numbers (and even represent letters) they group them together into chunks. Eight bits make a byte, and computers use as many bytes as they need to store what we need them to. Modern computers have many billions of bytes of storage.

This book will teach you how binary works, why computers use it, and how they use it.

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 number-symbols — 1 and 0 instead of ten number-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.

Binary Notation

[edit | edit source]

In school, you were taught that we have ones, tens, and hundreds columns and so on. Each column is worth ten times the amount of the column to its right. This means that if the first column is worth 1, the second column is worth 10, and the third column is worth 100, and so on. To find the value of a digit in a certain column, you multiply the digit by the number that the column is worth. If you haven't seen a model of the columns before, it looks like this:

Decimal column10,0001000100101
Digit54936
Value5 × 10,0004 × 10009 × 1003 × 106 × 1

So the decimal number 54,936 is equal to 5×10000 + 4×1000 + 9×100 + 3×10 + 6×1.

Binary also has columns, but each column is worth two times the amount of the column to its right. You still determine the value of digits in the same way, by multiplying the value of the bit (0 or 1) by the value of its column digit (128, 64, 32, etc.), as shown below:

Binary column1286432168421
Bit10110101
Value1 × 1280 × 641 × 321 × 160 × 81 × 40 × 21 × 1

So the binary number 10110101 = (1×128) + (1×32) + (1×16) + (1×4) + (1×1) = 181 in decimal.

Writing Binary Numbers

[edit | edit source]

The method above lets us read binary numbers, but how do we write them? One way is to write a list of all the numbers starting from one and working upwards. Just as adding 1 to 9 in decimal carries over to make 10, and 1 + 99 makes 100, in binary when you add one to one, you carry a one over to the next place on the left. Follow along with this table to see how that works.

Base-10Binary
00
11
210
311
4100
5101
6110
7111
81000
91001
101010
111011
121100
131101
141110
151111
1610000

You'll notice that the values 1, 2, 4, 8, and 16 in binary only have a single one bit and some zero bits. If you go back up to the binary columns, you might notice that there is a column for each of these values. If you write the number in the columns, you would only need to write a 1 in the column that has the same value as the number you are writing. All of the other columns would have zeroes. Base ten works in the same way! When you write a base ten number that has the same value of one of the base ten columns, such as 100, you would only write a 1 in the column with a value equal to the number you're writing. You would put a 0 in the other columns.

Base-10 versionBinary
11
210
4100
81000
1610000

Have you noticed a pattern in writing binary numbers? Study the table for 1 to 16 again until you understand why in binary,

"1 + 1 = 10" and "1 + 100 = 101"

in your own way.

You've probably got lots of practice reading decimal but none yet reading binary, so it's normal for reading binary to feel quite slow.

Writing Larger Numbers

[edit | edit source]

What do you do if you want to write a bigger number, like 86? You could use the list method shown above, but that would take a long time! A quicker method involves the columns:

  1. Find the column with the largest value that is still less than or equal to the number you're writing and write a 1 in that column. For 86, you would write a 1 in the sixty-fours column because 64 is less than 86, but the next column to the left (128) is greater than 86.
  2. Look at the next column to the right of the one you used in the previous step. If you can add the value of that column to the value of the previous column and get a number less than or equal to the number you're converting to binary, write a 1 there. If not, write a 0. In the example with 86, the value of the first column you used (64) plus the value of the next column to the right (32) equals 96. 96 is greater than 86, so you would write a 0 in the thirty-twos column.
  3. Find the next column to the right of the last one you wrote in. If adding the value of that column to the sum of the values of all the columns with a one in them would give you a number less than or equal to your number, write a 1 in that column. If not, write a 0. With 86, the next column would be the sixteens column. 16 plus the sum of the values of all the previous columns with ones in them (64 in this example) is 80. 80 is less than 86, so you would write a 1 in the sixteens column.
  4. Repeat step 3 until the sum of the values of the columns with ones in them is equal to the number you were trying to find. Once this happens, fill any remaining columns with zeros.

A table showing the full process with 86 can be seen below:

Binary column1286432168421
Can this number fit?No. The total would be 128, and 128>86.Yes. The total would be 64, and 64<86.No. The total would be 96, and 96>86.Yes. The total would be 80, and 80<86.No. The total would be 88 and 88>86Yes. The total would be 84, and 84<86.Yes. The total would be 86.No. The total would be 87, and 87>86.
BitA 0 can be put here, or it can be left blank.1010110
Total064648080848686

Translating to Base-10

[edit | edit source]

The binary number for 52 is 110100. How do you read a binary number?

  1. You look at the ones column. Since it has a 0 in it, you don't add anything to the total.
  2. Then you look at the twos column. Nothing, so we move on to the next column.
  3. We have a 1 in the fours column, so we add 4 to the total (total is 4).
  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).
  5. 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) because the only digits are 0 (Remember that 0 times anything equals 0.) and 1 (Remember that 1 times anything is always equal to the other number.) Not needing to multiply can help speed up your reading of base-2 numbers. Let's look at 110100 in a table.

Binary digitColumnBinary digit's value
010
020
144
080
11616
13232
Total52

Now let's look at another number.

Finding a Mystery Number

[edit | edit source]

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.

  1. The ones column has a 1 in it, so we add 1 x 1 to the total (total is 1).
  2. The twos column has a 1 in it, so we add 1 x 2 to the total (total is 3).
  3. The fours column has a 0 in it, so we add 0 x 4 to the total (total is still 3).
  4. 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.

Storing text

[edit | edit source]

Computers store everything in binary, including text. To do this, every letter, every punctuation character, in fact a very large number of the symbols people have ever used, has been given its own number in a system called Unicode.

For example, if your name is "George" then the computer can store that in binary just by storing the number for "G", then for "e", and so on. The most common symbols in American English, like letters without accents, can be stored with just one byte. Other symbols, like "£" and "¿", need more than one byte as they've been given a bigger number. A few examples:

  • G is stored as 71, which is "0100 0111" in binary
  • e is stored as a hundred and one, which is "0110 0101" in binary.

The whole word "George" looks like:

0100 0111 0110 0101 0110 1111 0111 0010 0110 0111 0110 0101

While this might look like gibberish, see if you can find the rest of the letters in that and what their decimal representation is!

Wikijunior:How Things Work/Binary Numbers - Wikibooks, open books for an open world (2024)
Top Articles
JSON file in Python: Read and Write | Board Infinity
Small Business Loan Denied: What To Do Next | Bankrate
Netronline Taxes
Blorg Body Pillow
Ffxiv Palm Chippings
Wizard Build Season 28
Crocodile Tears - Quest
Craigslist Parsippany Nj Rooms For Rent
Beautiful Scrap Wood Paper Towel Holder
Poplar | Genus, Description, Major Species, & Facts
Bustle Daily Horoscope
Rainfall Map Oklahoma
Shuiby aslam - ForeverMissed.com Online Memorials
Fredericksburg Free Lance Star Obituaries
Darksteel Plate Deepwoken
Bcbs Prefix List Phone Numbers
Soccer Zone Discount Code
Grandview Outlet Westwood Ky
Swgoh Blind Characters
Recap: Noah Syndergaard earns his first L.A. win as Dodgers sweep Cardinals
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Saritaprivate
Scout Shop Massapequa
Blue Rain Lubbock
Between Friends Comic Strip Today
Boston Dynamics’ new humanoid moves like no robot you’ve ever seen
Hannaford Weekly Flyer Manchester Nh
Walmart Pharmacy Near Me Open
Cpt 90677 Reimbursem*nt 2023
Sessional Dates U Of T
Phantom Fireworks Of Delaware Watergap Photos
Foodsmart Jonesboro Ar Weekly Ad
Account Now Login In
Bolly2Tolly Maari 2
Gma' Deals & Steals Today
Shoe Station Store Locator
LG UN90 65" 4K Smart UHD TV - 65UN9000AUJ | LG CA
Page 2383 – Christianity Today
Sam's Club Gas Price Hilliard
Rund um die SIM-Karte | ALDI TALK
Craigslist Free Puppy
#1 | Rottweiler Puppies For Sale In New York | Uptown
Leatherwall Ll Classifieds
Dcilottery Login
Lima Crime Stoppers
Firestone Batteries Prices
11 Best Hotels in Cologne (Köln), Germany in 2024 - My Germany Vacation
Parent Portal Pat Med
Best Haircut Shop Near Me
Displacer Cub – 5th Edition SRD
Quest Diagnostics Mt Morris Appointment
Competitive Comparison
Latest Posts
Article information

Author: Allyn Kozey

Last Updated:

Views: 6158

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Allyn Kozey

Birthday: 1993-12-21

Address: Suite 454 40343 Larson Union, Port Melia, TX 16164

Phone: +2456904400762

Job: Investor Administrator

Hobby: Sketching, Puzzles, Pet, Mountaineering, Skydiving, Dowsing, Sports

Introduction: My name is Allyn Kozey, I am a outstanding, colorful, adventurous, encouraging, zealous, tender, helpful person who loves writing and wants to share my knowledge and understanding with you.