Binary Formula

Binary is a base-2 number system that uses only two digits, 0 and 1, to represent all values.

The Formula

value=i=0nbi2i\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

Binary 101=4+0+1=5 in decimal\text{Binary } 101 = 4 + 0 + 1 = 5 \text{ in decimal} Binary 1111=8+4+2+1=15\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=100b1010 = 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 bnbn1b1b0b_n b_{n-1} \ldots b_1 b_0 represents the decimal value i=0nbi2i\sum_{i=0}^{n} b_i \cdot 2^i, where each bi{0,1}b_i \in \{0, 1\}.

Worked Examples

Example 1

medium
Convert the decimal number 45 to binary.

Answer

1011012101101_2

First step

1
Step 1: 45 ÷ 2 = 22 remainder 1.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Unlock answer keys One Family plan — every worked solution, all subjects

Example 2

medium
Convert binary 11010211010_2 to decimal.

Example 3

medium
Convert 111121111_2 to decimal and explain why it equals 2412^4 - 1.

Common Mistakes

  • Reading binary digits left-to-right instead of right-to-left when assigning powers of 2 - Fix this by naming the input, process, output, evidence, and checking "Am I explaining how data is encoded, organized, transformed, or interpreted rather than only naming the information?" before using the concept.
  • Forgetting that position 0 (rightmost) has value 20=12^0 = 1, not 21=22^1 = 2 - Fix this by naming the input, process, output, evidence, and checking "Am I explaining how data is encoded, organized, transformed, or interpreted rather than only naming the information?" before using the concept.
  • Confusing binary arithmetic carries (1 + 1 = 10 in binary, not 2) - Fix this by naming the input, process, output, evidence, and checking "Am I explaining how data is encoded, organized, transformed, or interpreted rather than only naming the information?" before using the concept.
  • Using binary from a keyword alone - Signal words like data, binary, bits only point to a possible model; the computing structure must match too.

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=100b1010 = 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.