I need to perform the following operations using Wolfram Mathematica.

I have these equations:

$$a b = c+d+e$$

$$\frac{d}{f}=g h + i$$


I need to obtain $k$ as a function of: $a,b,c,e,f,g,h,i$

Then I need to put the expression $k$ in the form: $$k= \frac{1}{b}+\frac{(f(g h + i))+e)}{(b c)}$$

I made this code:

In: Solve [a b == c + d + e, a]

Out: {{a -> (c + d + e)/b}}

In: Solve[d/f == g h + i, d]

Out: {{d -> f (g h + i)}}

In: k = a/c /. a -> (c + d + e)/b

Out: (c + d + e)/(b c)

In:  k = k /. d -> f (g h + i) 

Out: (c + e + f (g h + i))/(b c)

In: Simplify[k]

Out: (c + e + f g h + f i)/(b c)

I have 2 questions:

  1. Is there a simpler way to perform that task? For example, using others commands.

  2. Is there a way to obtain the expression of k in the form $k= \frac{1}{b}+\frac{(f(g h + i))+e)}{(b c)}$ ?

  • $\begingroup$ 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) Take the tour! 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! $\endgroup$
    – Michael E2
    Commented Apr 22, 2021 at 0:53
  • $\begingroup$ You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find the meta Q&A, How to copy code from Mathematica so it looks good on this site, helpful $\endgroup$
    – Michael E2
    Commented Apr 22, 2021 at 1:00
  • $\begingroup$ I have formated the code. $\endgroup$
    – Skyhawk
    Commented Apr 22, 2021 at 1:52

1 Answer 1


eqns = {a*b == c + d + e, d/f == g*h + i, k == a/c};

With three equations you can solve for one variable while eliminating two others. To Solve for k while eliminating {a, d}

sol = Solve[eqns, k, {a, d}][[1]] // Simplify

(* {k -> (c + e + f g h + f i)/(b c)} *)

To restructure the RHS

expr = 1/b + j/(b*c);

sol2 = {k -> expr} /. Solve[(k /. sol) == expr, j][[1]]

(* {k -> 1/b + (e + f g h + f i)/(b c)} *)

Verifying that both expressions for k are equivalent

(k /. sol) == (k /. sol2) // Simplify

(* True *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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