Booth's Algorithm in COA: Flowchart, Examples & Step-by-Step Guide

Booth's Algorithm in COA: Flowchart, Examples & Step-by-Step Guide

Binary multiplication sounds straightforward until you introduce negative numbers. The standard shift-and-add method works cleanly for positive operands, but signed binary multiplication in two's complement requires special handling - and doing it naively leads to incorrect results.

Booth's Algorithm solves this elegantly. Proposed by Andrew D. Booth in 1951, it is a hardware-efficient method for multiplying two signed binary integers in two's complement representation. Rather than treating every bit of the multiplier identically, Booth's algorithm inspects pairs of adjacent bits and decides whether to add, subtract, or do nothing - dramatically reducing the number of arithmetic operations needed, especially when the multiplier contains long strings of consecutive 0s or 1s.

This guide covers everything you need for exams and interviews: what Booth's algorithm is, the hardware register configuration, the complete flowchart, the Qn/Qn+1 decision rules, two fully worked step-by-step examples (7×3 and -5×-7), best and worst case analysis, a C++ implementation, and GATE-specific tips. Understanding ACID properties in DBMS or other COA topics becomes more coherent once you have this foundational arithmetic algorithm firmly in place.

Who This Guide Is For

What is Booth's Algorithm?

Booth's algorithm is a multiplication algorithm that multiplies two signed binary integers expressed in two's complement notation. It works by scanning the multiplier bit by bit - specifically examining the current bit (Qn) and the previous bit (Qn+1) together - and deciding whether to add the multiplicand, subtract the multiplicand, or take no action before performing an arithmetic right shift.

The core insight behind the Booth multiplication algorithm is that a string of consecutive 1s in the multiplier does not need individual additions. For example, a multiplier pattern like 0111100 can be rewritten as 2^5 - 2^2, converting four additions into one subtraction and one addition. The algorithm exploits this automatically by detecting transitions between 0s and 1s in the multiplier bit string.

The algorithm was originally designed for desk calculators where shifting was faster than adding. In modern computer architecture, it is important because it handles both positive and negative signed numbers in two's complement without any special-case logic for the sign - the same algorithm works for all combinations of positive and negative operands.

Booth's algorithm requires operands in two's complement representation because two's complement has a unique property: the sign bit participates in arithmetic just like any other bit, with no separate sign handling needed. This is what allows the algorithm to produce the correct signed product for all four combinations: (+)×(+), (+)×(-), (-)×(+), and (-)×(-).

Hardware Register Configuration

Before walking through the algorithm steps, it is essential to understand the hardware registers involved. Booth's algorithm in computer architecture uses five key components that work together in each iteration.

Booth's Algorithm - Hardware Register Configuration

BR
Multiplicand
Register
AC
Accumulator
(Partial Product)
QR
Multiplier
Register
Qn+1
Extra Flip-flop
(Init = 0)
SC
Sequence
Counter = n
AC initialised to 0 | QR holds multiplier | BR holds multiplicand | Qn = LSB of QR | SC = number of bits (n)

Booth's Algorithm Flowchart

The Booth algorithm flowchart describes the decision and operation sequence for each of the n iterations. The key decision point is the (Qn, Qn+1) bit pair - the least significant bit of QR and the appended flip-flop. Each combination maps to a specific arithmetic operation before the mandatory arithmetic right shift.

Booth's Algorithm Flowchart

START
Initialise: AC = 0, Qn+1 = 0, SC = n
Load BR = Multiplicand, QR = Multiplier
Check Qn and Qn+1
Qn Qn+1 = 10
AC = AC - BR
(Subtract)
Qn Qn+1 = 01
AC = AC + BR
(Add)
Qn Qn+1 = 00 or 11
No Operation
(Skip)
Arithmetic Shift Right (ashr): Shift [AC, QR, Qn+1] right by 1 bit
Sign bit of AC is preserved
SC = SC - 1
Is SC = 0?
No ↑
Loop back to
Check Qn Qn+1
Yes ↓
END: Product = [AC | QR]

Fig 1: Booth's Algorithm Flowchart - n iterations, product stored in combined AC and QR

The Qn/Qn+1 Decision Rules

The entire logic of Booth's algorithm rests on four possible combinations of the two bits (Qn, Qn+1). These bit pairs represent transitions in the multiplier bit string - the algorithm detects the beginning and end of runs of 1s and acts accordingly.

Overflow cannot occur in Booth's algorithm because addition (01) and subtraction (10) always alternate - they never occur consecutively. This means whenever an addition happens, the next arithmetic operation must be a subtraction (and vice versa). The two numbers being added always have opposite signs, which mathematically guarantees the partial product stays within range. This is a frequent GATE exam point.

