Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to solve the equation $\frac{abi}{a+bi}=4-2i$, where $a$ and $b$ are real numbers. I know from hand-solving the answer is $a=5$, $b=-10$. How do I get Mathematica to tell me this?

I tried:

Solve[a b I/(a + b I) == 4 - 2 I, {a, b}]

but this returns

{{b -> -(((2 + 4 I) a)/((-4 + 2 I) + a))}}.

I tried

Solve[a b I/(a + b I) == 4 - 2 I, {a, b},Reals]

but this returns

Solve[a b I/(a + b I) == 4 - 2 I, {a, b},Reals].

Is there a simple way of getting Mathematica to solve this, without knowing lots of special Mathematica commands? In searching out the answer on this site, I see workarounds that a newbie to MMA would never think of themselves, nor understand what they are doing that gives the right answer.

share|improve this question
Solve[a b I/(a + b I) == 4 - 2 I && (a | b) ∈ Reals, {a, b}]. This might be slightly related: Solve an equation in R+. – Artes Dec 18 '13 at 14:18
That works - thanks! What does (a | b) mean? Specifically, what's the pipe? – GregH Dec 18 '13 at 14:21
See Alternatives. You can use Solve[a b I/(a + b I) == 4 - 2 I && a ∈ Reals && b ∈ Reals, {a, b}] as well. – Artes Dec 18 '13 at 14:23
@Artes If you make your comment an answer I'd mark it as my favorite. The one given currently is essentially the same, but yours is more succinct and, imo, more intuitive. – GregH Dec 19 '13 at 11:39
I'm glad I could help, but I think you could accept the answer given by Alexei since that one is quite appropriate. On the other hand you might find helpful more detailed discussion of Reduce and Solve: What is the difference between Reduce and Solve?. – Artes Dec 19 '13 at 15:27
up vote 4 down vote accepted
Reduce[a b I/(a + b I) == 4 - 2 I && a \[Element] Reals && 
  b \[Element] Reals]

(* b == -10 && a == 5 *)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.