How do binary numbers work?
My teacher has told us to learn how to count in binary but I'm a bit lost. How is 100 only one greater than 11?
Sounds like you've got a good computer science instructor there, asking you to figure out the basic number system that the tiny little CPU chips inside our computers use to keep track of everything from numbers to graphics, audio files to the latest movie release.
Turns out that there are four (reasonably) common numbering schemes that you can encounter on a computer system, though for obvious reasons most of them are reserved for programmers and hard core techheads.
The numbering system you're used to is called decimal, or "base 10". That means that each digit can represent ten different possible values. 0, 1, 2, 3... 9. Decimal numbers are built from the right to the left, so 35 is really 3*10 + 5 or, to be more proper, 3*(10**1) + 5*(10**0). 10**1 is ten raised to the first power, or ten. Bigger numbers break down more interestingly: 9353 = 9*(10**3) + 3*(10**2) + 5*(10**1) + 3*(10**0). The "9" is really 9*1000. You know that, you've probably just never seen it written this way.
The reason it's considered decimal, or base ten, is because we use 10 as the basic value that we're factoring.
Take that same smaller number, 35, and use an octal, or base 8, numbering system and you find that it represents 3*(8**1) + 5*(8**0) or 3*8 + 5 = 29 (base 10). Does that make sense? You couldn't have 9353 in octal, however, because each digit can only represent the values 0,1,2..7, just as you can't have a single digit represent the value 10 in decimal.
Octal isn't used much any more, actually, but what you do still see as a software developer are both binary (base 2) and hexidecimal (base 16). (did you notice the pattern? Binary, octal and hexidecimal are all based on powers of 2. It's not an accident)
These are considerably more complicated, and a single hexidecimal digit can represent the values 0,1, 2, 3...9, A, B, C, D, E, F where "A" = 10 decimal, "B" = 11 decimal and so on. So a hexidecimal value like F2 is actually F * (16**1) + 2 * (16**0) or 15*16 + 2 = 242.
Let's focus on binary, though, as that's what you're asking about. Binary is the essential counting system of computers because as a base 2 numbering system, each digit can be represented electronically as on or off. 1 or 0. This means that binary numbers can get really long, really fast.
For example, 100 binary = 1*(2**2) + 0*(2**1) + 0*(2**0) = 4 + 0 + 0 = 4. 1000 = 1*(2**3) = 8, and so on. To count from 1-10 decimal in binary, the values look like this: 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010.
Want to represent 35 in binary? It's hard to calculate by hand, the answer is: 100011. Let's get more scary. How about 9353 as binary? 10001110010010001001.
By contrast, hexidecimal is more compact, as we've already learned, so that same value 9353 in "hex" is represented as 253F. Let's go bigger. 126,334,307 base 10 = 787b563 base 16.
Where this all gets interesting is when you start trying to work with what's called irrational numeric bases like pi or e, but that's a subject for another posting.
I hope this helps you out!
More Useful Computer and Internet Basics Articles:
✔ How do I blur my house on Google Maps Street View?
I was poking around on Google Maps looking at satellite views of my neighborhood and when I switched to street view, was upset...✔ Create a custom vanity URL for Kickstarter?
I was reading some updates on Twitter and saw someone had posted a URL that would let me see what projects they'd backed...✔ Export or Save Subscription List from Google Reader?
Just heard that Google Reader is going away this summer. That stinks! How am I supposed to read my RSS feeds? More importantly,...✔ Shrink or Reduce a Photo File Size on Mac?
I'm trying to upload some photos to a social media site and it's complaining that they're too big. They are, as they come...✔ Can I organize my Yahoo Mail with folders?
I've been on Yahoo Mail for years and while most of my friends are now on Gmail or their own Web-based email programs,...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
I do have a comment, now that you mention it!
Check This Out Too...
Look for Answers
All Our Categories
Apple iPad Help
Articles and Reviews
Auctions and Online Shopping
Blogs and Blogging
Building Web Site Traffic
Business and Management
Computer and Internet Basics
d) None of the Above
Google Gmail Help
Google Plus Help
Industry News and Trade Shows
iPhone and Cell Phone Help
iPod, Sony PSP and MP3 Player Help
Kindle Fire Help
Mac OS X Help
Pay Per Click (PPC) Advertising
Search Engine Optimization (SEO)
Shell Script Programming
Tech Support Video Help
The Writing Business
Twitter, LinkedIn and Social Network Help
Unix and Linux Help
Video Game Tips and Help
Windows PC Help
Find Me on Google+
ADT on G+