Booth's Algorithm Steps

Booth's Algorithm Example 1: 7 × 3 (Positive Numbers)

Let us start with a positive example to verify the algorithm works for standard cases before moving to negative numbers.

Given: Multiplicand M = 7 = 0111, Multiplier Q = 3 = 0011, n = 4 bits Setup:

  • BR = 0111 (multiplicand = 7)
  • BR's 2's complement (BR'+1) = 1001 (used for subtraction)
  • QR = 0011 (multiplier = 3)
  • AC = 0000, Qn+1 = 0, SC = 4
  • Expected result: 7 × 3 = 21 = 00010101 in 8-bit binary

Result: Product = [AC | QR] = 0001 0101 = 00010101

Converting 00010101 from binary to decimal: 16 + 4 + 1 = 21

The sign bit (MSB of AC) is 0 - confirming a positive result, as expected for 7 × 3 = 21.

The final product is always stored in the combined [AC | QR] register. For n-bit operands, the product is 2n bits wide - AC holds the upper n bits and QR holds the lower n bits. Always check the MSB of AC to determine the sign: 0 means positive, 1 means negative (in two's complement).

Booth's Algorithm Example 2: -5 × -7 (Negative Numbers)

This is the classic GATE example that tests whether the algorithm correctly handles two negative operands. The result should be positive (+35).

Given: Multiplicand M = -5, Multiplier Q = -7, n = 4 bits

Converting to 4-bit two's complement:

  • +5 = 0101, so -5 = 1011 (BR = 1011)
  • BR's 2's complement (BR'+1) = 0101 (used when subtracting BR)
  • +7 = 0111, so -7 = 1001 (QR = 1001)
  • AC = 0000, Qn+1 = 0, SC = 4
  • Expected result: (-5) × (-7) = +35 = 00100011 in 8-bit binary

Result: Product = [AC | QR] = 0010 0011 = 00100011

Converting 00100011 from binary to decimal: 32 + 2 + 1 = 35

The sign bit (MSB of AC) is 0 - confirming a positive result, as expected for (-5) × (-7) = +35.

When both operands are negative in Booth's algorithm, the final product must be positive. If your result has a 1 in the MSB of AC after all iterations, you have made an error - go back and check your two's complement conversions and your ashr operations (remember: arithmetic shift preserves the sign bit, it does NOT insert a 0).

Arithmetic Shift Right vs Logical Shift Right

One of the most commonly confused points in Booth's algorithm is the type of right shift used. This confusion is also a frequent source of GATE exam errors.

Using a logical shift right instead of arithmetic shift right is the single most common mistake in Booth's algorithm problems. In every iteration, after the add/subtract/no-op, you MUST perform an arithmetic right shift that preserves the sign bit. If AC = 1110 and you shift right, the result must be 1111 (sign preserved), not 0111 (sign lost).

Best Case and Worst Case Analysis

GATE CS 1996 Question 23 asks exactly this: Booth's algorithm gives worst performance when the multiplier has alternating 0s and 1s (pattern 010101... or 101010...). In this case, every bit pair is a transition (10 or 01), so an add or subtract occurs at every step - no savings over standard binary multiplication. Best case is when the multiplier is all 0s or all 1s.

C++ Implementation of Booth's Algorithm

= 0; i--) cout << ac[i]; cout << " QR: "; for (int i = n-1; i >= 0; i--) cout << qr[i]; cout << endl; } void boothsAlgorithm(int br[], int qr[], int n) { int ac[8] = {0}; // Accumulator (initialised to 0) int br_comp[8]; // Two's complement of BR (for subtraction) int qn1 = 0; // Extra flip-flop Qn+1 (initialised to 0) int sc = n; // Sequence counter // Prepare BR complement for subtraction for (int i = 0; i < n; i++) br_comp[i] = br[i]; twosComplement(br_comp, n); cout << "Initial state:" << endl; printRegs(ac, qr, n); while (sc > 0) { int qn = qr[0]; // Qn = LSB of QR cout << "\nQn=" << qn << " Qn+1=" << qn1 << " -> "; if (qn == 1 && qn1 == 0) { // 10: Subtract multiplicand (AC = AC + BR's two's complement) cout << "Subtract BR" << endl; add(ac, br_comp, n); } else if (qn == 0 && qn1 == 1) { // 01: Add multiplicand cout << "Add BR" << endl; add(ac, br, n); } else { // 00 or 11: No operation cout << "No operation" << endl; } ashr(ac, qr, qn1, n); sc--; cout << "After ashr (SC=" << sc << "): "; printRegs(ac, qr, n); } cout << "\nFinal Product [AC | QR]: "; for (int i = n-1; i >= 0; i--) cout << ac[i]; for (int i = n-1; i >= 0; i--) cout << qr[i]; cout << endl; } int main() { int n = 4; // Example: -5 x -7 = 35 // BR = -5 = 1011 (stored LSB first: {1,1,0,1}) // QR = -7 = 1001 (stored LSB first: {1,0,0,1}) int br[] = {1, 1, 0, 1}; // -5 in 4-bit two's complement (LSB first) int qr[] = {1, 0, 0, 1}; // -7 in 4-bit two's complement (LSB first) cout << "Booth's Algorithm: (-5) x (-7)" << endl; cout << "BR (-5) = 1011, QR (-7) = 1001" << endl << endl; boothsAlgorithm(br, qr, n); return 0; // Expected output: 00100011 = 35 }">

Applications of Booth's Algorithm

Advantages and Limitations

Conclusion

Booth's algorithm is one of the most elegant results in computer arithmetic. By treating multiplication as a problem of detecting transitions between 0s and 1s in the multiplier, it converts a complex multi-case signed multiplication into a uniform procedure that handles all sign combinations correctly with no special cases.

The three things to take away: first, the (Qn, Qn+1) bit pair is the entire decision engine of the algorithm - 10 means subtract, 01 means add, 00 and 11 mean do nothing. Second, the arithmetic shift right is mandatory and non-negotiable - using a logical shift right corrupts the sign and produces wrong results. Third, the best case is a multiplier with long runs of identical bits (all 0s or all 1s); the worst case is strictly alternating bits.

For GATE preparation, the key questions to practice are: multiplying two negative numbers, identifying best and worst case multipliers, and explaining why overflow cannot occur. Board Infinity's complete guide on the structure of DBMS covers the broader Computer Organisation and Architecture context that Booth's algorithm sits within, including how the arithmetic unit fits into the overall CPU structure.

Frequently Asked Questions

Q1. What is Booth's algorithm? Booth's algorithm is a method for multiplying two signed binary integers in two's complement representation. It works by examining pairs of adjacent multiplier bits (Qn and Qn+1) and deciding whether to add the multiplicand, subtract it, or do nothing, followed by an arithmetic right shift. It handles all sign combinations correctly with a single uniform procedure.

Q2. What is the Booth multiplication algorithm used for? Booth's multiplication algorithm is used in hardware ALUs inside CPUs and microprocessors to perform fast, efficient signed integer multiplication. It is also used in DSP chips, GPU arithmetic units, cryptographic hardware, and embedded systems where efficient signed binary multiplication is required.

Q3. What is the Booth algorithm flowchart decision rule? The flowchart decision is based on the two-bit pair (Qn, Qn+1): if the pair is 10, subtract the multiplicand from AC; if 01, add the multiplicand to AC; if 00 or 11, take no arithmetic action. After any operation (or non-operation), perform an arithmetic right shift on [AC, QR, Qn+1] and decrement the sequence counter.

Q4. What is the difference between arithmetic shift right and logical shift right in Booth's algorithm? Arithmetic shift right (ashr) preserves the sign bit - the MSB of AC is copied into the vacated position after shifting. Logical shift right inserts a 0 into the MSB regardless of the original sign. Booth's algorithm always requires ashr. Using logical shift right corrupts the sign of the partial product and produces incorrect results for negative numbers.

Q5. What is the best case and worst case for Booth's algorithm? Best case is when the multiplier has long strings of consecutive identical bits (all 0s or all 1s) - only transitions trigger operations, so few adds/subtracts are needed. Worst case is when the multiplier alternates between 0 and 1 (e.g., 0101... or 1010...) - every bit pair is a transition, requiring an operation at every step - no improvement over naive multiplication.

Q6. Can Booth's algorithm overflow? No. Overflow cannot occur in Booth's algorithm because addition (01 case) and subtraction (10 case) always alternate - they never occur in consecutive iterations. This means the two numbers being added always have opposite signs, which mathematically prevents overflow in the partial products.

Q7. Where is the final product stored in Booth's algorithm? After all n iterations, the final 2n-bit product is stored in the combined [AC | QR] register pair. AC holds the most significant n bits (upper half) and QR holds the least significant n bits (lower half). The sign of the product is given by the MSB of AC.

Further Reading

Board Infinity Guides:

External Resources:

Mark Lesson Complete (Booth's Algorithm in COA: Flowchart, Examples & Step-by-Step Guide)