Welcome to the World of Number Bases!
Hi there! Have you ever wondered how a computer, which is basically a collection of wires and electricity, can show you a high-definition movie or play your favorite song? It all starts with how computers "count." In this chapter, we are going to learn about the different number bases that make computing possible. Don't worry if this seems a bit "maths-heavy" at first—once you see the patterns, it’s like cracking a secret code!
3.3.1 What are Number Bases?
A number base is simply the number of digits available in a counting system. We use different bases for different reasons.
1. Decimal (Base 10)
This is the system you've used since primary school. It uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
Analogy: Think of this as having ten fingers to count on. Once you run out of fingers, you start a new column (the "tens" column).
2. Binary (Base 2)
This is the "native language" of computers. It uses only 2 digits: 0 and 1.
Key Point: Computers use binary because they are made of billions of tiny switches called transistors. A switch can only be OFF (0) or ON (1).
Did you know? Every single thing you see on a computer—a TikTok video, a text message, or an emoji—is stored as a long pattern of 1s and 0s called a bit pattern.
3. Hexadecimal (Base 16)
This system uses 16 digits. Since we ran out of normal numbers after 9, we use letters!
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
In Hex: A=10, B=11, C=12, D=13, E=14, and F=15.
Why do we bother with Hexadecimal?
Computers don't actually "think" in Hex; they only think in Binary. We use Hexadecimal because:
• It is much shorter than binary (4 bits of binary can be replaced by 1 hex digit).
• It is easier for humans to read and remember.
• There is less chance of making a mistake when typing a Hex code compared to a long string of 0s and 1s.
Quick Review:
• Decimal: Base 10 (0-9).
• Binary: Base 2 (0-1). Used by computers because of ON/OFF switches.
• Hexadecimal: Base 16 (0-F). Used by humans as a shorthand for binary.
3.3.2 Converting Between Bases
To pass your exam, you need to be able to "translate" between these three systems for numbers between 0 and 255.
Binary to Decimal (The "Table" Method)
To convert binary to decimal, draw a table with 8 columns. Start at the right with 1 and double the number as you move left:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
Simply put your binary number into the table and add up the values where there is a 1.
Example: Convert 10100000 to decimal.
128(1) + 64(0) + 32(1) + 16(0) + 8(0) + 4(0) + 2(0) + 1(0)
Calculation: \( 128 + 32 = 160 \).
So, 10100000 is 160 in decimal.
Decimal to Binary (The "Subtract" Method)
Use the same table: 128, 64, 32, 16, 8, 4, 2, 1.
1. Look at your decimal number. Can you subtract 128 from it?
2. If YES, put a 1 in the 128 box and keep the remainder.
3. If NO, put a 0 and move to the next box (64).
Repeat until you reach the end!
Binary to Hexadecimal (The "Nibble" Trick)
This is the easiest conversion if you remember this trick: Split the 8-bit binary number into two 4-bit "nibbles."
Example: 10110101
Step 1: Split it: 1011 | 0101
Step 2: Convert each side to a decimal number (using 8, 4, 2, 1).
Left side (1011): \( 8 + 2 + 1 = 11 \). In Hex, 11 is B.
Right side (0101): \( 4 + 1 = 5 \). In Hex, 5 is 5.
Step 3: Put them together: B5.
Hexadecimal to Decimal
A Hex number has two places: the 16s and the 1s.
Example: 2A
1. Convert the letters to numbers: A = 10.
2. Multiply the left digit by 16: \( 2 \times 16 = 32 \).
3. Multiply the right digit by 1: \( 10 \times 1 = 10 \).
4. Add them together: \( 32 + 10 = 42 \).
Common Mistake to Avoid:
When converting to Hex, students often forget that A is 10. A simple trick is to write the letters A-F on your exam paper and number them 10-15 immediately so you don't have to count on your fingers during the pressure of the exam!
Key Takeaway for Conversions:
• Max Decimal: 255
• Max Binary: 1111 1111
• Max Hex: FF
(They are all the same value!)
Quick Summary & Memory Aids
The Magic Number Line
Memorize these numbers! They are the secret to almost every calculation in this chapter:
128, 64, 32, 16, 8, 4, 2, 1
Key Terms to Remember
• Bit: A single 0 or 1.
• Nibble: 4 bits (one Hex digit).
• Byte: 8 bits (two Hex digits).
• Base 2: Binary.
• Base 10: Decimal (Denary).
• Base 16: Hexadecimal.
Don't worry if you find the conversions tricky at first. The more you practice the "table method," the faster you will get. Try converting your age or your house number into binary just for fun!