# Binary Numbers Website

## Bits of Binary How to add binary numbers

One plus one equals. huhĂ© I'll talk abouthow this actually makes sense, today at the House of Hacks. Introduction Hi Makers, Builders and DoItYourselfers.Harley here. In the last episode of Bits of Binary, I showedhow to convert between decimal and binary numbers. In this episode in the series, we'lllook at how to add binary numbers together. Remember in grade school when you had to memorizethis addition chartĂ© Well, OK, maybe you didn't have to memorizeit, but I sure did.

This table is a matrix with the 10 numbersfound in the decimal system, 0 through 9, on both the row and column headers. Each cellcontains the sum of its row and column header. This gives us the sums for all the singledigit combinations. 0+0=0 all the way up to 9+9=18. Multidigit numbers can be added bysimply thinking of them as multiple single digit combinations. Well, binary has something similar, but much,much smaller. Since there are only two numbers in the binary system, 0 and 1, the table onlyhas two rows and two columns. And it looks like this.

Or if you want to write it a slightly differentway as equations, it looks like this. Once you know this table, the process of addingin binary is exactly the same as adding in decimal. For example let's look at the decimalnumbers: 321 + 181. Staring with the units: 1+1 = 2, 2+8 = 10 so write 0 and carry a 1,1 + 3 = 4 + 1 = 5. Similarly, in binary we'll look at 1011 +10. Starting with the units on the right: 1 + 0 = 1, 1 + 1 = 10 so write 0 and carrya 1, 1 + 0 = 1, 1 + 0 = 1 again. That's it. Addition is short and sweet. Thanksfor watching this episode of Bits of Binary. In the next episode, we'll look at how tosubtract binary numbers.

I've created a playlist over here that willbe filled in as new episodes in this series are added. Thanks to everyone who has subscribed to thischannel and liked the tutorials. Be sure to leave a comment if you have anythoughts or questions on this topic. And until next time, go make something. Itdoesn't have to be perfect, just have fun!.

### Bits of Binary How to subtract binary numbers

That may look confusing on the surface, butif you saw the last Bits of Binary episode, it might make some sense. I'll explain itin more detail in this episode of the House of Hacks. Hi Makers, Builders and DoItYourselfers.Harley here. This is a continuation in the series on Bitsof Binary. In previous episodes I explored the concept of binary numbers, how to countin binary, how to convert between binary and decimal and, in the last episode, I showedhow to add binary numbers together. In this episode, I'll show the simple, obvious wayto subtract them that's analogous to how we

first learned it in decimal. In a future episodeI plan to introduce the nonintuitive way negative numbers are stored in computers andhow that impacts subtracting binary numbers. Remember last time when we talked about addition,we looked at these two tables. Let's remember how we use this with decimalnumbers. We'll ignore negative numbers for now so we'll establish the rule that the firstnumber has to be larger than the second. Since this half of the table is the same as thishalf, we'll just ignore one side. When describing the process, we'll use theexample 8 5. The process is to first find the entries inthe table for the first number. Then, of those

entries, you find the one with the other numberin the header. The answer is the other header value. Binary is exactly the same way, just withthe much smaller table. Or written as a series of equations, it looks like this. The first three probably make intuitive senseas they are the same as decimal. But the last one may not be quite so obvious. Rememberthat in binary the value for two is represented by 1, 0. If we recall from grade school, with multicolumnnumbers, when we subtract a larger number

from a smaller one, we have to borrow fromthe next higher column. Let's take for example 21 13 in decimal. The units column is 1 3. Well, we can't do that, so we borrow a one from the 2 in the second column givingus 11 3. This gives us 8. Moving to the next column we now have 1 1, giving us 0. Binary works exactly the same way. Let's lookat some examples in binary. First something simple: 6 2. The units columnis 0 0 equals 0. The next column is 1 1 equals 0 again. The final column is 1 0,giving us 1. This gives us an overall result of 100, or the value 4.

Now let's do something with some borrowing:6 3. The units column is 0 1. We can't do that so we're going to borrow a 1 fromthe next column. Now we have 10 1 giving a result of 1. Because of the previous borrow,the second column is 0 1. So again we borrow from the next higher column giving us 10 1with a result of 1. The final column is 0 (because of the previous borrow) 0 givingus 0. Overall, the result is 11, or a value of three. And that's it. Subtraction is a bit more complicateddue to the borrowing, but again, it's a known concept just applied in a slightly differentway.

Thanks for watching this episode of Bits ofBinary. As I mentioned earlier, a future episode will explain how negative numbers are handledin a computer and a lessintuitive but ultimately easier way to handle subtraction. But in thenext episode, I'll look at multiplying binary numbers together. I've created a playlist over here that willbe filled in as more episodes in this series are added. If you liked this, let me know with a quot;thumbsup.quot;. If you have any thoughts or questions on thistopic, I'd love to hear them in the comments