We use "base 10" or "decimal" numbers. What does that mean?
What digits do we have for numbers? We have 0,1,2,...,9.
If we limit ourselves to 1 digit, how many numbers can we represent? We can represent 10 different numbers: (0,1,...,9).
How about this number: 12? What does it mean when we have two columns? It means the number is greater than 9, so we have to use 2 digits.
12 = 10 + 2 (the 1 in 12 actually means 10 when we put it in the 2nd col)
Remember the values of the columns: from the right we have the ones col, the tens col, the hundreds col, the thousands col, etc. Notice that the value of each col is 10 times the value of the previous col. So what does that tell us about the number 126?
126 = 100 + 20 + 6 = 1 * 100 + 2 * 10 + 6 * 1 = 1 * 102 + 2 * 101 + 6 * 100
Remember, anything raised to the 0 power is 1.
We can count differently -- the numbers we use are only symbols. We can use different symbols to represent quantities. For example, we could use a different symbol to represent the quantity we represent with the symbol 8.
Suppose we only have digits 0, 1, 2, 3 - forget about 5, 6, 7, 8, 9.
Now when we count, we count 0, 1, 2, 3. When we want to count one number higher, we can't use 4. So we have to reset the first column to 0 and carry a 1 to the second column. This means that we count like:
New Way to Count | Old Way to Count (base 10) |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
10 | 4 |
11 | 5 |
12 | 6 |
13 | 7 |
20 | 8 |
21 | 9 |
22 | 10 |
23 | 11 |
30 | 12 |
31 | 13 |
32 | 14 |
33 | 15 |
100 | 16 |
Actually, this is base 4, we have 4 digits (0, 1, 2, 3), and the value of each col is 4 times the value of the previous col. You can see this because each time we need to put a 4 in a col, instead we put a 1 in the next col. So if the first (rightmost) col has value 1, then a 1 in the second column represents the value 4, because it's the same as putting a 4 in the first col, which has the value 4. And if the second col has value 4, then a 1 in the third col represents the value 16, because it's the same as putting a 4 in the second col, which has the value 16 (4 in the col * the col value of 4). So our col values are
----- ----- ----- ----- ----- ----- 1024 256 64 16 4 1 45 44 43 42 41 40
So for example, if we take the number 33 in base 4, its value in base 10 is
334 = 3 * 41 + 3 * 40 = (3 * 4 + 3)10 = 1510
How about 1004?
1004 = 1 * 42 + 0 * 41 + 0 * 40 = (1 * 16 + 0 * 4 + 0 * 1)10 = 1610
Try another: 234
Computer memory is made up of switches -- first they were vacuum tubes (like lightbulbs in a way), then transistors. Now millions of transistors are packed onto integrated circuits (chips).
Since a switch can be either on or off, we let the on and off represent 0 and 1, so when you hear that everything inside a computer is 0's and 1's, that is true.
We call each switch a bit, which stands for binary digit.
Since we only have 0's and 1's, we use base 2 or binary to represent numbers, since base 2 only uses 2 digits: 0 and 1. It looks very strange. Now when we count, we count 0, 1. When we want to count one number higher, we can't use 2. So we have to reset the first column to 0 and carry a 1 to the second column. This means that we count like:
base 2 | base 10 |
---|---|
0 | 0 |
1 | 1 |
10 | 2 |
11 | 3 |
100 | 4 |
101 | 5 |
110 | 6 |
111 | 7 |
1000 | 8 |
1001 | 9 |
1010 | 10 |
1011 | 11 |
1100 | 12 |
1101 | 13 |
1110 | 14 |
1111 | 15 |
10000 | 16 |
In base 2 the value of each col is 2 times the value of the previous col. You can see this because each time we need to put a 2 in a col, instead we put a 1 in the next col. So if the first (rightmost) col has value 1, then a 1 in the second column represents the value 2, because it's the same as putting a 2 in the first col, which has the value 2. And if the second col has value 2, then a 1 in the third col represents the value 4, because it's the same as putting a 2 in the second col, which has the value 4 (2 in the col * the col value of 2). So our col values are
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 512 256 128 64 32 16 8 4 2 1 29 28 27 26 25 24 23 22 21 20
So for example, if we take the number 101 in base 2, it represents the value
1012 = (1 * 22 + 0 * 21 + 1 * 20)10 = (1 * 4 + 0 * 2 + 1 * 1)10 = (4 + 1)10 = 510
How about 10112?
10112 = (1 * 23 + 0 * 22 + 1 * 21 + 1 * 20)10 = (1 * 8 + 0 * 4 + 1 * 2 + 1 * 1)10 = (8 + 2 + 1)10 = 1110
let's do 1 digit numbers
0 1 0 1 + 0 + 0 + 1 + 1 --- --- --- --- 0 1 1 10
we can expand this to numbers of more than one digit -- we may have to carry a 1 to the next column (if the sum is 10)
10 11 101 10011 11 + 1 + 1 + 10 + 101 + 11 --- --- ---- ------ ---- 11 100 111 11000 110
notice that sometimes we end up with 1 + 1 + 1, which gives us 1 plus 1 to carry
11 10111 1110101 + 11 + 111 + 1010001 --- ------ --------- 110 11110 11000110
in decimal (base 10), value of each col is a power of 10, starting from the col value 1 in the rightmost col, each col is worth twice the prev col, so our col values are
----- ----- ----- ----- ----- ----- 100000 10000 1000 100 10 1
so when we look at a decimal (base 10) number like 5872, we know it means
5 8 7 2 ----- ----- ----- ----- ----- ----- 100000 10000 1000 100 10 1 5 * 1000 + 8 * 100 + 7 * 10 + 2 * 1
remember, in binary, value of each col is a power of 2
starting from the col value 1 in the rightmost col, each col is worth twice the prev col, so our col values are
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 512 256 128 64 32 16 8 4 2 1
using the same idea as in decimal, we can get the base 10 value of the num by multiplying each digit by its col value, so when we look at a binary number like 10011, we can see that it means
1 0 0 1 1 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 512 256 128 64 32 16 8 4 2 1 (1 * 16) + (0 * 8) + (0 * 4) + (1 * 2) + (1 * 1) = (1 * 16) + (1 * 2) + (1 * 1) = 16 + 2 + 1 = 19
notice that we can leave out the cols where the 0's appear, and just add up the values of the cols where the 1's appear
another example, let's get the base 10 value of the binary number 1011010
1 0 1 1 0 1 0 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 512 256 128 64 32 16 8 4 2 1 (1 * 64) + (0 * 32) + (1 * 16) + (1 * 8) + (0 * 4) + (1 * 2) + (0 * 1) = (1 * 64) + (1 * 16) + (1 * 8) + (1 * 2) = 64 + 16 + 8 + 2 = 90
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2007