Binary Formula
Binary is a base-2 number system that uses only two digits, 0 and 1, to represent all values.
The Formula
Ask yourself: Are you turning a string of 0s and 1s into an ordinary number, or a number into 0s and 1s?
Quick example
Notation
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.
Picture a balance with one weight each of 1, 2, 4, 8 and 16 grams. Each weight is either on the pan (1) or off it (0), and every whole number of grams from 0 to 31 can be made in exactly one way, just as every number has exactly one binary form. The picture stops at addition: binary sums need the carry rule.
Formal view
Worked examples
Example 1
mediumShow solution
Answer
First step
See the full worked solution + why-it-works coaching
SetupKey insightWhy it worksCommon pitfallConnection
Example 2
mediumExample 3
mediumCommon mistakes
- Reading binary digits left-to-right instead of right-to-left when assigning powers of 2
- Forgetting that position 0 (rightmost) has value , not
- Confusing binary arithmetic carries (1 + 1 = 10 in binary, not 2)
Common mistakes guide
If this formula keeps breaking in real problems, read the most common errors before you practice again.
Why this formula matters
Every number, letter and color in a computer is stored as a pattern of 0s and 1s, because a circuit only has to tell on from off. Reading binary shows you why 8 bits stop at 255, why sizes like 256, 512 and 1024 keep turning up, and why adding 1 to 1111 rolls over to 10000. Reading the place values from the wrong end gives a completely different number.
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?
Use binary when a number is written with only 0 and 1 and the context says it is base 2: a 0b prefix, the word binary, or a value inside a computer's memory. You also use it in reverse, when asked how a computer would store a decimal number. If the question is how many values or how much space a group of bits gives, that is Bits and Bytes. If it asks what a pattern of bits stands for (a letter, a color), that is Data Representation.
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., ). 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?
Every number, letter and color in a computer is stored as a pattern of 0s and 1s, because a circuit only has to tell on from off. Reading binary shows you why 8 bits stop at 255, why sizes like 256, 512 and 1024 keep turning up, and why adding 1 to 1111 rolls over to 10000. Reading the place values from the wrong end gives a completely different number.
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.