Main content

## Computers and the Internet

# Patterns in binary numbers

Explore patterns in binary numbers, and learn to recognize odd and even numbers or to intuit the largest value that can be represented by a certain number of bits. Odd binary numbers always end in 1, and binary numbers with all 1 digits represent a power of 2 minus 1. Created by Pamela Fox.

## Want to join the conversation?

- Why we write 0 in front of the numbers just like

Binary of 3- 0011.(5 votes)- Lots of people type binary in groups of 4/8 with smaller numbers.(12 votes)

- Can you make orange juice with a tangerine(7 votes)
- this was 5 mins and it felt like hrs(6 votes)
- How will this affect LeBron's legacy?(4 votes)
- octopi, octo-why(4 votes)
- what is the meaning of this binary text?

01001011 01101001 01110011 01101000 01101111 01110010 01100101(3 votes)- The quick brown 🦊 jumps over 13 lazy 🐶.(1 vote)

- Can some one explain this question to me. I am confused about the equation for solving it.

A bunch of computer scientists take over an island and start their own country. They want the license plates to use binary numbers. There's space for 7 digits on each license plate and the first plate starts at \[0000000\].

How many unique license plates can their country support?(2 votes)- 7 spots, each with 2 possible answers. 7 to the second power is 49. This is how I solve these problems. I may be wrong, but I think 49 in correct. If anybody else has a different answer, I'll listen.(2 votes)

- hm whgats the one(2 votes)
- Why do you write 0 in front of the numbers?!?!(1 vote)
- binary numbers use positional notation just like decimal numbers so the number does not have to start with 0. The numbers you have seen have probably shown a fixed number of significant digits with leading zeroes to fill out the significant digits.(3 votes)

- Why do they write 1,2,4,8,12 and not 1,2,3,4,5?

I am sorry js confused.(1 vote)- In the decimal number system, each place represents a power of 10 (starting from the rightmost digit). For example, the number 514 is:

4 (the rightmost digit) * 10^0 = 4 * 1 = 4

+ 1 * 10^1 = 10

+ 5 * 10^2 = 500

--------------------------------------------------

514

The binary number system follows a similar structure, but each place represents a power of 2. Using the same example, 514 in the binary number system is 1000000010. In a similar fashion, we start from the rightmost digit and multiply by incremental powers of 2.

0 (the rightmost digit) * 2^0 = 0 * 1 = 0

+ 1 * 2^1 = 2

+ 0 * 2^2 = 0

+ 0 * 2^3 = 0

+ 0 * 2^4 = 0

+ 0 * 2^5 = 0

+ 0 * 2^6 = 0

+ 0 * 2^7 = 0

+ 0 * 2^8 = 0

+ 1 * 2^9 = 512

--------------------------------------------------

514 (in the decimal number system)

Since each place represents a power of 2 in the binary number system, the video uses 1, 2, 4, 8, ...etc. to show what we will multiply the binary digit by when converting to decimal.

You can reference the two earlier videos within this lesson ("Decimal system refresher" and "The binary number system") for additional clarity on these topics.(2 votes)

## Video transcript

- [Instructor] There's
some interesting patterns in binary numbers. And I find that by
understanding these patterns, I have better intuitive understanding for what binary number I'm looking at. So let's look at a few
patterns in this video. We'll start with odd numbers. The decimal number three is odd and in binary it's 0011. Then there's decimal five that's odd. And in binary that's 0101. Then seven, in binary that's 0111. Finally, nine, in binary is 1001. So do you noticed the pattern in these binary numbers here? I'll give you a hint if
you're not seeing it. (instructor humming) All of these binary numbers end in a one. In fact, the only way
to make an odd number in the binary number system is if it ends in a one. That's because the one is the ones place and every other place is a power of two. And odd number is a number
that if you'd divide it by two, gives a remainder of one. So that means that we
always have to have a one in that ones place to make an odd number. Now we should be able to
look at any binary number and say if it's odd or even. Let's try that out for
some very large numbers. Which one of these is odd? Well, let's just look at
the ones place and see. Zero, zero, one, zero. Okay, this one is the odd one out. These other ones, they're all even. So even though I have no
clue what these numbers are, I do know that this is the odd number. So now we have a little
more of an intuitive understanding of binary numbers, but let's keep exploring
and see what else there is. Another interesting pattern is when a binary number is all ones. So we can have one, we can have one, one we can have one, one, one, and we can have one, one, one, one. Lots of ones. So in decimal, this is the same as one for this first value. Three is one, one. Seven is one, one, one. And 15 is one, one, one, one. So what is special about
these decimal numbers here? one, three, seven, and 15? It's probably not obvious at first, but each of these are actually
a power of two minus one. So this one is the same as two minus one. Three is the same as four minus one. Seven is the same as eight minus one. And 15 is the same as 16 minus one. We can also write these in
terms of their powers of two's. So this is two to the one minus one. Two to the two minus one. Two to the three minus one. And two to the four minus one. So whenever a binary number has one in all of its places, then it will always equal to largest number that can be represented
by that number of bits. This is a lot like in the decimal system where there's nine, nine, nine, nine, nine, nine, and nine, nine, nine, nine. If we add one, we'd go over and this is a largest value that can be expressed in
that number of digits. That's what we're looking at here. We can also write the number of bits that we're dealing with here. So the number of bits, this is one bit, this is two bits, this is three bits, and this is four bits. So we can see that for four bits, the highest number that can be represented is two to the fourth minus one. For three, it's two to the
three minus one, et cetera. So that means if we know the
number of bits that we have, we know the highest value
that could be represented and we know that that high value will be a one in every place. So we can use that information to help us have a better understanding
of binary numbers. So consider this binary number; 11111. What is this equal in decimal? Well, it's got one, two,
three, four, five bits. So that means this must be
two to the fifth minus one. Two to the fifth is the
same as two times two times two times two times two, which is the same as 32, and then if we minus one, we get that this is 31. So without having to add these up, we find out what this is. Now we could have it
done it the old way too. So let's see what this is. The one place, two place, four place, eight place, 16 place. And we can say 16 plus eight is 24, plus four is 28, plus two is 30, plus one is 31. So either way we do it, we get the same value. This just gives us another
way of understanding binary numbers and having a
better intuition for them.