# Is it possible to reach this expression using Mathematica's algebraic functions?

I know that this expression:

-(m-2 r+b^2 (-7 m+6 r)) ((-m+r)^2+b^4 (-2 m+3 r)^2+b^2 (-3 m^2+10 m r-6 r^2))+(1+b^2)^2 m^3 Cos[t]^2


Is equal to this one:

(1-3 b^2)^3 (-m+r)^2 (-m+2 r)+(1+b^2)^2 m^3 (b^2+Cos[t]^2)


I couldn't get Mathematica to reach this simpler later form. FullSimplify and other functions combinations like FullSimplify with PowerExpand didn't work. I even used VOISImplify, and no success. Any thoughts?

• Why do you think the latter one is "simpler", because it is shorter? – vapor Mar 14 '15 at 14:49
• Change simpler for shorter then. I want a shorter version. – Giovanni F. Mar 14 '15 at 16:24

expr = -(m - 2 r + b^2 (-7 m + 6 r)) ((-m + r)^2 +
b^4 (-2 m + 3 r)^2 +
b^2 (-3 m^2 + 10 m r - 6 r^2)) + (1 + b^2)^2 m^3 Cos[t]^2;

expr2 = (Collect[expr1 /. Cos[t]^2 -> x - b^2, x] // FullSimplify) /.
x -> (b^2 + Cos[t]^2)


(-1 + 3 b^2)^3 (m - 2 r) (m - r)^2 + (1 + b^2)^2 m^3 (b^2 + Cos[t]^2)

expr == expr2 // Simplify


True

LeafCount /@ {expr, expr2}


{76, 42}

• How did you end with that substitution? – Giovanni F. Mar 14 '15 at 16:46
• @Giovanni - (b^2 + Cos[t]^2) was the "odd" factor in the last term of the target result so I made the expression a polynomial of that factor. – Bob Hanlon Mar 14 '15 at 16:53
• Any general procedure for these cases? – Giovanni F. Mar 14 '15 at 20:32
• @Giovanni - Not that I know of. – Bob Hanlon Mar 14 '15 at 21:54