# Including definite integrals inside definite integrals - Crossposted from MathSE

This question is cross-posted from MathSE: link

I have the following differential equation from a journal article:
$\dot{g}(t) - \delta(t)g(t) = -H(t) --- (1)$,
which is integrated between t and T. t is time and T is a terminal (scaler) time point. The functions are implicitly defined on time (t).

The solution I have (from the same article, no steps shown) is:

$g(t) = g(T)e^{-\int_t^T \delta(u) du} + \int_t^T H(u)e^{-\int_t^u \delta(s) ds} du --- (2)$

I understand that the solution is obtained by using the integrating factor:
$IF = e^{\int_t^T \delta(u) du}$.
This means that in the penultimate step of the solution, I will have something like $g(t) = g(T)e^{-\int_t^T \delta(u)du} + e^{-\int_t^T \delta(u) du} \int_t^T H(u) e^{\int_u^T \delta(s)ds} du --- (3)$

If (3) gives (2), then it must be true that

$e^{-\int_t^T \delta(u) du} \int_t^T H(u) e^{\int_u^T \delta(s)ds} du = \int_t^T H(u) e^{-\int_t^u \delta(s)ds} du --- (4)$

with the understanding that u is considered to be a future time point relative to t.

What I do not understand is the exact reason why (4) is correct. From my understanding one possible explanation could be that the first term on the left hand side of 4 is implicitly a function of t which is why it can be included under the integral of the second term on the left hand side where the functions are being integrated between two values of t, namely t and T. But I am unsure if this is an accurate way of describing this.

Is there a theorem/result that supports/invalidates my way of thinking and is there a way to explain (4)?

The paper in question is A Model of the Demand for Longevity and the Value of Life Extension. The equation and the solution are numbered (17) and (18) respectively. I am presenting those here without some of the extra terms.

Clarification on the numberings in the question:

The numberings (1)-(4) in the question are mine. (1) in the question is a simplified version of (17) in the paper and (2) in the question is a simplified version of (18) in the paper.