You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Understanding number systems is the foundation of data representation in Computer Science. Computers operate using binary (base-2), while humans typically use denary (base-10, also called decimal). This lesson explains both systems and how to convert between them.
The denary system is the number system you use every day. It is a base-10 system, meaning it uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Each column in a denary number represents a power of 10:
| Thousands (10³) | Hundreds (10²) | Tens (10¹) | Units (10⁰) |
|---|---|---|---|
| 1000 | 100 | 10 | 1 |
For example, the number 3742 means:
This is called positional notation — the value of a digit depends on its position in the number.
The binary system is a base-2 system. It uses only two digits: 0 and 1. Each digit in a binary number is called a bit (short for binary digit).
Each column in a binary number represents a power of 2:
| 128 (2⁷) | 64 (2⁶) | 32 (2⁵) | 16 (2⁴) | 8 (2³) | 4 (2²) | 2 (2¹) | 1 (2⁰) |
|---|---|---|---|---|---|---|---|
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Computers are built from billions of tiny electronic switches called transistors. Each transistor can be in one of two states:
Because there are only two states, binary is the natural number system for computers. Everything a computer processes — numbers, text, images, sound — is ultimately stored as sequences of 0s and 1s.
To convert a binary number to denary, write out the place values and add up the columns that contain a 1.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
Add the place values where the bit is 1:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
To convert a denary number to binary, use the successive division by 2 method or the place value method.
200 in binary = 11001000
| Division | Quotient | Remainder |
|---|---|---|
| 53 ÷ 2 | 26 | 1 |
| 26 ÷ 2 | 13 | 0 |
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Reading remainders bottom to top: 53 in binary = 110101
(As an 8-bit binary number with leading zeros: 00110101)
Exam Tip: Always double-check your binary-to-denary conversions by adding up the place values. A common mistake is misaligning the place values. An 8-bit number has a maximum unsigned value of 255 (11111111 in binary = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1).