# How to extract a factor from equation and rearrange the equation?

I want to extract a factor from the equations, it's not a common factor, just a factor defined by myself, like this: (ac+b) --> c(a+b/c) I have tried Factor,FactorTerms,Eliminate, but it do not work as I expect, if the factor do not contained in the terms, it could not be extracted, like: b=c*(b/c) I turn to MATHEMATICA for its ability on symbolic calculations, I want to replace pen and paper with the computer program, for convenient and accuracy. Sometimes I need to rearrange the equations to extract some factors or apply some math skills, but the MATHEMATICA always automatically simplify my expression. This is my equation:

-((b La r \[Omega] - b k La^2 \[Omega]^2)/(
g h k w + g h k^3 La^2 w)) == 1


I want to extract (\[Omega]^2*b)/(k^2*g*h*w) and put this part on one side and the other parts on the other side, like this:

(\[Omega]^2*b)/(k^2*g*h*w) == the other part


I have tried:

eq11=-((b La r \[Omega] - b k La^2 \[Omega]^2)/(
g h k w + g h k^3 La^2 w)) == 1
eq12 = Times[(\[Omega]^2*b)/(k^2*g*h*w),
Divide[eq11[], (\[Omega]^2*b)/(k^2*g*h*w)]]


and

factorOut[fac_][expr_] :=
Replace[expr, p_Plus :> fac Simplify[p/fac], All]
factorOut[(\[Omega]^2*b)/(k^2*g*h*w)][eq11]  I would appreciate it if who can fix my problem

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) 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, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Jun 21, 2021 at 3:46
• Thanks those who provide help, all of the answers are very great! Jun 22, 2021 at 9:03

May be this way

eq = -((b La r \[Omega] - b k La^2 \[Omega]^2)/(g h k w +
g h k^3 La^2 w)) == 1

sub1 = (b \[Omega]^2)/(g h k^2 w)

eq2 = eq[]*sub2/sub1 == eq[]

sol = First@Solve[eq2, sub2]

(*     {sub2 -> ((1 + k^2 La^2) \[Omega])/(k La (-r + k La \[Omega]))}     *)

sub1 == sub2 /. sol // Simplify

(*   (b \[Omega]^2)/(g h k^2 w) ==
-((\[Omega] + k^2 La^2 \[Omega])/(k La r - k^2 La^2 \[Omega]))   *)

sub1 == sub2 /. sol // Simplify[#, eq] &

(*   True   *)


There is no special built-in function doing this. You can use the following customwritten one:

factor[expr_, fact_, funExpr_ : Expand, funFact_ : Identity] :=
Module[{a = fact, b = expr/fact},
funFact[Evaluate[a]]*funExpr[Evaluate[b]]]


Here expr is the expression to factor, the fact is the factor to take out of the parentheses, funExpris an optional function to apply to the rest of the expression after the factorization. By default, it is Expand. funFact is an optional function to apply to the factor if needed. By default, it is Identity.

Returning to your expression:

 expr = -((b La r \[Omega] - b k La^2 \[Omega]^2)/(g h k w +
g h k^3 La^2 w));
factor[expr, (\[Omega]^2*b)/(k^2*g*h*w), Simplify, HoldForm] Have fun!

I guess, the simplest way to make desired is to do it semi-manually:

aaa=-((b La r \[Omega] - b k La^2 \[Omega]^2)/(g h k w + g h k^3 La^2 w));
bbb=\[Omega] b/(k^2 g h w);
res=Simplify[aaa/bbb]==1/bbb


All rest, like a creation of superfunctions that refines your equation, is just sophistication..