I was wondering why I fail to substract two equations using thread, while it works properly, as described here for additions.

Example: Let a system of equations be given:

eq1 = a + b == c
eq2 = a - b == c

I can add both equations (1) + (2) using using Thread:

Thread[eq1 + eq2, Equal]

which gives the correct result:

a == c

However, when I substract the two eqations (1)-(2) via

Thread[eq1 - eq2, Equal] 

I get

a + b - (a - b == c) == c - (a - b == c) 

and simplifying it gives me the first equation.

a + b == c

Can anyone tell me why Thread does not work with a minus sign? Sorry if this is a trivial question.

  • 1
    $\begingroup$ You could use SubtractSides[eq1, eq2]. $\endgroup$ – b.gates.you.know.what Nov 21 '18 at 11:07
  • $\begingroup$ Thanks, that solves the problem more efficiently. It also works if I multiply the equation by -1 via Thread[eq1*-1,Equal] and add it via Thread, but I was wondering why Thread fails. $\endgroup$ – Paul Saturday Nov 21 '18 at 11:25
  • $\begingroup$ By entering Subtract[eq1, eq2] // FullForm you see that it actually evaluates to Plus[eq1,Times[-1,eq2]], and the effect is that the equation will be multiplied by -1 and the threading operates again on the outer Plus part, which gives the result you see. $\endgroup$ – Thies Heidecke Nov 21 '18 at 13:02

Your Answer

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

Browse other questions tagged or ask your own question.