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 trial3 Answers
bothxp
16,510 PointsHi Sam,
I think of it like this:
Binary numbers are made up of 0s & 1s. From right to left the digit represent 1,2,4,8,16,32,64,128. If the bit is a 1 then you add the number that it represents.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
=========================
0 + 0 + 0 + 0 + 0 + 0 + 2 + 1
So 00000011 = 3
For another example:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
=========================
0 + 64 + 0 + 0 + 0 + 0 + 2 + 1
So 01000011 = 67
But where do the 1,2,4,8,16,32,64,128 numbers come from ?
If we start with our decimal system, then 235 can be split into Hundreds, Tens & Ones
| H | T | O |
| 2 | 3 | 5 |
= 235
Decimal works in base 10, so we can also write the above using 10^2 = 100, 10^1 = 10 & 10^0 = 1
| 10^2 | 10^1 | 10^0 |
| 2 | 3 | 5 |
= 235
The binary system operates in base 2, so we use:
2^7 = 2*2*2*2*2*2*2 = 128
2^6 = 2*2*2*2*2*2 = 64
2^5 = 2*2*2*2*2 = 32
2^4 = 2*2*2*2 = 16
2^3 = 2*2*2 = 8
2^2 = 2*2 = 4
2^1 = 2 = 2
2^0 = 1
| 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
tracy
32,769 PointsIn binary numbers, the first digit (from right to left) represents 1, the second represents 2, then 4, 8, etc. So 00000011 has a "1" in the 1 column and "1" in the "2" column. Since 1 + 2 = 3, the answer is 3.
Does that help?
Sam Katz
2,986 PointsI appreciated all the answers. Binary is very relevant to both subnetting and computers in general. (although subnetting is base-16.)
Melanie Day
5,540 PointsMelanie Day
5,540 PointsGreat explanation :)