Welcome to the World of Binary!

Hello future Computer Scientist! Ready to tackle the chapter that defines how computers really think? This is the "Binary" chapter, and it sits right at the heart of our study of Data.

Why is this important? Because everything a computer processes—your photos, your games, your documents—is ultimately stored and understood as a massive sequence of simple electrical signals: ON or OFF. We represent these signals using just two digits: 0 and 1. This two-digit language is called Binary.

Don't worry if conversion seems tricky at first. We’re going to break it down using easy steps and cool memory tricks. Let’s get started!

1. Understanding Number Systems: Denary vs. Binary

The System We Know: Denary (Base 10)

We use the Denary system every day. It’s also called Base 10 because we use ten different digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).

The value of a digit depends on its place value, which is based on powers of 10.
Example: The number 457

  • The 7 is in the Units column (\(10^0 = 1\))
  • The 5 is in the Tens column (\(10^1 = 10\))
  • The 4 is in the Hundreds column (\(10^2 = 100\))

The Language of Computers: Binary (Base 2)

The Binary system is the backbone of computing. It is a Base 2 system because it uses only two digits: 0 and 1.

  • 0 usually represents an electrical signal being Off or False.
  • 1 usually represents an electrical signal being On or True.

Analogy: Think of binary like a row of simple light switches. Each switch can only be ON (1) or OFF (0). If you have 8 switches, you have 8 places to store information!

The place values in Binary are based on powers of 2. We typically use 8 switches, which means we work with 8-bit binary numbers.

Key Takeaway: Denary uses powers of 10. Binary uses powers of 2 (just 0s and 1s).

2. Converting Between Binary and Denary

The Binary Place Value Table (The Magic Numbers)

This table is your most important tool. You must memorize these numbers! They are the powers of 2, starting from \(2^0\) on the right, and doubling as you move left.

8-Bit Binary Place Values

\(\begin{array}{|c|c|c|c|c|c|c|c|} \hline 2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0 \\ \hline \mathbf{128} & \mathbf{64} & \mathbf{32} & \mathbf{16} & \mathbf{8} & \mathbf{4} & \mathbf{2} & \mathbf{1} \\ \hline \end{array}\)

Step-by-Step 2.1: Converting Binary to Denary (Base 2 to Base 10)

This is the easier conversion. You simply add up the place values where a 1 appears.

Example: Convert the binary number 10110010 to Denary.

Step 1: Draw your table and write the binary number underneath.

\(\begin{array}{|c|c|c|c|c|c|c|c|} \hline 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\ \hline \mathbf{1} & \mathbf{0} & \mathbf{1} & \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} \\ \hline \end{array}\)

Step 2: Circle the place values where the digit is 1.

The ones are under: 128, 32, 16, and 2.

Step 3: Add the circled values together.

\(128 + 32 + 16 + 2 = 178\)

Answer: The binary number 10110010 is 178 in Denary.

Memory Aid: If you see a 0, ignore the number above it! Only 1s count!

Step-by-Step 2.2: Converting Denary to Binary (Base 10 to Base 2)

For this method, we use the subtraction technique. We try to fit the largest possible place value into the Denary number.

Example: Convert the Denary number 155 to Binary.

Step 1: Draw your blank 8-bit table.

\(\begin{array}{|c|c|c|c|c|c|c|c|} \hline 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\ \hline & & & & & & & \\ \hline \end{array}\)

Step 2: Start from the left (128) and ask: Can 128 fit into 155?

  • Yes. Put a 1 in the 128 column.
  • Subtract: \(155 - 128 = 27\). (27 is your new target number).

Step 3: Move to the next column (64). Can 64 fit into the remaining 27?

  • No. Put a 0 in the 64 column.
  • Remaining target is still 27.

