4
$\begingroup$

I feel like I'm missing something very simple. I tried searching for similar answers, because I'm sure I'm not the first to as this question, but I had no luck (perhaps I'm missing the correct search terms).

I would like to simplify an equation of the form, e.g. a(x+1)==0 to x+1==0. Trying FullSimplify[a(x+1)==0] does not work, nor did using Reduce or Refine. Eliminate[(x + 1) == 0, a] just outputs True. How do I get Mathematica to remove terms that multiply a parenthetical expression when it is all equal to zero?

$\endgroup$
  • 3
    $\begingroup$ Try FullSimplify[a (x + 1) == 0, Assumptions -> a != 0] assuming that makes sense for what you want. But maybe you do want to consider the case when a=0 ? $\endgroup$ – JimB Feb 8 '18 at 18:00
  • 4
    $\begingroup$ As pointed out by JimB, $a(x+1)=0$ implies $x+1=0$ only if $a\neq 0$. $\endgroup$ – anderstood Feb 8 '18 at 18:01
10
$\begingroup$

This works

Assuming[a != 0, Simplify[a (x + 1) == 0 ]]
$\endgroup$
11
$\begingroup$

Reduce is also useful in situations like this to decompose the solution space of an equation into its possible cases:

Reduce[a (x + 1) == 0]
(* a == 0 || x == -1 *)

which also gives the alternative solution a==0 in addition to the expected solution x+1==0.

$\endgroup$
6
$\begingroup$

As of 11.3 we have DivideSides:

DivideSides[a (x + 1) == 0, a]
Piecewise[{{1 + x == 0, a != 0}}, a*(1 + x) == 0]

Add an assumption:

DivideSides[a (x + 1) == 0, a, Assumptions -> a != 0]
1 + x == 0
$\endgroup$
3
$\begingroup$

Simplify is not the best instrument in this case. It works fine with this trivial equation (as in the example of Konstantinos above), but may fail in less trivial cases, such as already in the equation a (x+1)==b. Indeed,

Assuming[a != 0, Simplify[a (x + 1) == b]]

(* b == a (1 + x) *)

instead of x+1==b/a.

In this case, (assuming by default that a is nonzero) I use a more stable method dividing the both parts of the equation by a:

Map[Divide[#, a] &, a*(x + 1) == 0]

(*   1 + x == 0  *)

or

Map[Divide[#, a] &, a*(x + 1) == b]

(*  1 + x == b/a  *)

Have fun!

$\endgroup$
  • $\begingroup$ That 's a nice trick. I will have that in mind!!! $\endgroup$ – A_user_with_NoName Feb 9 '18 at 12:13
  • $\begingroup$ I normally use Thread[] for this: Thread[(a (x + 1) == 0)/a, Equal] $\endgroup$ – J. M. will be back soon Apr 10 '18 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.