# Simplification of Integrals with different limits

Is there a way to coerce Mathematica to join two integrals (with the same integrand) together? The simplest case is:

Integrate[f[x], {x, 0, 1}] + Integrate[f[x], {x, 1, 2}]


Clearly, this should be equal to Integrate[f[x], {x, 0, 2}].

This arose in solving a linear differential equation:

sys = D[y[t], t] == a y[t] + b u[t];
DSolve[{sys, y[0] == 0}, y[t], t]


This is a nice answer, but if you look at the form, the expressions inside the two integrals are identical. Thus y[t] ought to simplify to

But I cannot seem to get Mathematica to join the two integrals together. I've tried Simplify, FullSimplify, Expand, under a variety of assumptions, but can't seem to find a way to convince Mathematica to join the two together.

For this one, a brute force method can work

Unprotect@Integrate;
Integrate/:Integrate[ft_,{K[1],1,0}]-Integrate[ft_,{K[1],1,t}]:=-Integrate[ft,{K[1],0,t}];
Protect@Integrate;


And now

sys = D[y[t], t] == a y[t] + b u[t];
sol = y[t] /. First@DSolve[{sys, y[0] == 0}, y[t], t]


You can change the above definition in the protect code, to make it more general, as I have hardcoded the limits for this specific problem.

• It always makes me nervous changing the definitions of built-in functions. Dec 4, 2017 at 23:31
• @bills I agree with you. But I do not know any other way. btw, Maple generates the short version directly. Here is screen shot !Mathematica graphics Dec 4, 2017 at 23:55
• @bills No risk, no fun! ;o) Dec 4, 2017 at 23:59