Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy Computer Basics Computer Basics Binary

I dont get this part: what number is represented by the byte 00000111? I thought it's 100 is 3, 10 is 2.. and so on

help

2 Answers

Hi Wandong,

Here's one way that you can do this.

Going from right to left, you can write out increasing powers of 2 above your binary digits.

Example;

128 64 32 16 8 4 2 1
--------------------
  0  0  0  0 0 1 1 1

Then, anywhere you have a 1 in the binary number, you'll add the corresponding power of 2 that's above it.

In this case, the 3 rightmost digits are 1. So you would want to add up the 3 powers of 2 that appear above them.

Check this post and this post. They both explain binary to digits more thoroughly.

Pleeeaaaase check those posts and don't ignore them! They will really help you understand.

If you don't know what a exponent is in math you can check this out:

3 to the second power (or, the base 3 with an exponent of 2) equals 3 times 3.
The two represents how many times to multiply 3 by itself.

4 to the fifth power equals: 4 times 4 times 4 times 4 times 4 (4 times itself 5 times)

It explains that the further the 1 is to the right, you don't increase the number by one, you make the exponent bigger. The base on the other hand is always two. In digits, we have a base of 10, which means every time there's another digit to the left, we increase the exponent by one where the base is always 10.

Example:

00001  =>  1  # because 2 to the zeroth power is 1 (anything to the zeroth power is 1)
00010  =>  2  # because 2 to the first power is 2 (2 = 2)
00100  =>  4  # because 2 to the second power is 4 (2 * 2 = 4)
01000  =>  8  # because 2 to the third power is 8 (2 * 2 * 2 = 8)

00011  => 3  # because 2 to the zeroth power PLUS 2 to the first power is 3 (1 + 2 = 3)
00101  => 5  # because 2 to the zeroth power PLUS 2 to the second power is 5 (1 + (2 * 2) = 5)
00111  => 7  # because 2 to the zeroth power PLUS 2 to the first power PLUS 2 to the second power is 7 (1 + 2 + (2*2) = 7)

# And so on... Just keep in mind that the base is always two (that's why it's "2 to the first", "2 to the fourth", "2 to the fifth", etc.    

I hope this helps. ~Alex

If this helped, please mark it as a Best Answer. Thank you for understanding!