Binary Formula

The Formula

\text{value} = \sum_{i=0}^{n} b_i \cdot 2^i

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

Quick Example

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

Notation

Binary numbers are written as sequences of 0s and 1s, often prefixed with '0b' (e.g., 0b1010 = 10). Each digit is called a bit, and positions are numbered from right to left starting at 0.

What This Formula Means

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.

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

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\}.

Worked Examples

Example 1

medium
Convert the decimal number 45 to binary.

Solution

  1. 1
    Step 1: 45 รท 2 = 22 remainder 1.
  2. 2
    Step 2: 22 รท 2 = 11 r0. 11 รท 2 = 5 r1. 5 รท 2 = 2 r1. 2 รท 2 = 1 r0. 1 รท 2 = 0 r1.
  3. 3
    Step 3: Read remainders bottom to top: 101101.

Answer

101101_2
Binary (base 2) uses only digits 0 and 1. Repeatedly dividing by 2 and collecting remainders converts decimal to binary. Computers use binary because electronic circuits have two states: on and off.

Example 2

medium
Convert binary 11010_2 to decimal.

Common Mistakes

  • Reading binary digits left-to-right instead of right-to-left when assigning powers of 2
  • Forgetting that position 0 (rightmost) has value 2^0 = 1, not 2^1 = 2
  • Confusing binary arithmetic carries (1 + 1 = 10 in binary, not 2)

Common Mistakes Guide

If this formula feels simple in isolation but keeps breaking during real problems, review the most common errors before you practice again.

Why This Formula 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.

Frequently Asked Questions

What is the Binary formula?

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.

How do you use the Binary formula?

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

What do the symbols mean in the Binary formula?

Binary numbers are written as sequences of 0s and 1s, often prefixed with '0b' (e.g., 0b1010 = 10). Each digit is called a bit, and positions are numbered from right to left starting at 0.

Why is the Binary formula important in CS Thinking?

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 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.