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 trialEdward McEntire
8,667 PointsI don't understand the math of binary code.
I do not understand how the addition worked.
1 Answer
james south
Front End Web Development Techdegree Graduate 33,271 Pointsbinary, or base 2, works just like base 10, the 'normal' counting system. each position in a number starting from the right and going left is an integer exponent of the base, starting with 0, so 2^0, or 10^0. anything to the 0 power is 1, and a 1 in that position means there is 1 base^0 in the number. 0 would mean 0. when the number in a given position goes beyond the base-1, so 1 in binary, or 9 in base 10, you add a position to the left. so in base 10, the highest we go in the 1s (or 10^0) position, is 9 (10-1), and in base 2, it would be 1 (2-1). the position we add to the left of base^0 is base^1. in base 10 that's the tens position, because 10^1=10. in binary, it's the 2s (2^1=2). any number is expressed like this and is made up of however many are in its left-most position, plus however many in the next to the right, etc. so 123 in base 10 is 1 10^2 (100) plus 2 10^1 (20) plus 3 10^0 (3)==100+20+3==123. in base 2 it would be 1 2^6 (64) plus 1 2^5 (32) plus 1 2^4 (16) plus 1 2^3 (8) plus 0 2^2 (0) plus 1 2^1 (2) plus 1 2^0 (1) == 1111011.