Complex number pairs - simplficiation I am trying to write an algorithm but I am having a problem solving this equation.  I've never taken linear algebra before and I've tried to solve it, but to no avail.  My goal is to remove w from the equation and solve for both S1 and S2
The value w is set to a value that I am unaware of and it changes several times in a loop.  In order to solve this problem, we must make F1 = F2 and solve for both S1 and S2.
Also w will never be equal to 0.
Can someone help me solve this? I would appreciate a hint on how to solve this, I am not asking for spoon feeding.  Here is what I know so far:


*

*Distributive law is in place

*Associative law is in place

*Multiply complex number pairs: (a, b) * (c, d) = (ac + ad, bc - bd)

*The values w, S1, S2, M1, M2 are complex numbers.  So S1 = (S1a, S1b), S2 = (S2a, S2b), w = (wa, wb), M1 = (M1a, M1b), M2 = (M2a, M2b)
F1 = w^2 + w * S1 + S2
F2 = (W + M1) * (W + M2)
F1 = F2
I've expanded F2 into the following:
F2 = (w^2) + (w * M1) + (w * M2) + (M1 * M2)

I subtracted w^2 from both sides and now I'm stuck.  I need to remove w from the entire equation so that I can solve for S1 and S2.  But I don't know what to do next.
Here is what I have:
w * S1 + S2 = w * M2 + w * M1 + M1 * M2

And all the values are complex numbers.  How do I remove w from the equation?
EDIT: I need to make two equations so that I can solve for S1 and S2.  So I'm thinking it has something to do with that; but I'm not entirely sure how to continue.
 A: Re arrange and get $w$ to left
$$
w (S_1 - M_2 - M_1) = M_1 M_2 - S_2$$
So $$
w = \frac{M_1 M_2 - S_2}{S_1 - M_2 - M_1}$$
Depending on how you represent the complex number you can reduce it to
$$
w =\frac{A + i B}{C + i D} = \frac{(A + i B)(C + i D)}{C^2+D^2} = \frac{AC-BD}{C^2+D^2} + i \frac{AD  + BC}{C^2+D^2}$$
I hope you have functions/subroutines to multiply complex numbers. If not leave a comment
A: If I understand correctly, you're trying to express $S_1$ and $S_2$ in terms of $M_1$ and $M_2$ such that $$wS_1+S_2=wM_2+wM_1+M_1M_2$$ for all $w$. In order to solve for two unknowns, we usually need two equations, which we can get by setting $w$ to two well-chosen test values. For example, setting $w=0$ immediately gives us $$S_2=M_1M_2.$$
However, there's a wrinkle: you specified that $w$ is never $0$. This won't actually change the final answer, but to be cautious, try setting $w=1$ and $w=-1$. You'll get a pair of equations without $w$, and after simplifying, you should eventually get $S_2=M_1M_2$ after all, plus a similarly simple expression for $S_1$.
