# How to simplify -a*z+a*z to 0 where "a" is an expression

Consider the following:

a = 1+(x+y+z+u)^10000
(* Out= 1+(u+x+y+z)^10000 *)
e = -a*z+a*z
(* Out= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)


How can I simplify -a*z+a*z (assigned to e) to 0? The simplification is obvious.

I tried:

Simplify[e]
(* Out= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)
FullSimplify[e]
(* Out= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)
Distribute[e]
(* Out= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *)


None of it worked. The only two functions that can do that are Expand[e] and Apart[e], both of which work for smaller expressions, but never finish for this one:

Apart[e]
(*
No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.
*)


because they are expanding the (u+x+y+z)^10000 part, which takes forever.

• Welcome to Mathematica.SE! I suggest that: 1) You 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. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Jan 22 '15 at 22:17
• Please reformat your code according to the guidelines in meta1027. Doing so will encourage more people to try to answer your question. Jan 22 '15 at 22:19
• e /. (x + y + z + u) -> t // Simplify Jan 23 '15 at 5:13

Expand takes forever, because it is trying to expand (u + x + y + z)^10000. Tell it not to.
Expand[e, Power[u + x + y + z, 10000]]

• Thanks! Or in general Expand[e, _^_] will work too. Jan 22 '15 at 23:23
• Well, hey, that's something I did not know about Expand, nifty. +1 Jan 23 '15 at 2:59