Algebra (all content)
- Introduction to number systems and binary
- Hexadecimal number system
- Converting from decimal to binary
- Converting larger number from decimal to binary
- Converting from decimal to hexadecimal representation
- Adding in binary
- Multiplying in binary
- Converting directly from binary to hexadecimal
When we add two numbers in binary, the key is that we can only use the digits zero and one. When we add two ones together, the result is two, but we have to write it as "10" in binary. Sometimes we have to "carry" a one over just like in regular addition.
Want to join the conversation?
- Did anyone else get kind of confused when Sal added 1 + 1 in the one's place, to get 2 and then carried that 2 into the 2's column by adding another 1, making 1 + 1 + 1, which he then added to get"3", which he ""carried" by writing 3 as 11? I was thinking that having 3 ones in the 2's column would be added as 2 + 2 + 2 = 6, which equals 1 in the 4's place and 1 in the 2's place. You get the same answer (6 = 11, in terms of 4's and 2's), but it just seemed kind of confusing to me the way he did it.(13 votes)
- He converted the decimal 2 to the binary 10 and then carried the one. In the 2's column he added three 1's to get the decimal 3 which is binary 11. He again carried the 1 from 11 to the 4's column. Keep adding this way by carrying digits in binary the same way you did in decimal.(5 votes)
- Is there actually subtraction within binaries?(2 votes)
- Yes, like addition, it's the same as with decimal, only just using the numbers 0 and 1.
For 1011 - 111, you would start with the rightmost digits and do 1 - 1 =0. Then 1 -1 =0 for the second digit. For the third digit, you have 0 - 1, which you can't do, so you have to borrow a 1 from the forth digit to get 10 - 1, which is 1 (it's the equivalent of 2 - 1 = 1). So the final answer is 100. 1011 - 111 = 100, and indeed, 11 - 7 = 4.(9 votes)
- Then what if i add 101 + 111 + 101 + 111 = ? 4 in binary is what number?(3 votes)
- I wanted to understand how the borrow works when there is nothing ot borrow . Say I want to subtract 0110 from 1000 (1000 - 0110) .
First Step : 0 - 0 = 0 : This is fine.
Next : 0 - 1 = carry from next digit ,it is a 0 so carrry from next .So 10 - 1 = 1 . This is also fine.
But now what next since there is nothing to borrow and we are left with 0 - 1 .
Can some explain?(1 vote)
- See you get a nine over there so convert 9 to decimal and solve . just do it like decimal borrowing(1 vote)
- When he said 1 +2 + 4 = 7 in binary, how did he get 7? Can someone please help me?Thank you(2 votes)
- Well, he got the 1, 2, and 4 from the place values of the number. Remember, in binary, the place values go: ones, twos, fours, eights, sixteens, etc. Thus, as there was ONE ones, ONE twos, and ONE fours, he go t the resulting 1,2,4. Then, if he simply adds these numbers, he should get the original decimal number, which is 7. Not sure if I explained this super well, but I think that is the basic idea.(1 vote)
- Can someone explain me how he got the decimal numbers at the end?
for example 1011 stands for 1+2+4 = 7 (dec)(2 votes)
- A easy way to understand addition is also considering this
0+1 = 0
1+1 = 10
1+10 = 11
100+1 = 101
101+1 = 110
110+1 = 111
111 + 1 = 1000
and so on.(1 vote)
- I'm not sure if Sal mentions this in any of the other videos as I haven't watched them yet, but he never seems to mention the sign bit where the most significant bit in the number of bits you have (such as a byte which is 8 bits) is used to represent a negative or positive number in binary where 1 means it's a negative number and 0 means it's a positive number. Is this specific to a certain system of using binary?(1 vote)
Let's see what it's like to add multi-digit numbers in binary. So let's say I had the number one, zero, one, one. And to that I wanted to add the number one, one, one. What is that going to be? And I encourage you to pause this video, and try to work through it on your own. So the key here is this is just a standard algorithm, and we're adding numbers. But remind yourself you're only restricted to the zero and one digits. So let's do that. So we have one plus one. Well, you might say that's two but you can't write a two here. We can only write a zero or a one. And we have to remind ourselves that two in decimal is represented as one zero in binary. It's one two and zero ones. So you write the zero, zero ones, and one two. You essentially carry the one. And now you have one plus one, plus one. Well that's going to be three, but you can't write three. Once again, three in decimal is equal to one one in binary. It's one two, plus, one one is three. And so you just have to realize that. So one plus one plus one is three, which in binary is one one. So you write one in the ones place and then you carry it. And then we want to add what we're doing in the fours place. And over here, I have a one and a one, which is going to be two which we already know we represent as one zero. So you write zero here and then you carry the one. And then once again, one and one is two. Which is one zero in binary, and we're done. We just added these numbers. Now, you might be saying, "Hey, let me make sure this actually makes sense." And we can verify that this actually makes sense by thinking about what these numbers are. Remember, this is going to be this number right over here. If we wanted to think of it in decimal. It's going to be one plus two, plus not four but plus eight. So this is 11 if we were to write it in decimal. And this right over here is one plus two plus four. Which is equal to seven if we were to write it in decimal. And now what's this right over here? This is equal to one two. This is four, eight, 16. So and this right over here. So we have one 16 plus one two. Is going to be equal to 18 if we write it in decimal. And we see that, 11 plus seven is indeed equal to 18. 11 plus seven is indeed equal to 18.