Binary System- Clear Examples and Applications
What Is the Binary System?
The binary system is a way of counting that uses only two digits: 0 and 1. Unlike the decimal system you're used to (which has ten digits: 0-9), binary strips everything down to on/off, true/false, yes/no.
That's it. Two symbols. Everything in computing boils down to this.
Why Binary? Why Not Use Decimal?
Computers don't think like humans. They work with electrical signals, and an electrical signal is either on or off. There's no "sort of on" or "mostly off" at the hardware level.
So you need a number system that matches how the hardware actually works. Binary maps perfectly:
- 1 = electrical signal present (on)
- 0 = no signal (off)
Each binary digit is called a bit. Eight bits make a byte. That's 256 possible combinations (2^8).
How Binary Numbers Work
In decimal, each position represents a power of 10:
543 = (5 × 100) + (4 × 10) + (3 × 1)
Binary follows the same logic, but each position is a power of 2:
1011 = (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1) = 11 in decimal
Binary Place Values
| Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 2^position | 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
Common Binary Numbers You'll See
| Binary | Decimal | Notes |
|---|---|---|
| 00000000 | 0 | Nothing |
| 00000001 | 1 | One |
| 00000111 | 7 | Max 3-bit value |
| 11111111 | 255 | Max byte (8 bits) |
| 10101010 | 170 | Alternating pattern |
Converting Decimal to Binary
Here's the division method. It's straightforward:
- Divide the number by 2
- Write down the remainder (0 or 1)
- Repeat until you hit 0
- Read the remainders from bottom to top
Example: Convert 13 to binary
- 13 ÷ 2 = 6 remainder 1
- 6 ÷ 2 = 3 remainder 0
- 3 ÷ 2 = 1 remainder 1
- 1 ÷ 2 = 0 remainder 1
Reading bottom to top: 1101
Check: (1×8) + (1×4) + (0×2) + (1×1) = 8 + 4 + 0 + 1 = 13 ✓
Binary Arithmetic: The Basics
Addition
Binary addition follows four rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (which is 0 carry 1)
Example: 101 + 11
101 + 11 ----- 1000
Step by step: 1+1=10, write 0 carry 1. Then 0+1+carry=10, write 0 carry 1. Then 1+carry=10, write 0 carry 1 to new position. Result: 1000 (which is 8 in decimal, and 5+3=8).
Bitwise Operations
These are operations that compare bits directly:
| Operation | Symbol | What It Does |
|---|---|---|
| AND | & | 1 only if both bits are 1 |
| OR | | | 1 if either bit is 1 |
| XOR | ^ | 1 only if bits are different |
| NOT | ~ | Flips all bits (0→1, 1→0) |
Real-World Applications
1. Data Storage
Every file on your computer is stored as binary. Text files, images, videos, music—it's all 1s and 0s. A 2-hour HD movie is roughly 3-4 gigabytes, which means 24-32 billion bits. 💾
2. Network Addresses
IPv4 addresses are 32-bit numbers. That's what "192.168.1.1" really is—four groups of 8 bits each. IPv6 uses 128 bits, giving you roughly 340 undecillion addresses. (That's 340 followed by 36 zeros.)
3. Color Codes
RGB color values are typically 8 bits per channel. That's 256 possible values each for red, green, and blue. Total combinations: 16.7 million colors. The hex code #FF5733? That's just binary converted to hexadecimal for brevity.
4. Boolean Logic in Programming
Conditions in code use binary logic:
if (userLoggedIn == true && hasPermission == true) {
// grant access
}
Those boolean checks are bit-level operations happening millions of times per second.
5. Error Detection
Parity bits and checksums use binary math to detect data corruption. When you download a file, the system verifies it using binary arithmetic. If the numbers don't match, something got corrupted in transit.
Getting Started: Practice Exercises
Here's how to get comfortable with binary:
Exercise 1: Convert These to Decimal
- 1001 = ?
- 1111 = ?
- 101010 = ?
- 001001 = ?
Answers: 9, 15, 42, 9
Exercise 2: Convert These to Binary
- 25 = ?
- 100 = ?
- 7 = ?
- 64 = ?
Answers: 11001, 1100100, 111, 1000000
Exercise 3: Add These Binary Numbers
- 110 + 101 = ?
- 1111 + 1 = ?
Answers: 1011, 10000
Quick Reference: Binary to Decimal (0-15)
| Binary | Decimal | Binary | Decimal |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | 10 |
| 0011 | 3 | 1011 | 11 |
| 0100 | 4 | 1100 | 12 |
| 0101 | 5 | 1101 | 13 |
| 0110 | 6 | 1110 | 14 |
| 0111 | 7 | 1111 | 15 |
Why This Matters
You don't need to memorize every binary number. But understanding how binary works gives you insight into why computers do what they do. Why 256 is a common limit. Why 32-bit systems max out at ~4GB of RAM. Why certain operations are fast or slow.
It's the foundation. Everything else in computing builds on this. 🔧