randRange( -5, 5 ) randRange( -5, 5 ) randRange( -5, 5 ) randRange( -5, 5 ) "\\color{" + ORANGE + "}{" + A_REAL + "}" "\\color{" + ORANGE + "}{" + A_IMAG + "}" "\\color{" + BLUE + "}{" + B_REAL + "}" "\\color{" + BLUE + "}{" + B_IMAG + "}" "\\color{" + ORANGE + "}{" + complexNumber( A_REAL, A_IMAG ) + "}" "\\color{" + BLUE + "}{" + complexNumber( B_REAL, B_IMAG ) + "}" ( A_REAL * B_REAL ) - ( A_IMAG * B_IMAG ) ( A_REAL * B_IMAG ) + ( A_IMAG * B_REAL )

Multiply the following complex numbers:

(A_REP) \cdot (B_REP)

[ ANSWER_REAL, ANSWER_IMAG ]

Complex numbers are multiplied like any two binomials.

First use the distributive property:

\qquad (A_REP) \cdot (B_REP) = (A_REAL_COLORED \cdot B_REAL_COLORED) + (A_REAL_COLORED \cdot B_IMAG_COLOREDi) + (A_IMAG_COLOREDi \cdot B_REAL_COLORED) + (A_IMAG_COLOREDi \cdot B_IMAG_COLOREDi)

Then simplify the terms:

\qquad (A_REAL * B_REAL) + (A_REAL * B_IMAGi) + (A_IMAG * B_REALi) + (A_IMAG * B_IMAG \cdot i^2)

Imaginary unit multiples can be grouped together.

\qquad A_REAL * B_REAL + (A_REAL * B_IMAG + A_IMAG * B_REAL)i + negParens( ( A_IMAG * B_IMAG ) + "i^2" )

After we plug in i^2 = -1, the result becomes A_REAL * B_REAL + (A_REAL * B_IMAG + A_IMAG * B_REAL)i - negParens( A_IMAG * B_IMAG )

The result is simplified: (A_REAL * B_REAL - A_IMAG * B_IMAG) + (ANSWER_IMAGi) = complexNumber( ANSWER_REAL, ANSWER_IMAG)

The real part of the result is ANSWER_REAL and the imaginary part is ANSWER_IMAG.