Computers turn every number into a binary number. As humans, we count in base ten. Without knowing it, everyone using normal numbers is using base ten. But computers, they make all these numbers binary or base two. This is because computers are easier to design is they only have two values (one and zero) than if they have ten different values (zero, one, two, three, four, five, six, seven, eight, nine.)
As mentioned before, binary numbers only consist of the numbers one and zero. For example, a binary number could look like this: 0100. 0100 represents the number four. But first, let me explain how the binary counting system works. In binary, two ones equal a two, two twos equal a four, two fours equal an eight, and so on. The first place value where we put the “ones” is still the ones in binary. The tens in base ten is twos in binary. The hundreds in base ten is fours in binary. And so on. So four equals 0100 because in the number four, there is one four.
Computers can also do basic addition and subtraction using binary numbers. For example, if you wanted to do 5+4 in binary, the binary equation would be 0101+0100. If you don’t get how I did this, refer to the second paragraph. In the ones place, we have 1+0. Here, we store the bigger number which is one. Next, we look at the twos place. The twos place is 0+0. So here, we just keep the 0. Now, we look at the fours place. There, it is 1+1. We have to keep a zero and then carry a one. Finally, in the eights place, we have that one we carried from the fours place. So in the end, 0101+0100=1001.
Subtraction is very different compared to addition. Say we wanted to do 5-4. Here, the binary equation would be 0101-0100. Now for subtraction, we actually add the negative of the second number. So technically, we are doing 0101+1011. We do this because we want to add the negative to still be able to use addition. And to make a binary number negative, you just switch all the ones in the number to zeroes and all of the zeroes in the equation into ones. So 0100 or 4 in base ten would turn into 1011. Now,we can do the addition of 0101+1001. We would get 10000. You night be thinking to yourself, self, this doesn’t look right. Shouldn’t the one be on the other side of the number in the ones spot? You are right! We have to move the number at the very left of the number all the way to the very right of the number.
So in conclusion, computers use binary numbers to preform many numerical equations. Binary numbers only contain ones and zeros because it is easier to make a computer with only two values compared to the ten values that us humans use. Also, I taught you how to do addition and subtraction with binary numbers. I will be posting about how to do multiplication and division tomorrow so stay tuned for that.