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
Marble Pairs
You’re given a jar containing 100 marbles, each one coloured either black or white, and there is at least 1 marble of each colour. You notice that if you pick...
Hummingbird
A train leaves Oakridge at 20 km/h, headed for Fairhaven. At the same time, another train leaves Fairhaven at 30 km/h, headed for Oakridge on the same track....
Stack of Coins 3
Once more, you and your friend stumble on another pirate’s treasure: an old chest filled with coins: 575 copper coins and 1 gold coin. As before, these old...