Complex Number Multiplication
Consider computing the product of two complex numbers (a+bi) and (c+di). Using the standard method we learned in school, we get:
(a+bi)(c+di)=ac+adi+bci+bdi2=(ac−bd)+(ad+bc)iThis standard method uses 4 multiplications and 2 additions to compute the product:
- Multiplications: ac, ad, bc, bd
- Additions: ac−bd, ad+bc
- We will treat subtraction as addition too. In computer design, subtraction a from b essentially negates b first, then adds it to a.
Note that the plus sign combining the real and imaginary parts doesn’t count—think of a complex number as simply a 2-tuple of values.
It turns out that you can compute this complex product using only 3 multiplications and 5 additions. From a computer design perspective, this is preferable since multiplications are more expensive to implement than additions.
Can you figure out how to do this?
Solution
The key insight is that ad+bc can be extracted from the product (a+b)(c+d).
Expanding (a+b)(c+d):
(a+b)(c+d)=ac+ad+bc+bdNotice that this contains both ac and bd, which we already need for the real part. If we subtract them:
(a+b)(c+d)−ac−bd=ad+bcThis gives us exactly the imaginary coefficient we need!
The 3-multiplication method:
- Compute m1=ac
- Compute m2=bd
- Compute m3=(a+b)(c+d)
Then:
- Real part: m1+m2=ac−bd
- Imaginary part: m3−m1−m2=ad+bc
Operation count:
- 3 multiplications: m1, m2, m3
- 5 additions: (a+b), (c+d), (m1+m2), and two more to compute (m3−m1−m2)
We’ve traded one multiplication for one addition—a worthwhile exchange when multiplication is the expensive operation.
This technique is the foundation of Karatsuba’s algorithm for fast multiplication of large integers, which recursively applies this same trick to achieve O(nlog23)≈O(n1.585) complexity instead of the naive O(n2).
Try These Next
Randomised Ice Cream
For Employee Day, your company is offering everyone free ice cream, and you somehow find yourself at the front of the queue. The vendor manning the ice cream...
Coconuts and a Monkey 2
Five people are stranded on a deserted island. They gather a pile of coconuts for food, planning to divide them equally the next morning. However, during the...
L-Shaped Room
We have a room made out of 3 squares arranged in an L shape. Two people are placed randomly within it. What’s the probability that they can see each other?