Binary OperationsDate: 04/07/97 at 21:23:44 From: Matt Subject: Binary Addition, Subtraction, Multiplication, Division Dr. Math, Can you explain binary addition, subtraction, multiplication, and division in a non-complex manner? Thanks. Date: 07/09/97 at 02:00:06 From: Doctor Mandel Subject: Re: Binary Addition, Subtraction, Multiplication, Division Hi Matt, ADDITION Binary addition is the simplest of the binary operations, so let's start there. To add two binary numbers, you only need to know three things: 0 + 0 is 0 carry 0 (pretty easy) 0 + 1 is 1 carry 0 1 + 1 is 0 carry 1. The rest of the operation is just as in base ten. For example, let's add 1010 (10 in base ten) and 1011 (11 in base ten). 1010 + 1011 ---- 0 + 1 is 1 carry 0 1 + 1 is 0 carry 1, 0 + 0 + 1 (carried over) is 1 carry 0 1 + 1 is 0 carry 1 1 + 0 is 1 carry 0 so the final sum is 10101, 21 in base ten, which is correct. MULTIPLICATION The next easiest operation is multiplication. We'll set up the problem like one in base ten, with the larger number above the smaller, and for each digit on the bottom that you go to the left, you move that answer one digit to the left. For multiplication you just have to remember that 1 times a number is that number and 0 times a number is 0. Once you have all of the little multiplications done, you add up the products. Let's try multiplying 101 (5) and 10 (2): 101 x 10 ---- From the bottom right, 0 times 101 is 0 (because that is the product of any number and zero) and 1 times 101 is 101 moved over 1 column to the left (because the 1 was moved over one column to the left), giving 0 plus 1010, or 1010, which is in base 10 is 10, and correct. SUBTRACTION Next, subtraction. This is just like regular subtraction, with borrowing. Let's try 1101 (13 in base 10) minus 110 (6 in base 10): 1101 - 110 ---- From the right, 1 minus 0 is 1. Next, 0 minus 1 is impossible, so you borrow from the next number to the left, making the full top number 10(10)1; then 10 minus 1 is 1. Next 0 minus 1 is impossible again, so we go through the same thing, making the number 0(10)01, and 10 minus 1 is again 1. Thus the final result is 111, or 7 in base 10, which is correct. DIVISION This is mostly trial and error. First you take the first digit of the number you are dividing and see whether the number you are dividing into it goes in (in other words is greater than the number you are dividing by, because in base 2, if it goes in more than once, the previous step must have been incorrect). If it does, great - you can move on to the next digit by itself; if it doesn't go in, see whether the number goes into the first two digits. Keep going on like this until it does go in. Let's divide 10110 (22) by 111 (7). First, see if 111 goes into the first digit, 1. It doesn't, so try the first two. 111 doesn't go into 10 or 101, but it does go into 1011 once, so the first digit of the answer is 1. Now you subtract 111 from the 1011, leaving you with 100, and start over saying "does 111 go into 100?" Since it doesn't, you add the next digit of the number you are dividing: bring down the 0 from the end of 10110 to make the number you divide 1000, which 111 does go into. Subtracting 111 from 1000, we get 1 with 1 left over. 111 does not go into 1 so that is our remainder, and the final answer is 11 remainder 1, which is 3 remainder 1, which is correct. You could also continue this process indefinitely after the decimal point, because 1/7 is a repeating decimal so you will always have a remainder. I hope these directions have been helpful. -Doctor Mandel, The Math Forum Check out our web site! http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/