# Simplify with equals; can't move terms from one side to another

I am doing symbolic manipulations to get some equations. After generating the equations I want to put them into a more readable form. I am doing this by hand; moving terms from one side of an equals to the other (with the appropriate change in sign). Now doing things by hand can result in slips so I like to check that I have not slipped up by getting Simplify to compare my original equation with the one I have tided up by hand. It does not give back True. What have I done wrong? Below the original equation is eqnsb. I have changed this to eqnsc by moving the second term in the second equation from the left hand side to the right hand side.

Here is the code

eqnsb = {g + (\[Omega]0^2 + \[Alpha] \[Omega]1^2) y[
t] + \[Alpha] \[Omega]1^2 y1[t] +
2 \[Zeta] \[Omega]0 (-Derivative[1][x][t] +
Derivative[1][y][t]) + (y^\[Prime]\[Prime])[t] ==
L \[Omega]0^2 + (2 L + L1) \[Alpha] \[Omega]1^2 + (\[Omega]0^2 +
2 \[Alpha] \[Omega]1^2) x[t],
g \[Alpha] +
2 \[Zeta] \[Omega]0 Derivative[1][x][
t] + \[Alpha] (\[Omega]1^2 (y[t] + y1[t]) + (
y1^\[Prime]\[Prime])[t]) == \[Alpha] \[Omega]1^2 (2 L + L1 +
2 x[t]) + 2 \[Zeta] \[Omega]0 Derivative[1][y][t]};

eqnsc = {g + (\[Omega]0^2 + \[Alpha] \[Omega]1^2) y[
t] + \[Alpha] \[Omega]1^2 y1[t] +
2 \[Zeta] \[Omega]0 (-Derivative[1][x][t] +
Derivative[1][y][t]) + (y^\[Prime]\[Prime])[t] ==
L \[Omega]0^2 + (2 L + L1) \[Alpha] \[Omega]1^2 + (\[Omega]0^2 +
2 \[Alpha] \[Omega]1^2) x[t],
g \[Alpha] + \[Alpha] (\[Omega]1^2 (y[t] + y1[t]) + (
y1^\[Prime]\[Prime])[t]) == \[Alpha] \[Omega]1^2 (2 L + L1 +
2 x[t]) + 2 \[Zeta] \[Omega]0 Derivative[1][y][t] -
2 \[Zeta] \[Omega]0 Derivative[1][x][t]};
Simplify[eqnsc == eqnsb]


I have checked that when copying back the mess above into my notebook it still does not say True. Hopefully the picture is also helpful.

Version 13.0 for Windows Thanks

You better compare expressions, not equations. This can be done by subtracting the left side from the right side of the equations. Toward this aim you index the list of equations. As you want to compare all equations, the first index is "All". Then to get the right side of an equation, the index is "1". And to get the right side, the index is "2". Therefore:

eqnsc[[All, 1]] - eqnsc[[All, 2]] == eqnsb[[All, 1]] - eqnsb[[All, 2]]

True

• Sometimes it's helpful to change equations to expressions with equation /.Equal->Subtract Feb 23, 2023 at 11:57
• What about SubtractSides[eqn]? Feb 23, 2023 at 12:34
• I think this is an excellent suggestion and the one I will use first. Out of interest do you know why Simplify fails to work.
– Hugh
Feb 24, 2023 at 14:39
• I can not say with certainty, but I think Simplify is geared towards simplifying expressions not determining the truth of a equation. Feb 24, 2023 at 15:53

# SubtractSides with a single argument

I would use SubtractSides with a single argument as a shorter, easier to understand and equally effective alternative.

SubtractSides[eqnsc] == SubtractSides[eqnsb]
(* True *)


or equivalently

Equal @@ SubtractSides/@{eqnsc,eqnsb}
(* True *)


or

Equal @@ SubtractSides@{eqnsc,eqnsb}
(* True *)


## Issues

Sometimes you may need to wrap that inside Assuming and FullSimplify, or just Simplify

Equal@@  SubtractSides@{2 a == 4, 1 == a-1}
(* (-4+2 a == 0) == (2-a == 0) *)


but

Simplify [
Equal@@  SubtractSides@{2 a == 4, 1 == a-1}
]
(* True *)


## Documentation

From the documentation for SubtractSides

SubtractSides[rel] subtracts the right-hand side of rel from each side, producing a zero right-hand side.

• A very good suggestion. I will use this. Out of interest do you know why Simplify does not work?
– Hugh
Feb 24, 2023 at 14:41
• @Hugh What do you mean exactly when you say it doesn't work? Feb 24, 2023 at 14:42
• I mean Simplify does not come back with True or False. Instead it generates an equation. However, since the original equation has an== It should come back with True or False and does so with less complicated examples.
– Hugh
Feb 24, 2023 at 14:47
• @Hugh, Consider this equations: {2 a == 4,1 == a-1}. Do you say (2 a == 4)==(1 == a-1) is True? Feb 24, 2023 at 14:49
• You have a point there. I have used the Simplify construction often in the past for moving terms around and it has worked for me. Your example is clearly going further and you are correct; I would not expect that to work. I guess there must be a threshold whereby simply moving terms around cannot be checked without solving. Thanks.
– Hugh
Feb 24, 2023 at 15:01

