# Some doubts about symbolic equations in Wolfram Mathematica

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$$

$$k=\frac{a}{c}$$

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)}$$

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)}$$ ?

• 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! Commented Apr 22, 2021 at 0:53
• 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 Commented Apr 22, 2021 at 1:00
• I have formated the code. Commented Apr 22, 2021 at 1:52

Clear["Global*"]

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 *)
`