Binary

Also known as: base 2, binary numbers

definition

Binary is a base-2 number system that uses only two digits, 0 and 1, to represent all values. Binary is the fundamental language of all digital computers.

๐Ÿ’ก Intuition

Counting with only two states: on/off, yes/no, 0/1. Each extra digit doubles the count.

Core Idea

Computers use binary because electronic switches have exactly two states: on (1) or off (0).

Formal View

A binary number b_n b_{n-1} \ldots b_1 b_0 represents the decimal value \sum_{i=0}^{n} b_i \cdot 2^i, where each b_i \in \{0, 1\}.

๐Ÿ”ฌ Example

\text{Binary } 101 = 4 + 0 + 1 = 5 \text{ in decimal} \text{Binary } 1111 = 8 + 4 + 2 + 1 = 15

๐ŸŽฏ Why It Matters

Binary is the fundamental language of all digital computers. Every file, image, video, and program is ultimately stored as sequences of 0s and 1s. Understanding binary is essential for grasping how computers store numbers, perform arithmetic, and encode information.

โš ๏ธ Common Confusion

Each position is a power of 2 (1, 2, 4, 8 ...). Reading right-to-left: position 0 = 1, position 1 = 2, etc.

๐Ÿ’ญ Hint When Stuck

When converting binary to decimal, write the powers of 2 above each digit from right to left (1, 2, 4, 8, 16, \ldots). Then multiply each binary digit by its power and add the results. To convert decimal to binary, repeatedly divide by 2 and record the remainders from bottom to top.

Related Concepts

How Binary Connects to Other Ideas

Once you have a solid grasp of binary, you can move on to bits bytes and data representation.

Go Deeper

Frequently Asked Questions

What is Binary in CS Thinking?

Binary is a base-2 number system that uses only two digits, 0 and 1, to represent all values. Each digit position represents a power of 2, and computers use binary because electronic circuits have exactly two states: on and off.

Why is Binary important?

Binary is the fundamental language of all digital computers. Every file, image, video, and program is ultimately stored as sequences of 0s and 1s. Understanding binary is essential for grasping how computers store numbers, perform arithmetic, and encode information.

What do students usually get wrong about Binary?

Each position is a power of 2 (1, 2, 4, 8 ...). Reading right-to-left: position 0 = 1, position 1 = 2, etc.

๐Ÿ’ป Animated Visualization Animated

Watch decimal numbers convert to binary (0s and 1s)