Welcome to Number Systems!
Welcome to one of the most fundamental chapters in your AQA Computer Science course! Before we can understand how computers store photos, play music, or run games, we need to understand the "language" they speak. While we use ten fingers to count, computers use electricity—and that changes everything. Don't worry if this seems a bit "maths-heavy" at first; we will break it down into simple steps that make sense for everyone.
1. Classifying Numbers
In Computer Science, we don't just see "numbers." We group them into specific sets based on what they can do. Think of these like different "folders" on a computer.
Natural Numbers \( (\mathbb{N}) \)
These are your basic "counting" numbers. AQA defines these as starting from zero.
• Set: \( \{0, 1, 2, 3, \dots\} \)
• Example: The number of people in a room or the number of files in a folder.
Integer Numbers \( (\mathbb{Z}) \)
These are whole numbers, but they can be positive, negative, or zero.
• Set: \( \{\dots, -2, -1, 0, 1, 2, \dots\} \)
• Example: A bank balance (which could be negative if you spend too much!) or a temperature reading.
Rational Numbers \( (\mathbb{Q}) \)
Think of "Rational" as "Ratio." These are numbers that can be written as a fraction \( (a/b) \). This includes all integers because \( 7 \) is just \( 7/1 \).
• Example: \( 1/2 \), \( 0.75 \), or \( -3/4 \).
Irrational Numbers
These numbers cannot be written as a simple fraction. Their decimals go on forever without repeating a pattern.
• Example: \( \sqrt{2} \) or \( \pi \) (Pi).
• Common Mistake: Many students think \( 3.14 \) is irrational, but it’s actually a terminating decimal (a rational number). True \( \pi \) never ends!
Real Numbers \( (\mathbb{R}) \)
This is the "master set." It includes all the numbers above (Natural, Integer, Rational, and Irrational). Real numbers represent any possible measurement in the real world.
Ordinal Numbers
These aren't used for math; they are used to show position or rank.
• Example: If you have a list of items \( \{A, B, C\} \), then 'A' is the 1st object, 'B' is the 2nd, and so on.
• Memory Aid: Ordinal = Order.
Quick Review: Counting vs. Measurement
• Use Natural Numbers for counting individual things (like 5 apples).
• Use Real Numbers for measurement (like a string being 5.23cm long).
Key Takeaway: Different tasks require different number types. If you only need to count, \( \mathbb{N} \) is enough. If you need to measure the universe, you need \( \mathbb{R} \).
2. Number Bases
A "base" tells us how many digits are available in a number system.
Decimal (Base 10)
The system we use every day. It uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Binary (Base 2)
The "native language" of computers. It only uses 2 digits: 0 and 1. Computers use this because they are made of tiny switches that are either OFF (0) or ON (1).
Hexadecimal (Base 16)
This uses 16 digits. Since we run out of numbers after 9, we use letters:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A(10), B(11), C(12), D(13), E(14), F(15).
• Why use it? Binary is hard for humans to read (e.g., 10101110). Hex is a shorthand that makes binary easier to manage. One Hex digit represents exactly four binary bits!
Did you know? You see Hexadecimal every day in web design! HTML color codes like #FF5733 use Hex to tell the computer exactly how much Red, Green, and Blue to show.
3. Conversions: Step-by-Step
Binary to Decimal
1. Write out the binary number.
2. Place the "column weights" (powers of 2) above them, starting from the right: 128, 64, 32, 16, 8, 4, 2, 1.
3. Add up the weights that have a '1' underneath them.
• Example: \( 1011_2 \)
• Weights: (8, 4, 2, 1) -> \( 8 + 0 + 2 + 1 = 11_{10} \).
Decimal to Binary
1. Use the "Remainder Method" (divide by 2 repeatedly) OR the "Subtraction Method" (subtract the largest possible power of 2).
• Subtraction Method for 13:
• Can we take away 8? Yes (Leaves 5). Write a 1.
• Can we take away 4? Yes (Leaves 1). Write a 1.
• Can we take away 2? No. Write a 0.
• Can we take away 1? Yes (Leaves 0). Write a 1.
• Result: \( 1101_2 \).
Binary to Hexadecimal
1. Split the binary number into groups of 4 bits starting from the right.
2. Convert each group of 4 into its Hex equivalent.
• Example: \( 10111110_2 \)
• Split: \( 1011 \) | \( 1110 \)
• \( 1011 = 11 \) (which is B)
• \( 1110 = 14 \) (which is E)
• Result: \( BE_{16} \).
Key Takeaway: To indicate which base you are using, use a subscript, like \( 101_{10} \) (Decimal) vs \( 101_2 \) (Binary).
4. Units of Information
How do we measure "data"?
Bits and Bytes
• Bit: The smallest unit. A single 0 or 1.
• Byte: A group of 8 bits.
• The \( 2^n \) Rule: With \( n \) bits, you can represent \( 2^n \) different values.
• Example: 3 bits can represent \( 2^3 = 8 \) different values (000 through 111).
The Prefix Trap: Binary vs. Decimal
This is where many students lose marks! There are two ways to measure large amounts of data.
Decimal Prefixes (Powers of 10)
These are the ones you use in Physics or for storage drive marketing.
• kilo (k): \( 10^3 = 1,000 \)
• mega (M): \( 10^6 = 1,000,000 \)
• giga (G): \( 10^9 = 1,000,000,000 \)
• tera (T): \( 10^{12} = 1,000,000,000,000 \)
Binary Prefixes (Powers of 2)
Computer Scientists prefer these because they align with how memory actually works.
• kibi (Ki): \( 2^{10} = 1,024 \)
• mebi (Mi): \( 2^{20} = 1,048,576 \)
• gibi (Gi): \( 2^{30} = 1,073,741,824 \)
• tebi (Ti): \( 2^{40} = 1,099,511,627,776 \)
Memory Tip: If it has an "i" in the name (like kibi), it belongs to the binary system (powers of 2)!
Quick Review:
• 1 Kilobyte (kB) = 1,000 bytes.
• 1 Kibibyte (KiB) = 1,024 bytes.
• Historically, people said "kilobyte" when they actually meant 1,024. In your exam, be precise!
Key Takeaway: Computers use binary prefixes because they are built on powers of 2. Using 1,000 is an approximation; 1,024 is the reality of the hardware.