1. System Fundamentals

Binary And Decimal Conversion

Binary and Decimal Conversion

Welcome, students! In this lesson, you will learn how computers store numbers using binary and how to convert between binary and decimal. This is a key idea in IB Computer Science HL because almost everything a computer does starts with data represented in bits. By the end of this lesson, you should be able to explain the meaning of binary, convert numbers both ways, and connect these skills to memory, storage, and computer performance πŸ’»

Learning objectives:

  • Explain the main ideas and terminology behind binary and decimal conversion.
  • Apply IB Computer Science HL methods for converting between binary and decimal.
  • Connect binary and decimal conversion to system fundamentals.
  • Summarize why binary matters in computer architecture and data representation.
  • Use examples to show how conversion works in real situations.

Why computers use binary

Computers use binary because digital circuits are built from components that have two stable states, such as on and off, high voltage and low voltage, or true and false. These two states match the digits $0$ and $1$. Each binary digit is called a bit. A group of $8$ bits is called a byte.

For example, the binary number $10110010$ is an $8$-bit pattern. It can represent a number, a letter, or a pixel color depending on the context. This is an important idea in system fundamentals: the same bits can be interpreted in different ways.

Binary is not just a math trick. It is the foundation of data representation. When you type a number, save a file, or watch a video, the computer stores information as patterns of bits. Understanding binary helps you understand memory size, file size, and why computers can process information reliably βš™οΈ

Decimal and positional notation

You already use the decimal system every day. Decimal is a base-$10$ system, which means it uses digits $0$ through $9$. Each position in a decimal number has a value based on powers of $10$.

For example, the number $347$ means:

$$3 \times 10^2 + 4 \times 10^1 + 7 \times 10^0$$

This gives:

$$300 + 40 + 7 = 347$$

Binary works the same way, but it is base-$2$. It uses only the digits $0$ and $1$. Each position has a value based on powers of $2$.

So the binary number $1011$ means:

$$1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0$$

which equals:

$$8 + 0 + 2 + 1 = 11$$

This positional system is the key idea behind all binary conversion methods.

Converting binary to decimal

To convert binary to decimal, multiply each bit by the place value of its position and add the results. Start from the right with $2^0$, then $2^1$, $2^2$, and so on.

Take the binary number $110101$.

Write the powers of $2$ under each digit:

$$\begin{array}{cccccc}

1 & 1 & 0 & 1 & 0 & 1 \\

2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0

$\end{array}$$$

Now calculate:

$$1 \times 2^5 + 1 \times 2^4 + 0 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0$$

$$= 32 + 16 + 0 + 4 + 0 + 1 = 53$$

So $110101_2 = 53_{10}$.

A useful exam habit is to show each step clearly. IB questions often award method marks, so writing the place values and sums can help you earn credit even if you make a small arithmetic mistake.

Quick example

Convert $10010_2$ to decimal.

$$1 \times 2^4 + 0 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 0 \times 2^0$$

$$= 16 + 2 = 18$$

So $10010_2 = 18_{10}$.

Converting decimal to binary

To convert decimal to binary, the most common school method is repeated division by $2$. Keep dividing the number by $2$ and record the remainders. The binary answer is read from the last remainder upward.

Let’s convert $19_{10}$ to binary.

  1. $19 \div 2 = 9$ remainder $1$
  2. $9 \div 2 = 4$ remainder $1$
  3. $4 \div 2 = 2$ remainder $0$
  4. $2 \div 2 = 1$ remainder $0$
  5. $1 \div 2 = 0$ remainder $1$

Read the remainders from bottom to top: $10011_2$.

So $19_{10} = 10011_2$.

Why the remainder method works

Each remainder tells you whether a power of $2$ is included. If a division by $2$ leaves remainder $1$, that place value is used. If the remainder is $0$, it is not used. This matches the idea that binary only has two choices for each position: include it or not include it.

Another example

