Given an expression like

a + b*y + c*y^2 + d*Sqrt[f + g*y + h*y^2]

How can I programatically, expand this to a quartic without any fractional powers?

Right now, I am having to copy and paste it as input expression and manually move the Sqrt to the RHS and square. I suspect there's an easier way to do this in Mathematica, perhaps using the Coefficient function or something similar.

  • 1
    $\begingroup$ To make sure I understand the question, you want to automatically convert the equation A+B*y+C*y^2+D*Sqrt[F+G*y+H*y^2]==0 to the equation (A+B*y+C*y^2)^2 == D^2 (F+G*y + H*y^2). And you are fine with the fact that this may introduce extraneous roots (if your variables are real and Sqrt[] is interpreted as the positive square root). $\endgroup$ Commented Feb 19, 2013 at 17:50
  • $\begingroup$ Yes that's correct and I completely accept the consequences. My expression currently doesn't include the "==0"; however, that assertion is also true. $\endgroup$ Commented Feb 19, 2013 at 17:54
  • 1
    $\begingroup$ Maybe you want Reduce[a + b*y + c*y^2 + d*Sqrt[f + g*y + h*y^2] == 0, y]? This works better (gives shorter solutions) when you specify additional information about your coefficients. What's the underlying problem that you want to solve? $\endgroup$ Commented Feb 19, 2013 at 17:54
  • $\begingroup$ You will not want to use capital C and D in your expression. They are built-in symbols. $\endgroup$
    – chuy
    Commented Feb 19, 2013 at 18:11
  • $\begingroup$ @ThiesHeidecke - Reduce seems to produce a very complicated output. The manual approach seems to produce a more succinct answer, i.e. Collect[Expand[(a + by + cy^2)^2 - (dSqrt[f + gy + h*y^2])^2], y] $\endgroup$ Commented Feb 19, 2013 at 18:25

1 Answer 1


I managed to find a way using Map. Map allows one to subtract, do powers and more on each side of my equation.

eq = a + b*y + c*y^2 + d*Sqrt[f + g*y + h*y^2] == 0;
eq2 = (# - eq[[1, -1]])^2 & /@ eq;
Collect[Expand[(# - eq2[[2]]) & /@ eq2], y]

$$ a^2-d^2 f + \left(2 a b-d^2 g\right)y + \left(2 a c+b^2-d^2 h\right)y^2 +2 b c y^3+c^2 y^4=0 $$


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.