randRangeNonZero(-5, 5) randRangeNonZero(-5, 5) randRangeNonZero(-5, 5) randRangeNonZero(-5, 5) complexNumber(A_REAL, A_IMAG) complexNumber(B_REAL, B_IMAG) randRangeWeighted(1, 5, 1, 0.7) * randFromArray([1, -1]) randRangeWeighted(1, 5, 1, 0.7) * randFromArray([1, -1]) F1 * A_REAL F2 * B_REAL F1 * A_IMAG F2 * B_IMAG FA_REAL + FB_REAL FA_IMAG + FB_IMAG

coefficient(F1)(\pink{A}) + coefficient(F2)(\blue{B}) = ?

ANSWER_REAL + ANSWER_IMAGi

Complex numbers can be added by separately adding their real and imaginary components.

Distribute the negative sign onto the first complex number:

Distribute the F1 onto the first complex number:

\qquad \begin{eqnarray} coefficient(F1)(\pink{complexNumber(A_REAL, A_IMAG)}) &=& (F1 \cdot \pink{A_REAL}) + (F1 \cdot \pink{A_IMAG}) \\ &=& \pink{complexNumber(FA_REAL, FA_IMAG)} \end{eqnarray}

Distribute the negative sign onto the second complex number:

Distribute the F2 onto the second complex number:

\qquad \begin{eqnarray} coefficient(F2)(\blue{complexNumber(B_REAL, B_IMAG)}) &=& (F2 \cdot \blue{B_REAL}) + (F2 \cdot \blue{B_IMAG}) \\ &=& \blue{complexNumber(FB_REAL, FB_IMAG)} \end{eqnarray}

Now we have:

\pink{complexNumber(FA_REAL, FA_IMAG)} + \blue{complexNumber(FB_REAL, FB_IMAG)}

The real components are \pink{FA_REAL} and \blue{FB_REAL}

The imaginary components are \pink{FA_IMAGi} and \blue{FB_IMAGi}

Adding real components, we get \pink{FA_REAL} + \blue{FB_REAL} = FA_REAL + FB_REAL

Adding imaginary components, we get \pink{FA_IMAGi} + \blue{FB_IMAGi} = FA_IMAG + FB_IMAGi

So the answer is complexNumber(ANSWER_REAL, ANSWER_IMAG).