RSolve with integrations

I want to solve this question with Mathematica.

$$T_0(t)=c(t),\quad T_n(t)=a\int_0^t T_{n-1}(s)\, \mathrm{d}s+b(t).$$

Is it possible to solve $T_n(t)$ with RSolve? Or is there some other solution?

Here is my code:

RSolve[{T[n, t] == a Integrate[T[n - 1, s], {s, 0, t}] + b[t], T[0, t] == c[t]}, T[n, t], n]

• What did you try? What was the result? – m_goldberg Apr 28 '15 at 12:02
• @m_goldberg i.imgur.com/AsTKiSS.png – eccstartup Apr 28 '15 at 12:05
• Please don't post images or links to images. Post code properly formatted with markdown that people can copy from your post and work with. – m_goldberg Apr 28 '15 at 13:02
• RSolve[{T[n, t] == a Integrate[T[n - 1, s], {s, 0, t}] + b[t], T[0, t] == c[t]}, T[n, t], n] – eccstartup Apr 28 '15 at 13:05
• Please provide sample expressions for b and c. – bbgodfrey Apr 29 '15 at 1:39

RSolve cannot handle this problem due to the integrals, although one could imaging discretizing the integrals, if c[t] and b[t] are smooth enough, and attempting to use RSolve on the resulting two-dimension recurrence relation.

However, the problem can be solved analytically by assuming that T[n_, t_] takes the form Integrate[g[n, t, t1] c[t1] + h[n, t, t1] b[t1], {t1, 0, t}] and deriving g and h inductively. After some algebra, the resulting expression is obtained.

T[n_, t] := a Integrate[c[t1] (a (t - t1))^(n - 1)/(n - 1)!, {t1, 0, t}] +
If[n > 1, a Integrate[b[t1] Exp[a (t - t1)] Gamma[n - 1, a (t - t1)]/(n - 2)!,
{t1, 0, t}], 0] + b[t]


This formulation can be compared with a direct evaluation of T[n_, t_], based on the expressions in the Question.

T[0, t_] := c[t]
T[n_, t_] := a Integrate[T[n - 1, t1], {t1, 0, t}] + b[t]


With sample functions,

c[t_] = Sin[t];
b[t_] = Exp[-t];


both formulations yield, for instance,

T[3, t]
(* E^(-t) + a*(1 + a*t + (a^2*t^2)/2 + a^2*(-1 + Cos[t]) +
a*(-1 + Cosh[t]) - Cosh[t] + Sinh[t] - a*Sinh[t]) *)


I have verified the equality of the two representations up to n = 20.

To prove formally that the first expression given above, as requested by the OP, begin with b[t] equal to zero and assume that T[n, t] is given by

a Integrate[c[t1] (a (t - t1))^(n - 1)/(n - 1)!, {t1, 0, t}]


Then, according to the equation in the Question, T[n+1, t] is obtained by a second integration

a^2 Integrate[c[t2] (a (t - t1))^(n - 1)/(n - 1)!, {t1, 0, t}, {t2, 0, t1}]


Next, reverse the order of integration.

a^2 Integrate[c[t2] (a (t - t1))^(n - 1)/(n - 1)!, {t2, 0, t}, {t1, t2, t}]
(* a^2*Integrate[((a*(t - t2))^n*c[t2])/(a*Gamma[1 + n]), {t2, 0, t}] *)


which after simplification becomes

(* a*Integrate[((a*(t - t2))^n*c[t2])/n !, {t2, 0, t}] *)


This is identical to the original expression in this Addendum but with n replaced by n + 1. Thus, if the original expression is true for any given n, it is true for all larger n. Now, set n -> 1 in the original expression.

(* a Integrate[c[t1], {t1, 0, t}] *)


which agrees with the equation in the Question and therefore also is true. Hence, the original expression in the Addendum is true for all n > 0.

Next, consider the effect of b[t]. According to the equations in the Question, T[1, t] becomes

a Integrate[c[t1] ((a (t - t1))^(n - 1)/(n - 1)!)/.n -> 1, {t1, 0, t}] + b[t]


Similarly, T[2, t] becomes

a Integrate[c[t1] ((a (t - t1))^(n - 1)/(n - 1)!)/.n -> 2, {t1, 0, t}] +
a Integrate[b[t1] ((a (t - t1))^(n - 1)/(n - 1)!)/.n -> 1, {t1, 0, t}] + b[t]


and T[3, t]

a Integrate[c[t1] ((a (t - t1))^(n - 1)/(n - 1)!)/.n -> 3, {t1, 0, t}] +
a Integrate[b[t1] ((a (t - t1))^(n - 1)/(n - 1)!)/.n -> 2, {t1, 0, t}] +
a Integrate[b[t1] ((a (t - t1))^(n - 1)/(n - 1)!)/.n -> 1, {t1, 0, t}] + b[t]


etc. The integrands of the ever-growing number of integrals over b[t] can be summed formally according to the formula

Sum[x^i/i!, {i, 0, n - 1}]
(* (E^x*Gamma[n, x])/Gamma[n] *)


which completes the proof that first expression in the original answer is formally correct. Of course, the constructive proof given yesterday also is compelling: it visibly gives the correct result for each n.

• Is T[n_, t] solved by Mathematica of by hand? – eccstartup Apr 30 '15 at 14:32
• Both representations of T[n_, t_]  are in Mathematica code and can be solved using Mathematica. Indeed, I have done so. Please try them out and let me know what you think. – bbgodfrey Apr 30 '15 at 14:42
• T[n_,t_] is working, but this may not be what I need. Because I want n there. T[n_,t] can be a possible answer, but I didn't see how you got it, for example, after some algebra. – eccstartup Apr 30 '15 at 15:04
• Also, I don't agree with you on T[n_,t]. Maybe there is some mistake. There will be a $\int_0^{t_1}\int_0^{t_2}\cdots\int_0^{t_n}c(t_n)\, \mathrm{d}t_n \cdots \mathrm{d}t_2\mathrm{d}t_1$ term. – eccstartup Apr 30 '15 at 15:26
• The Addendum just added provides the formal inductive proof you requested. The key step is to reverse the order of integration, as shown. Doing so is a standard trick that often (although certainly not always) simplifies nested integrals. In fact, all integrals except one can be eliminated in this way in the present case, if you choose to nest the integrals as you did in an earlier Comment. – bbgodfrey May 1 '15 at 3:19