# Why doesn't Mathematica recognise two integrals as equal?

The following expression $$\int_{0}^{t} f(t_0) \,dt_0 - \int_{0}^{t} f(t_1) \,dt_1 = 0$$ is zero because it is just a change of integration variable.

Why doesn't Mathematica give zero in this case?

Integrate[f[t1],{t1,0,t}]-Integrate[f[t2],{t2,0,t}]

• Maple gives zero simplify(int(f(t1),t1=0..t)-int(f(t2),t2=0..t)) gives zero. So I think you are right, Mathematica should give zero. I tried both Simplify and FullSimplify. !Mathematica graphics may be there a trick to make it simplify it to zero Oct 31, 2023 at 11:21
• Mathematically it is zero, I believe the logic just hasn't been implemented in mathematica
– Luca
Oct 31, 2023 at 11:34
• You have to define what your f[x] is. Not all functions can be integrated, for example, Tan[x] is infinite when x=pi/2 Oct 31, 2023 at 11:36
• I have an application with many nested integrals, and this behaviour is just a prerequisite so that I can calculate some results in high order perturbation theory.
– Luca
Oct 31, 2023 at 11:58
• I agree. Mathematica understands many symbolic relations. The fact that an integral shouldn't depend on the name of the dummy variable should be fairly easy to spot. Oct 31, 2023 at 12:16

You have to tell what your function is. Mathematica cannot output undefined values, for example, the integral result is infinite in some interval.

f[x_] := Tan[x];
Integrate[f[t1], {t1, 0, \[Pi]/2}] - Integrate[f[t2], {t2, 0, \[Pi]/2}]


And

f[x_] := Tan[x];
Integrate[f[t1], {t1, 0, \[Pi]/3}] - Integrate[f[t2], {t2, 0, \[Pi]/3}]


You can compare the 2 results.

• "You have to tell what your function is. Mathematica cannot output undefined values"... this doesn't sound right? It can clearly turn f(x) - f(x) into 0 despite everything being undefined in that expression. Nov 1, 2023 at 7:23
• I believe here Mathematica is correct and Maple is wrong - if f were a function such that the integral is infinite, the difference should be indeterminate, not zero. So one cannot just simplify it to zero without assuming the integral is finite. Nov 5, 2023 at 19:20
FullSimplify[Integrate[f[t1], {t1, 0, t}] - Integrate[f[t2], {t2, 0, t}],
Assumptions -> t1 == t2]

(* 0 *)


Or if you encounter such situation mentioned in @Domen's comment:

expr = Integrate[f[t1], {t1, 0, t}] - Integrate[f[t2], {t2, 0, t}] +
t1 - t2;

expr /. Integrate[x_, {y_, z_, q_}] :>
Integrate[x /. y -> uniquename, {uniquename, z, q}]

(* t1 - t2 *)

• Just a note, one has to be quite careful here because this doesn't take into account the correct local scoping of integration variables. Namely, FullSimplify[Integrate[f[t1], {t1, 0, t}] - Integrate[f[t2], {t2, 0, t}] + t1 - t2, Assumptions -> t1 == t2] will give 0 instead of t1 - t2. Oct 31, 2023 at 13:57

This can be grounded in such a way (of course, assuming the existence of the integral Integrate][f[t2], {t2, 0, t}]):

Activate[IntegrateChangeVariables[Inactive[Integrate][f[t2], {t2, 0, t}], t1, t1 == t2]]


Integrate[f[t1], {t1, 0, t}]