Step 4: Continue checking the remaining columns (32, 16, 8, 4, 2, 1) against the remainder.

  • 32 into 27? No (0). Target remains 27.
  • 16 into 27? Yes (1). Subtract: \(27 - 16 = 11\). New target is 11.
  • 8 into 11? Yes (1). Subtract: \(11 - 8 = 3\). New target is 3.
  • 4 into 3? No (0). Target remains 3.
  • 2 into 3? Yes (1). Subtract: \(3 - 2 = 1\). New target is 1.
  • 1 into 1? Yes (1). Subtract: \(1 - 1 = 0\). Final target is 0.

Step 5: Write out the final binary result (reading the bottom row from left to right).

\(\begin{array}{|c|c|c|c|c|c|c|c|} \hline 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\ \hline \mathbf{1} & \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{1} & \mathbf{0} & \mathbf{1} & \mathbf{1} \\ \hline \end{array}\)

Answer: The Denary number 155 is 10011011 in Binary.

Common Mistake to Avoid: Always remember to include the zeros (the placeholders)! If you miss a placeholder (like the 0s in the 64 and 32 columns above), your number will be completely wrong. An 8-bit number must always have 8 digits!

Key Takeaway: Binary conversion relies entirely on the place value table (128, 64, 32, 16, 8, 4, 2, 1). Practice makes perfect!

3. Measuring Digital Data

Since computers deal with massive amounts of 0s and 1s, we need standard units to measure digital storage capacity, like measuring liquids in litres or weight in kilograms.

3.1. The Smallest Units

Bit (b)

The Bit is the smallest unit of data. It stands for Binary Digit.

  • A bit can only hold one value: 0 or 1.
  • It’s usually not enough information to represent anything meaningful on its own.
Nibble (sometimes called Half-Byte)

A Nibble is a grouping of 4 bits.

  • \(1 \text{ Nibble} = 4 \text{ bits}\).
Byte (B)

The Byte is the fundamental unit of storage, essential for representing characters (like the letter 'A' or the number '7').

  • A Byte is 8 bits.
  • A single character of text usually takes up 1 Byte of memory (e.g., in ASCII encoding).

Did you know? Using 8 bits (1 Byte), we can represent \(2^8 = 256\) unique numbers or characters (from 0 to 255).

3.2. Larger Units and the Power of 1024

In the Denary world, "Kilo" means 1,000 (e.g., 1 kilometre = 1,000 metres). However, because computers use the Base 2 system, their measurements are based on powers of 2. The closest power of 2 to 1,000 is 1,024 (\(2^{10}\)).

Therefore, all subsequent units increase by a factor of 1,024, not 1,000.

Units of Data Measurement

Unit Abbreviation Relationship (Approximate) Relationship (Exact)
Bit b N/A Binary digit (0 or 1)
Byte B N/A 8 bits
Kilobyte KB Approx. 1 thousand bytes \(1,024\) Bytes
Megabyte MB Approx. 1 million bytes \(1,024\) KBs
Gigabyte GB Approx. 1 billion bytes \(1,024\) MBs
Terabyte TB Approx. 1 trillion bytes \(1,024\) GBs

Example use: A typical MP3 song might be 4 Megabytes (4 MB). A large hard drive might have 1 Terabyte (1 TB) of storage.

Crucial Distinction: Make sure you know the difference between the lower case 'b' (bit) and the upper case 'B' (Byte) when describing speed (e.g., Megabits per second, Mb/s) versus storage (e.g., Megabytes, MB).

Key Takeaway: 8 bits make 1 Byte. All larger units (KB, MB, GB, TB) are built by multiplying the previous unit by 1,024.

Final Review: Binary Basics

Congratulations! You have mastered the basics of how computers store and interpret numerical data. This foundational knowledge is essential for understanding more complex data representation later on.

Quick Check Box

  • Denary is Base 10 (digits 0-9).
  • Binary is Base 2 (digits 0 and 1).
  • The key to conversion is the 8-bit place value table: 128, 64, 32, 16, 8, 4, 2, 1.
  • Bit (b) is the smallest unit.
  • Byte (B) is 8 bits.
  • Storage units are based on 1,024 (not 1,000).

You've done the hard work, keep practicing those conversions, and you'll find binary becomes second nature!