Unit 1: Digital information · Binary numbers

Article

Patterns in binary numbers

5 min read

Binary numbers are not random. A few patterns let you answer many questions without doing any long sums. Learn these three and you will be quicker and make fewer mistakes.

The last bit tells you odd or even

Look at the first nine numbers in binary:

DecimalBinaryLast bit
000000
100011
200100
300111
401000
501011
601100
701111
810000

The last bit goes 0, 1, 0, 1, and so on. Why? Every place value except the 1s place (2, 4, 8, 16, …) is even. So only the 1s place can make a number odd. If the last bit is 1, the number is odd. If it is 0, the number is even.

Adding a zero on the right doubles the number

Compare these numbers:

BinaryDecimal
1015
101010
1010020

Every time we add a 0 on the right, every digit moves one place to the left. Each place is worth twice as much as the one before, so the whole number doubles. In decimal, adding a 0 on the right multiplies by 10. In binary, it multiplies by 2.

Adding a 0 on the left is different. The number 0101 is still 5, because a leading zero adds nothing.

Check your understanding

What happens to the value of a binary number when you add a 0 on its right end?

All ones: the biggest number

What is the biggest number that fits in a given number of bits? Fill every place with a 1:

BitsBiggest patternValue
111
2113
31117
4111115

Each biggest value is one less than the number of values that the bits can make. That is because counting starts at 0. With n bits you can make 2^n different values, and they run from 0 up to 2^n - 1.

Check your understanding

What is the biggest number that can be stored in 5 bits?

The three patterns together

Patterns in binary
  • The last bit

    • ends in 1 means odd
    • ends in 0 means even
  • A 0 on the right

    • every digit moves one place left
    • the number doubles
  • All ones

    • n bits make 2^n values
    • the biggest is 2^n - 1
    • one byte tops out at 255
Use these to check an answer quickly before you move on.

Worked example: one byte

A byte has 8 bits, so it can make 256 different values. They start at 0, so the biggest is 256 − 1 = 255. Check by adding all eight place values:

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

So 11111111 is 255, and no byte can hold a number bigger than that.

Common mistakes

  • Saying the biggest value is 2^n. That is how many values there are. The biggest value is one less.
  • Multiplying by 10. In binary, adding a 0 on the right multiplies by 2.
  • Looking at the wrong end for odd or even. The last bit (the rightmost one) decides, not the first.
  • Thinking all zeros means "no number". 0000 is the number 0, and it is one of the values.

On the exam

Patterns help you check an answer quickly. If a binary number ends in 1 and your decimal answer is even, you made a mistake. Also remember that a byte holds 0 to 255, not 1 to 256.

Key words

Leading zero: a 0 added at the left end. It does not change the value.

Odd and even: a binary number is odd when its last bit is 1.

Largest value: with n bits, 2^n - 1.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site. All lessons and questions here are written by JrCodex.