Binary numbers are in the base 2 system as mentioned previously. So what exactly does this mean and how does this relate to the 1's and 0's? base 2 uses two numbers, hense the 0 and 1. Why use these numbers? These numbers are used because 0 must be present in any base number to represent nothing. the 1 is used because 1 is a counting number and can go into any number. Lets go back to base 10. base 10 has a lot of place values, the ones, tens, hundreds, thousands, and so on. So as we count the numbers starting at zero they go, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. What happens as you go to ten? You go back to 0 in the ones column and then put a 1 in the tens column. This happens when you go from 99 to 100 as well. In the base 2 system it is the exact same thing that happens with the base 10 system except when you go from 0 to 1 you then go to 10. So what number is 10 in binary. Is it 10? it is actually 2. Just like in base 10 the base 2 system is exponential. The "ones column" in binary is 2^0, the next is 2^1, then 2^2 and so on. So to the previous example of 001001101 is equvalent to (0 * 2^8) + (0 * 2^7) + (1 * 2^6) + (0 * 2^5) + (0 * 2^4) + (1 * 2^3) + (1 * 2^2) + (0 * 2^1) + (1 * 2^0) = 0 + 0 + 64 + 0 + 0 + 8 + 4 + 0 + 1 = 77.
Binary Powers | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
Binary Values | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
What about base 8 or octal? How does 77 become 115? Similar to binary and base 10, octal is a set on numbers. Octal counts from 0-7. When we count and get to 7 we are at the end of the numbers available for us to use. so when we add 1 to 7 we get 10. In the "ones place" for octal is 8^0, the "ten place" is 8^1, and so on. This means it operates the same way as binary. Lets take 115 and figure out how that is 77 then. 115 base 8 = (1 * 8^2) + (1 * 8^1) + (5 * 8^0) = 64 + 8 + 5 = 77. This shows that you can convert any base 10 number into octal or binary or vice versa.
What if we want to get octal into binary? Do we have to convert a binary to base 10 and then to octal or octal to base 10 and then to binary? No we do not have to do this. Octal was created as a shortcut to get binary numbers faster. We know that 77 base 10 = 115 base 8 and 77 base 10 = 001001101 base 2 so does 001001101 base 2 = 115 base 8? Yes it does in fact by the transitive property. But to get from binary to octal or vice versa through base 10 is a long process. So octal is very easy to use with binary. Lets take the binary number 001001101 and break it up into groups of three. When broken up it looks like this 001 | 001 | 101. How does this help us? Octal looks like this when counting, 0, 1, 2, 3, 4, 5, 6, 7. Binary is like this to the same number of spots, 000,001,010,011,100,101,110,111. (For a side by side comparison look at the table at the bottom of the page) Lets take a look at 001 | 001 | 101. 001 = 1, 001 = 1, 101 = 5. So in octal, 001001101 = 115. This works the reverse way too. Lets take the number 324 in octal. 3 = 011, 2 = 010, 4 = 100. In binary 324 octal = 011010100.
Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Binary | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |