# Factoring out a common term

Very simple question, but I can't find a simple answer here or in the documentation. I have an expression:

qq = a x + b x^2 + c x^3


and wish to factor out a defined variable/constant to get for example:

qq = b (a/b x + x^2 + c/b x^3)


• FactorByVariable[p_, c_] := c Expand[p/c] where p is your polynomial, c is the variable you want to factor out. – IPoiler Oct 2 '15 at 3:21
• haha... oh yeah. Thanks ! – anon01 Oct 2 '15 at 3:25
• @IPoiler. You should write-up your comment as an answer. – m_goldberg Oct 2 '15 at 4:10

Clear[FactorByVariable]

will be one of the simpler options. The argument p is the polynomial you wish to factor from and c is the variable you wish to factor out.
I think the reason you can't get your desired result with something like FactorTerms[a x + b x^2 + c x^3,{a,c,x}] is because Mathematica doesn't know if b divides a and c; though, specifying {a/b,c/b} \[Element] Integers didn't seem to make Simplify want to factor the b out either.