First, a small note: I guess that this: (y1^\[Prime]\[Prime])[t] stays in your expression for the second derivative. If you mentioned that, it is incorrect. Use please y1''[t]. If, in contrast, you intended to introduce a new variable, y1 with two primes, it will be misleading since it looks like a second derivative, but it is not. For this reason, in two places, I corrected (y1^\[Prime]\[Prime])[t] for y1''[t].

eqnsb = {g + (\[Omega]0^2 + \[Alpha] \[Omega]1^2) y[
t] + \[Alpha] \[Omega]1^2 y1[t] +
2 \[Zeta] \[Omega]0 (-Derivative[1][x][t] + Derivative[1][y][t]) +
y''[t] ==
L \[Omega]0^2 + (2 L + L1) \[Alpha] \[Omega]1^2 + (\[Omega]0^2 +
2 \[Alpha] \[Omega]1^2) x[t],
g \[Alpha] +
2 \[Zeta] \[Omega]0 Derivative[1][x][
t] + \[Alpha] (\[Omega]1^2 (y[t] + y1[t]) +
y1''[t]) == \[Alpha] \[Omega]1^2 (2 L + L1 + 2 x[t]) +
2 \[Zeta] \[Omega]0 Derivative[1][y][t]}

eqnsc = {g + (\[Omega]0^2 + \[Alpha] \[Omega]1^2) y[
t] + \[Alpha] \[Omega]1^2 y1[t] +
2 \[Zeta] \[Omega]0 (-Derivative[1][x][t] +
Derivative[1][y][t]) + y''[t] ==
L \[Omega]0^2 + (2 L + L1) \[Alpha] \[Omega]1^2 + (\[Omega]0^2 +
2 \[Alpha] \[Omega]1^2) x[t],
g \[Alpha] + \[Alpha] (\[Omega]1^2 (y[t] + y1[t]) +
y1''[t]) == \[Alpha] \[Omega]1^2 (2 L + L1 + 2 x[t]) +
2 \[Zeta] \[Omega]0 Derivative[1][y][t] -
2 \[Zeta] \[Omega]0 Derivative[1][x][t]};


Second, it is better not to move terms "by hand." You may comfortably use the commands AddSides and SubtractSides. For example, the operation that you described in your question one makes using the following expression:

SubtractSides[eqnsb[[2]], eqnsb[[2, 1, 2]]]

(* g \[Alpha] + \[Alpha] (\[Omega]1^2 (t^2 + y[t]) + (
y1^\[Prime]\[Prime])[t]) == \[Alpha] \[Omega]1^2 (2 L + L1 +
2 x[t]) - 2 \[Zeta] \[Omega]0 Derivative[1][x][t] +
2 \[Zeta] \[Omega]0 Derivative[1][y][t]   *)


Equal @@
Subtract, {List @@ eqnsb[[2]],
List @@ SubtractSides[eqnsb[[2]], eqnsb[[2, 1, 2]]]}]

(*  True  *)


It is not as good as the one of @Daniel Huber, though.

Have fun!

• Thanks Alexei. In my code I do use forms like y''[t] and y1''[t]. However, when I post it gets messed up into the form you see above. Is there a way to prevent this happening? Thanks for your suggestions on the main problem. Useful ideas.
– Hugh
Feb 24, 2023 at 14:36
• @Hugh It is probably related to some peculiarity of the system you use. If at your computer it is Ok, let it be. To publish at StackExchange you might use Derivative[2][y][t] instead. Feb 24, 2023 at 16:02
• Thanks. I was hoping that it returned to y''[t] when people pasted it into their notebooks. Does this happen to you? I use an ordinary Windows system. If it does not return to y''[t] then this may be a matter for Stackexchange or Mathematica.
– Hugh
Feb 24, 2023 at 16:12
• @Hugh I have Win10, Mma13.2. Indeed, after I copy-pasted it into my notebook, it looked like y''[t]. However, I tried, if this is really derivative. To do this, I first defined y[t_]:=t^2, then copy-pasted your expression looking as y''[t] and evaluated it. It did not return any result. In contrast, it returned y''[t], as if this is an expression unknown to Mma. It is for this reason that I have written in my answer, that the use of such an expression is misleading. Feb 24, 2023 at 19:03
• Interesting. So am I correct in thinking that either, Mathematica or stackexchange is making a poor translation?
– Hugh
Feb 24, 2023 at 20:58