Introduction to Binary and Decimal Numbers
Welcome to one of the most fundamental topics in Digital Technology! Have you ever wondered how your smartphone, computer, or games console processes photos, plays music, and runs video games? Beneath all the fancy screens and software, computers are powered by billions of tiny electrical circuits. These circuits only understand two basic states: on and off.
In this chapter, you will learn how computers use the binary number system to represent data, how it compares to our everyday decimal (denary) system, and how to convert easily between the two. Don't worry if maths isn't your favourite subject — once you learn the step-by-step methods, working with binary is like solving a fun puzzle!
Did you know? The word bit is short for binary digit. It is the smallest possible unit of data in computer science!
---1. Understanding Number Systems
The Decimal (Denary) System (Base 10)
From an early age, humans learn to count using the decimal (or denary) system. We use Base 10 because humans have ten fingers! In Base 10:
• There are ten possible digits: \(0, 1, 2, 3, 4, 5, 6, 7, 8, 9\).
• Each column has a place value based on powers of \(10\): units (\(10^0 = 1\)), tens (\(10^1 = 10\)), hundreds (\(10^2 = 100\)), thousands (\(10^3 = 1000\)), and so on.
• When you write the number \(253\), it really means: \((2 \times 100) + (5 \times 10) + (3 \times 1)\).
The Binary System (Base 2)
Computers do not have ten fingers; they have electronic circuits made up of tiny switches called transistors. Because a switch can only be either OFF (no voltage) or ON (voltage present), computers use Base 2:
• There are only two possible digits: \(0\) (representing OFF) and \(1\) (representing ON).
• Each column has a place value based on powers of \(2\): \(2^0 = 1\), \(2^1 = 2\), \(2^2 = 4\), \(2^3 = 8\), \(2^4 = 16\), and so on.
• Each doubling step gives the column its weight from right to left.
Analogy: Imagine a row of light switches in your house. Each switch can only be flipped down (\(0\)) or up (\(1\)). By turning specific switches on or off, you can represent any number you want!
Why do computers use binary instead of decimal?
• Simplicity and Reliability: It is much easier and cheaper to build electronic circuits that only need to detect two states (voltage or no voltage) rather than ten different voltage levels.
• Resistance to Interference: Electrical noise or slight voltage drops won't confuse a computer because any voltage above a certain threshold is read as a \(1\), and anything below is a \(0\).
• Logic Processing: Binary aligns perfectly with Boolean logic (True / False), which powers computer processors.
Key Takeaway: Denary uses Base 10 (\(0\text{--}9\)), while Binary uses Base 2 (\(0\text{ and }1\)). Computers use binary because it is simple, fast, and highly reliable to implement using electronic switches.
---2. Data Units: Bits, Nibbles, and Bytes
Before jumping into conversions, let's look at the basic building blocks of digital data:
• Bit (b): A single binary digit (\(0\) or \(1\)).
• Nibble: A group of \(4\) bits (e.g. \(1011_2\)).
• Byte (B): A group of \(8\) bits (e.g. \(11010110_2\)). A single byte can store one character of text, like the letter 'A'.
How Many Values Can We Represent?
The total number of unique combinations you can make with \(n\) bits is given by the formula:
\(\text{Total Combinations} = 2^n\)
• With \(1\) bit: \(2^1 = 2\) values (\(0\) to \(1\))
• With \(4\) bits (a nibble): \(2^4 = 16\) values (\(0\) to \(15\))
• With \(8\) bits (a byte): \(2^8 = 256\) values (\(0\) to \(255\))
Memory Tip: The maximum number you can store with \(n\) bits is always \(2^n - 1\). For \(8\) bits, that is \(256 - 1 = 255\).
---3. Converting Binary to Decimal (Denary)
Converting an \(8\)-bit binary number into a decimal number is straightforward. We use an 8-bit place value table.
The 8-Bit Place Value Table
Always write out these powers of \(2\) from right to left (starting at \(1\) and doubling each time):
\(128\) | \(64\) | \(32\) | \(16\) | \(8\) | \(4\) | \(2\) | \(1\)
Step-by-Step Conversion Method:
Step 1: Write your binary number directly underneath the place value headings.
Step 2: Look for every column that has a \(1\) underneath it.
Step 3: Add the column values together. (Ignore the columns with a \(0\)).
Worked Example 1: Convert \(10010110_2\) to Decimal
Let's line up the digits under the headings:
• Place value \(128\) \(\rightarrow\) Binary digit: \(1\) (Keep \(128\))
• Place value \(64\) \(\rightarrow\) Binary digit: \(0\)
• Place value \(32\) \(\rightarrow\) Binary digit: \(0\)
• Place value \(16\) \(\rightarrow\) Binary digit: \(1\) (Keep \(16\))
• Place value \(8\) \(\rightarrow\) Binary digit: \(0\)
• Place value \(4\) \(\rightarrow\) Binary digit: \(1\) (Keep \(4\))
• Place value \(2\) \(\rightarrow\) Binary digit: \(1\) (Keep \(2\))
• Place value \(1\) \(\rightarrow\) Binary digit: \(0\)
Now, add the active values together:
\(128 + 16 + 4 + 2 = 150_{10}\)
So, \(10010110_2 = 150_{10}\).
Worked Example 2: Convert \(00101101_2\) to Decimal
• Active columns with a \(1\): \(32\), \(8\), \(4\), \(1\)
• Addition: \(32 + 8 + 4 + 1 = 45_{10}\)
So, \(00101101_2 = 45_{10}\).
Common Mistake to Avoid: Make sure you write your place values from right to left (\(1, 2, 4, 8, \dots\)). Writing them left to right is the most common reason students lose marks on this question!
Key Takeaway: To convert binary to decimal, simply add up the place values where the binary digit is \(1\).
---4. Converting Decimal (Denary) to Binary
There are two reliable methods to convert a decimal number into binary. Let's look at both.
Method 1: The Place Value / Subtraction Method (Recommended)
This is usually the quickest and easiest method for AS Level examinations.
Step 1: Write out the \(8\)-bit place values: \(128, 64, 32, 16, 8, 4, 2, 1\).
Step 2: Move from left to right. Ask yourself: "Does this place value fit into my remaining number?"
• If YES: Put a \(1\) in that column, and subtract that place value from your current number.
• If NO: Put a \(0\) in that column, and keep the number as it is.
Step 3: Repeat until you reach the \(1\) column (your remainder should end at \(0\)).
Worked Example: Convert \(182_{10}\) to 8-bit Binary
• Does \(128\) fit into \(182\)? Yes \(\rightarrow\) Put \(1\). Remainder: \(182 - 128 = 54\).
• Does \(64\) fit into \(54\)? No \(\rightarrow\) Put \(0\). Remainder stays \(54\).
• Does \(32\) fit into \(54\)? Yes \(\rightarrow\) Put \(1\). Remainder: \(54 - 32 = 22\).
• Does \(16\) fit into \(22\)? Yes \(\rightarrow\) Put \(1\). Remainder: \(22 - 16 = 6\).
• Does \(8\) fit into \(6\)? No \(\rightarrow\) Put \(0\). Remainder stays \(6\).
• Does \(4\) fit into \(6\)? Yes \(\rightarrow\) Put \(1\). Remainder: \(6 - 4 = 2\).
• Does \(2\) fit into \(2\)? Yes \(\rightarrow\) Put \(1\). Remainder: \(2 - 2 = 0\).
• Does \(1\) fit into \(0\)? No \(\rightarrow\) Put \(0\). Remainder: \(0\).
Combine the digits together: \(10110110_2\).
Let's double-check: \(128 + 32 + 16 + 4 + 2 = 182\). Correct!
Method 2: The Repeated Division by 2 Method
If you prefer an algorithmic approach, you can repeatedly divide the decimal number by \(2\) and record the remainders.
Step 1: Divide the number by \(2\).
Step 2: Write down the integer quotient and record the remainder (\(0\) or \(1\)).
Step 3: Repeat with the quotient until you reach \(0\).
Step 4: Read the remainders from bottom to top (the last remainder is the most significant bit on the far left).
Worked Example: Convert \(53_{10}\) to Binary using Division
• \(53 \div 2 = 26\) remainder \(1\) (Least Significant Bit - far right)
• \(26 \div 2 = 13\) remainder \(0\)
• \(13 \div 2 = 6\) remainder \(1\)
• \(6 \div 2 = 3\) remainder \(0\)
• \(3 \div 2 = 1\) remainder \(1\)
• \(1 \div 2 = 0\) remainder \(1\) (Most Significant Bit - far left)
Reading the remainders from bottom to top gives: \(110101_2\).
If asked for an 8-bit byte, add leading zeros to the left: \(00110101_2\).
Exam Tip: If the question asks for an 8-bit binary number or a byte, always ensure your final answer has exactly \(8\) digits by adding leading zeros if needed!
---5. Quick Summary and Revision Checklist
Key Concepts to Remember:
• Decimal / Denary: Base 10, digits \(0\text{--}9\).
• Binary: Base 2, digits \(0\) and \(1\). Represents electrical states (OFF/ON).
• Bit: A single binary digit.
• Nibble: \(4\) bits (maximum value \(15\)).
• Byte: \(8\) bits (maximum value \(255\)).
• Place values (8-bit): \(128, 64, 32, 16, 8, 4, 2, 1\).
• To convert Binary \(\rightarrow\) Denary: Add up the column values where there is a \(1\).
• To convert Denary \(\rightarrow\) Binary: Use subtraction against the place value table or repeated division by \(2\).