Binary number division problems can be solved by hand or using a simple computer program. Alternatively, the complementary method of repeated subtraction provides an approach that you may not be familiar with but little used in programming. Programming languages generally use a more efficient estimation algorithm, but this issue is not covered in this article.

## Steps

### Method 1 of 2: Using Long Division

#### Step 1. Review how to do decimal division by hand

If you haven't done decimal division (base ten) by hand in a while, review the basics using example 172 ÷ 4. If not, go to the next Step and learn the same process for binary numbers.

- O
**dividend**is divided by**divider**, and the result is the**quotient**. - Compare the divisor to the first digit of the dividend. If it is larger, keep adding digits to the dividend until the divisor is the smaller number. For example, to calculate 172 ÷ 4, compare 4 and 1; notice that 4 > 1, so compare 4 with 17.
- Write the first digit of the quotient above the last digit of the dividend as if you were using it in the comparison. When comparing 4 and 17, see that the 4 fits four times into the number 17, so write 4 as the first number in the quotient, above 7.
- Multiply and subtract to find the rest. Multiply the quotient digit by the divisor; in this case, 4 x 4 = 16. Write 16 under 17, then subtract 17 - 16 to get the remainder, 1.
- Repeat. Again, compare divisor 4 with the next digit, 1. Notice that 4 > 1, then "down" the next digit of the dividend to compare 4 with 12. The 4 fits exactly (no remainder) three times into the number 12, then write 3 as the next quotient number. The answer is 43.

#### Step 2. Assemble the binary number division problem by hand

Let's use example 10101 ÷ 11. Set up the division problem, with 10101 being the dividend and 11 being the divisor. Leave a space above to write the quotient, and below to do the calculations.

#### Step 3. Compare the divisor with the first digit of the dividend

This works the same as a handy division problem with decimal numbers, but it's actually easier with binary numbers. One of the two: either it is not possible to divide a number by the divisor (0) or the divisor can be used once (1):

### 11 > 1, so 11 does not "fit" into 1. Write 0 as the first digit of the quotient (above the first digit of the dividend)

#### Step 4. Move to the next digit and repeat until you get the number 1

See the next steps for the example used:

- Lower the next digit of the dividend. 11 > 10. Write 0 in the quotient.
- Lower the next digit. 11 < 101. Write 1 in the quotient.

#### Step 5. Find the rest

Just like a hand division of decimal numbers, you need to multiply the newly found digit (1) with the divisor (11), and write the result below the dividend aligned with the newly calculated digit. In binary, it is possible to use a shortcut, as 1 x the divisor will always be equal to the divisor:

- Write the divisor below the dividend. In this case, write 11 aligned below the first three digits (101) of the dividend.
- Calculate 101 - 11 to get the rest, 10. See the article How to Subtract Binary Numbers if you need help.

#### Step 6. Repeat until the end of the problem

Lower the next digit of the divisor along with the rest to form the number 100. As 11 < 100, write the number 1 as the next digit of the quotient. Continue calculating the problem in the same way as before:

- Write 11 under 100 and subtract to get 1.
- Lower the next digit of the dividend.
- 11 = 11, so write 1 as the final digit of the quotient (the answer).
- There is no remainder, so the problem is complete. The answer is
**00111**, or simply 111.

#### Step 7. Use a stitch if necessary

Sometimes the result is not an integer. If there is still a remainder after using the final digit, add ".0" to the dividend and a "." to the quotient, so you can drop another digit and continue. Repeat until you reach the desired specificity and round the answer. On paper, you can round by cutting the last 0; or if the last digit is 1, download it and add 1 to the last digit. In programming, follow one of the standard rounding algorithms to avoid errors when converting a binary number to a decimal.

- Generally, binary number division problems end up in portions of repeated fractions – more often than in the decimal notion.
- It is known as a "fractional point", applied to any base, as the "decimal separator" is only used in the decimal system.

### Method 2 of 2: Using the Complementary Method

#### Step 1. Understand the basic concept

One way to solve division problems - on any basis - is to keep subtracting the divisor from the dividend, and then the rest, recording the number of times this is done before getting a negative number. See an example in a base ten division: 26 ÷ 7:

- 26 - 7 = 19 (subtracted 1 time)
- 19 - 7 = 12 (2)
- 12 - 7 = 5 (3)
- 5 - 7 = -2. When getting a negative number, go back one step. The answer is 3 with a remainder of 5. Note that this method does not calculate unhealthy portions of the answer.

#### Step 2. Learn to subtract by complements

While it is possible to use the above method easily on binary numbers, there is a more efficient method that saves time when programming computers to divide them. This is the method of subtraction by complements. See the basics when calculating 111 - 011 (both numbers must have the same number of digits):

- Find the 1's complements of the second term by subtracting each digit from 1. This can easily be done in the binary system by replacing each 1 with 0 and each 0 with 1. In the example used, 011 becomes 100.
- Add 1 to the result: 100 + 1 = 101. These are the two complements, and they allow subtraction as an addition problem. The result is like adding a negative number instead of subtracting a positive one at the end of the process.
- Add the result to the first term. Write and solve the addition problem: 111 + 101 = 1100.
- Discard the extra digit. Discard the first digit of the answer to get the final result. 1100 →
**100**.

#### Step 3. Combine the above two concepts

Now you have learned the subtraction method for calculating division problems, and the two complementary methods for solving subtraction problems. Be aware that you can combine them into a new Method for calculating division problems. See how to do it in the steps below. If you prefer, try to understand it yourself before proceeding.

#### Step 4. Subtract the divisor from the dividend by adding the two's complement

Let's go over problem 100011 ÷ 000101. The first step using the two's complement method is to turn subtraction into an addition problem:

- The two's complement of 000101 = 111010 + 1 = 111011
- 100011 + 111011 = 1011110
- Discard the extra digit → 011110.

#### Step 5. Add 1 to the quotient

In a computer program, this is the point where the quotient is increased by one. On paper, make a note somewhere so you don't get confused with the bills. Subtraction was performed once successfully; so, so far, the quotient is 1.

#### Step 6. Repeat subtracting the divisor from the rest

The result of the last calculation is the remainder of the division after using the divisor once. Continue adding the divisor's two's complement each time, discarding the extra digit. Add 1 to the quotient each time, repeating the process until you get a remainder that is equal to or less than the divisor:

- 011110 + 111011 = 1011001 → 011001 (quotient1+1=10)
- 011001 + 111011 = 1010100 → 010100 (quotient 10+1=11)
- 010100 + 111011 = 1001111 → 001111 (11+1=100)
- 001111 + 111011 = 1001010 → 001010 (100+1=101)
- 001010 + 111011 = 10000101 → 0000101 (101+1=110)
- 0000101 + 111011 = 1000000 → 000000 (110+1=111)
- 0 is less than 101, so we can stop here. the quotient
**111**is the answer to the division problem. The rest is the final answer to the subtraction problem; in this case, 0 (no remainder).

## Tips

- The two's complement method of subtraction will not work on numbers with different amounts of digits. However, to fix this, add zeros to the number with the fewest digits.
- Ignore the signed digit in signed binary numbers before calculation, except when you need to define whether the answer is positive or negative.
- Instructions for incrementing, decrementing, or removing an item from the number stack should be considered before doing any binary calculation to a set of machine instructions.