Understand binary magnitudes and the difference between binary and decimal prefixes
Use binary, denary, and hexadecimal number systems
Convert between all three number bases using multiple methods
Perform binary addition and subtraction with positive and negative integers
Understand BCD and One's/Two's complement representation
Understand overflow errors and character encoding (ASCII, Unicode)
1. Number Systems Overview
A number system is a way of representing amounts or quantities using a specific set of symbols and rules. Computers use different number systems to process and store data efficiently.
1.1 Denary (Decimal) Number System
The number system we use in everyday life is called denary (or decimal). It has a base of 10 because it uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each position represents a power of 10.
1.2 Binary Number System
The binary number system uses only two digits: 0 and 1. It has a base of 2. Each position represents a power of 2. This is the fundamental language of computers because electronic circuits can easily represent two states: ON (1) and OFF (0).
โ ๏ธ Important Terms
Bit - A single binary digit (0 or 1)
Byte - A group of 8 bits
Nibble - A group of 4 bits (half a byte)
MSB - Most Significant Bit (leftmost bit)
LSB - Least Significant Bit (rightmost bit)
1.3 Hexadecimal Number System
The hexadecimal (hex) number system uses 16 symbols: digits 0-9 and letters A-F. It has a base of 16. Hex is widely used in computing because it provides a more compact way to represent binary values.
Denary
0
1
2
3
4
5
6
7
Hex
0
1
2
3
4
5
6
7
Denary
8
9
10
11
12
13
14
15
Hex
8
9
A
B
C
D
E
F
2. Denary โ Binary Conversions
2.1 Denary to Binary Conversion
There are two main methods to convert denary numbers to binary. Choose the one that works best for you!
๐ Method 1: Repeated Division by 2
This method involves repeatedly dividing by 2 and recording remainders.
Divide the denary number by 2
Record the remainder (0 or 1)
Use the quotient (answer) as the new number
Repeat until the quotient is 0
Read remainders from BOTTOM to TOP
๐ Method 2: Positional Value Method (Subtraction)
This method subtracts the largest possible powers of 2 from the number.
Write down the powers of 2: 128, 64, 32, 16, 8, 4, 2, 1
Find the largest power that fits into your number
Put a 1 under that power, subtract it from your number
Continue until the remainder is 0
Put 0 under any unused powers
2.2 Binary to Denary Conversion
Converting binary to denary is straightforward - simply add up the positional values where there is a 1.
๐ Method: Add Positional Values
Write the binary number
Write the powers of 2 above each bit position
Multiply each bit by its positional value
Add all the results together
๐ก Exam Tip
Quick Check: A binary number is odd if its rightmost digit (LSB) is 1, and even if it's 0!
Example: 11010010 ends in 0 โ even (210 is even) โ
3. Denary โ Hexadecimal Conversions
3.1 Denary to Hexadecimal Conversion
There are two methods to convert denary to hexadecimal. Both are useful - choose based on the exam question!
๐ Method 1: Repeated Division by 16
Divide the denary number by 16
Record the remainder (convert 10-15 to A-F)
Use the quotient as the new number
Repeat until the quotient is 0
Read remainders from BOTTOM to TOP
๐ Method 2: Via Binary (Two-Step Method)
Convert denary to binary first
Split the binary into nibbles (groups of 4 bits) from the right
Convert each nibble to its hex equivalent
Join the hex digits together
3.2 Hexadecimal to Denary Conversion
Multiply each hex digit by its positional value (powers of 16) and add them together.
๐ Method: Positional Value Method
Write down each hex digit
Convert letters A-F to their decimal values (A=10, B=11, ... F=15)
Multiply each digit by 16 raised to its position power
Add all results together
Another Example: Convert BE to Denary
B = 11, E = 14
BEโโ = (11 ร 16ยน) + (14 ร 16โฐ) = (11 ร 16) + (14 ร 1) = 176 + 14 = 190โโ
๐ง Memory Trick
Hex Letter Values:
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Think: A starts at 10, and counts up! F = Final = 15 (the last single hex digit)
4. Binary โ Hexadecimal Conversions
Binary and hexadecimal have a special relationship: each hex digit equals exactly 4 bits (one nibble)! This makes conversions between them very quick and easy.
4.1 Binary to Hexadecimal Conversion
๐ Method: Nibble Grouping
Start from the right side of the binary number
Group bits into sets of 4 (nibbles)
If the leftmost group has fewer than 4 bits, pad with leading zeros
Convert each nibble to its hex equivalent (0-F)
Join all hex digits together
Binary
0000
0001
0010
0011
0100
0101
0110
0111
Hex
0
1
2
3
4
5
6
7
Binary
1000
1001
1010
1011
1100
1101
1110
1111
Hex
8
9
A
B
C
D
E
F
4.2 Hexadecimal to Binary Conversion
๐ Method: Digit-by-Digit Conversion
Take each hex digit separately
Convert each hex digit to its 4-bit binary equivalent
Join all the nibbles together
Leading zeros from the leftmost nibble can be removed (optional)
๐ก Exam Tip
Quick conversions between Hex and Binary are essential!
Memorize the 16 nibble patterns (0000 to 1111) and their hex equivalents. This makes conversions almost instant!
Tip: The decimal value 8 = binary 1000 = hex 8. Everything above 8 (9-F) has the 8-bit set!
5. Binary Prefixes
When measuring data storage, there are two systems of prefixes: decimal (denary) prefixes based on powers of 10, and binary prefixes based on powers of 2. Understanding the difference is crucial for accurate calculations.
Decimal Unit
Value
Binary Unit
Value
Kilobyte (KB)
10ยณ = 1,000
Kibibyte (KiB)
2ยนโฐ = 1,024
Megabyte (MB)
10โถ = 1,000,000
Mebibyte (MiB)
2ยฒโฐ = 1,048,576
Gigabyte (GB)
10โน = 1,000,000,000
Gibibyte (GiB)
2ยณโฐ = 1,073,741,824
Terabyte (TB)
10ยนยฒ = 1,000,000,000,000
Tebibyte (TiB)
2โดโฐ = 1,099,511,627,776
Petabyte (PB)
10ยนโต = 1,000,000,000,000,000
Pebibyte (PiB)
2โตโฐ = 1,125,899,906,842,624
๐ก When to Use Which?
Use binary prefixes (KiB, MiB, GiB) for precise RAM/memory calculations
Use decimal prefixes (KB, MB, GB) for storage devices (hard drives, USBs)
Have you ever bought a "500 GB" hard drive and found it shows less space in Windows? That's because Windows uses binary prefixes (GiB) but labels them as GB!
The manufacturer is correct (500 GB = 500 billion bytes), but Windows displays it in binary units!
๐ง Memory Trick
"ibi" for Binary
Kibi, Mebi, Gibi, Tebi - all have "ibi" which sounds like "binary"
Kilo, Mega, Giga, Tera - standard metric prefixes (base 10)
6. Binary Arithmetic & Overflow
6.1 Binary Addition Rules
Binary addition follows specific rules similar to decimal addition. When the sum exceeds what can be represented in a single column, a carry is generated.
๐ Binary Addition Rules
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 (carry 1 to next column)
1 + 1 + 1 = 1 (carry 1 to next column)
6.2 Binary Subtraction
Binary subtraction can be performed directly or using the two's complement method. The two's complement method is preferred as it converts subtraction into addition.
๐ Binary Subtraction Rules (Direct Method)
0 - 0 = 0
1 - 0 = 1
1 - 1 = 0
0 - 1 = 1 (borrow 1 from next column)
โ ๏ธ Two's Complement Subtraction Method
To calculate A - B:
Convert both numbers to binary
Find the two's complement of B (the number being subtracted)
Overflow occurs when the result of a calculation is too large to be stored in the allocated number of bits. For example, an 8-bit unsigned system can only store values from 0 to 255.
โ Common Mistake: 8-bit Overflow
Example: 255 + 1 in an 8-bit system
11111111 + 1 = 100000000
The 9th bit cannot be stored, so result becomes 00000000 = 0!
This is an error - the computer "wraps around" to the wrong answer.
7. Internal Coding of Integers
Computers need to represent both positive and negative integers. There are several methods to achieve this, each with advantages and limitations.
7.1 Unsigned Integers
Unsigned integers can only represent non-negative values. All bits are used for the magnitude.
๐ Unsigned Integer Range
8-bit: 0 to 255 (2โธ - 1)
16-bit: 0 to 65,535 (2ยนโถ - 1)
32-bit: 0 to 4,294,967,295 (2ยณยฒ - 1)
7.2 Sign and Magnitude
In sign and magnitude, the leftmost bit (MSB) is the sign bit: 0 = positive, 1 = negative. Remaining bits store the magnitude.
โ Disadvantages of Sign and Magnitude
Two representations of zero: 00000000 (+0) and 10000000 (-0)
Range reduced: 8-bit only represents -127 to +127
Arithmetic requires comparing signs first (inefficient)
7.3 Two's Complement (Standard Method)
Two's complement is the standard method for representing signed integers. It allows both positive and negative numbers to use the same addition/subtraction hardware.
๐ How to Find Two's Complement
Method 1:
Find one's complement (invert all bits: 0โ1, 1โ0)
Add 1 to the result
Method 2 (Shortcut):
From the right, keep all bits unchanged up to and including the first 1, then invert all remaining bits.
๐ก Advantages of Two's Complement
Only one representation of zero (no -0 problem)
Same hardware for addition and subtraction
8-bit range: -128 to +127 (extra negative value)
Self-complementary: applying twice returns original number
๐ One's Complement
One's complement is found by inverting all bits. It's used as an intermediate step to find two's complement.
Example: One's complement of 10001001 = 01110110
8. BCD & Character Encoding
8.1 Binary Coded Decimal (BCD)
Binary Coded Decimal (BCD) represents each decimal digit (0-9) with its own 4-bit binary code. Each nibble represents one decimal digit separately.
๐ BCD Encoding Table
0 = 0000, 1 = 0001, 2 = 0010, 3 = 0011, 4 = 0100
5 = 0101, 6 = 0110, 7 = 0111, 8 = 1000, 9 = 1001
๐ Practical Applications of BCD
Digital displays: Calculators, digital clocks, multimeters
Financial systems: Exact decimal representation (no rounding errors)
Embedded systems: Simple decimal I/O conversion
8.2 Character Encoding
Computers represent text characters using numeric codes. Different character sets define which codes correspond to which characters.
๐ ASCII (American Standard Code for Information Interchange)
Uses 7 bits to represent 128 characters
Includes: A-Z, a-z, 0-9, punctuation, control characters
Important codes: 'A' = 65, 'a' = 97, '0' = 48, space = 32
๐ Extended ASCII
Uses 8 bits to represent 256 characters
First 128 characters match standard ASCII
Additional characters (128-255) for special symbols
Problem: Different regions had different extended sets!
โ ๏ธ Unicode - The Modern Standard
Aims to represent every character from all languages
Can represent over 1 million characters
UTF-8: Variable-length (1-4 bytes), backwards compatible with ASCII
First 128 Unicode characters match ASCII exactly!
Character Set
Bits Used
Total Characters
Notes
ASCII
7 bits
128
Basic English characters
Extended ASCII
8 bits
256
Regional variations
Unicode (UTF-8)
8-32 bits
1M+
Universal standard
๐ง Memory Trick
Remember the gap between 'A' and 'a':
'A' = 65, 'a' = 97 โ Difference = 32
Upper to lower: Add 32 | Lower to upper: Subtract 32
9. Key Takeaways
๐ Summary Points
Topic 1: Number Systems
Denary uses base-10 (digits 0-9)
Binary uses base-2 (digits 0-1) - fundamental to computers