Convert $26_{10}$ to binary.

  • $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$

Read upward: $11010_2$.

So $26_{10} = 11010_2$.

Powers of two and place value patterns

A strong way to become fluent in binary is to memorize common powers of $2$:

$$2^0 = 1, \quad 2^1 = 2, \quad 2^2 = 4, \quad 2^3 = 8, \quad 2^4 = 16, \quad 2^5 = 32, \quad 2^6 = 64, \quad 2^7 = 128$$

These values appear often in system fundamentals because they connect to storage sizes and addressing. For example:

  • $8$ bits make $1$ byte
  • $1024$ bytes make $1$ kilobyte in many computer contexts
  • memory sizes often grow in powers of $2$

Binary place values help explain why computer memory is often organized in chunks that are powers of $2$. This is a direct connection to system architecture and performance.

If you know these values, you can estimate quickly. For instance, the binary number $10000000_2$ equals $128_{10}$ because only the $2^7$ place is set.

Common mistakes and how to avoid them

A frequent error is reading binary from left to right like decimal. In binary, the rightmost bit is the least significant bit, and the leftmost bit is the most significant bit.

Another mistake is forgetting a place value when there is a $0$. A $0$ still matters because it shows that the place value is skipped. For example, in $1010_2$:

$$1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 = 8 + 2 = 10$$

A third mistake is mixing up the base. Writing $1011$ without a base can be confusing. In computer science, it is good practice to use subscripts when needed, such as $1011_2$ and $11_{10}$.

Here is a quick check strategy:

  • Count the number of bits.
  • Match them with powers of $2$.
  • Add only the positions with $1$.
  • Verify your answer by converting back if needed βœ…

Real-world connections in system fundamentals

Binary conversion is not only about numbers on paper. It helps explain several parts of system fundamentals.

  1. Data representation

A character such as a letter or symbol is stored as a binary code. For example, text files use coding systems like ASCII or Unicode, which map characters to binary patterns.

  1. Memory and storage

Computer memory is measured in bytes and larger units. Since bytes are made of $8$ bits, binary helps explain storage capacity and why file sizes are often described with powers of $2$.

  1. Networking and communication

Data sent across networks is transmitted as binary signals. Even if users see pictures, messages, or videos, the device still handles bit patterns underneath.

  1. Performance and efficiency

A CPU processes binary instructions. Understanding binary helps explain why some tasks require more bits, more memory, or more processing steps.

These links show that binary conversion is not an isolated math skill. It is part of how computer systems operate as a whole.

Conclusion

Binary and decimal conversion is a core skill in IB Computer Science HL because it builds the bridge between human-friendly numbers and machine-readable data. Decimal uses base $10$ and binary uses base $2$, but both rely on positional notation. You should now be able to convert binary to decimal by adding powers of $2$, and decimal to binary by repeated division by $2$. More importantly, you should understand why binary matters for data representation, memory, storage, and system operation. Mastering this topic gives you a strong foundation for later work in computer architecture, performance, and the broader study of system fundamentals πŸš€

Study Notes

  • Binary is a base-$2$ number system that uses the digits $0$ and $1$.
  • Decimal is a base-$10$ number system that uses the digits $0$ through $9$.
  • A bit is one binary digit; a byte is $8$ bits.
  • To convert binary to decimal, add each bit times its power of $2$.
  • To convert decimal to binary, divide by $2$ repeatedly and read remainders upward.
  • The rightmost binary digit has place value $2^0$.
  • Common powers of $2$ include $2^0 = 1$, $2^1 = 2$, $2^2 = 4$, $2^3 = 8$, $2^4 = 16$, and $2^5 = 32$.
  • Binary supports data representation, memory organization, file sizes, and CPU operation.
  • In IB Computer Science HL, binary conversion is a foundational skill for understanding system fundamentals.

Practice Quiz

5 questions to test your understanding

Binary And Decimal Conversion β€” IB Computer Science HL | A-Warded