# Solving system of equations with complex numbers [closed]

I have two equations and two unknowns. The coefficients are complex. How do I solve them using matrices? Or any other method? Here is an example:

Trying to find X and Y

(40 + 50i)(_X_) - 70(_Y_) = 130

-40(_X_) + (170 - 50i)_Y_ = 0


I can do two equations two unknowns on my TI-84 without complex numbers using matricies. It can't do these. I'm new to Mathematica, can anyone help?

## closed as off-topic by Jens, bbgodfrey, Karsten 7., ciao, Kuba♦Mar 5 '15 at 6:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Jens, bbgodfrey, Karsten 7., ciao, Kuba
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Mar 5 '15 at 4:29
• Go to the docs and click on "Learning Resources" – Jens Mar 5 '15 at 4:45
• Have a look at Solve and don't use those underscores. – Sjoerd C. de Vries Mar 5 '15 at 6:51

There are two ways to do this. One easy way is to use the Solve function:

Solve[(40 + 50 I) x - 70 y == 130 && -40 x + (170 - 50 I) y == 0, {x, y}]

{{x -> 6/5 - (11 I)/5, y -> 2/5 - (2 I)/5}}


Or, if you must use matrices, you can solve an equation like ax=b by using matrix inverse. Solving for x, x=Inverse[a].b, where the dot is the matrix inner product:

a = {{40 + 50 I, -70}, {-40, 170 - 50 I}};
b = {{130}, {0}};

Inverse[a].b
{{6/5 - (11 I)/5}, {2/5 - (2 I)/5}}


Mathematica is particular about I and i, so be sure to use capital I or the special imaginary lower case i, which is created by EsciiEsc.

Your equations have several syntax errors. _X_ is not a legal variable, I must be used instead of i, and == used instead of =. With these changes,

NSolve[{(40 + 50 I) x - 70 y == 130, -40 x + (170 - 50 I) y == 0}, {x, y}]


gives the desired answer.

{{x -> 1.2 - 2.2 I, y -> 0.4 - 0.4 I}}


As Jens commented, please review Mathematica documentation.

One method is to write as xr+I*xi, where xr is the real part and xi is the imaginary part. Then

Reduce[{(40 + 50 I) (xr + I xi) - 70 (yr + I yi) == 130,
-40 (xr + I xi) + (170 - 50 I) (yr + I yi) == 0,
{xr, xi, yr, yi} \[Element] Reals}, {xr, xi}]


gives

yr == 2/5 && yi == -(2/5) && xr == 6/5 && xi == -(11/5)


and if you plug those back into your original you see this is a solution.