Multiplying complex numbers is just like multiplying polynomials. Distribute one of the complex numbers, then multiply through (keep in mind that $i^2 =-1$), and group the real and imaginary terms together:
$x \cdot y = (a + bi)(c + di) = a \cdot c + a \cdot di + c \cdot bi + bi \cdot di = \underset{real}{\underbrace{a \cdot c - b \cdot d}} + \underset{imaginary}{\underbrace{(a \cdot d + c \cdot b)}}i $
@[solution]({"id": "complex_arithmetic__complex_multiplication_solution", "codePath": "Solution.qs"})microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
katas/content/complex_arithmetic/complex_multiplication/solution.md
5lines · modepreview