# Double integral, variables as limits, unknown function as integrand

How do I get from $\int_{x_0}^{x} \int_{x_0}^{t}f(s)ds dt$ to $[t\int_{x_0}^tf(s)ds]|^x_{x_0} - \int_{x_0}^x tf(t)dt$?

At least, that's what it looks like from the brief solution given in my book. I've filled two pages with scrawls and scribbles and I still can't figure out the logic that goes behind the working! Why is it a minus? Why are the terms composed this way?

I think the first term, $[t\int_{x_0}^tf(s)ds]|^x_{x_0}$, is derived by taking the inner integral as a constant term wrt t, hence the inner integral is multiplied by a t, and the product is then computed from $x_0$ to $x$ to get $x\int_{x_0}^xf(t)dt$. But even if I understand how the term is derived, I still wouldn't know how to explain why we do this step if I had to explain to another student.

I don't understand how to derive the second term. Is the minus sign because the inner integral goes from $x_0$ to $t$? Would it be a plus if it went from $t$ to $x_0$? And then there's the composition of terms in $\int_{x_0}^x tf(t)dt$, how do I get that? Why are they like that? Arghh!

My patchy understanding at this moment is that in the first term I handle/solve the outer integral by fixing the contents as constant and computing the anti-derivative from $x_0$ to $x$. Then in the second term I retain the outer integral while I handle the inner integral. But the problem with my understanding is that when given another problem, I still second guess my working (and they turn out wrong) :( Help please?

-

$$\int_{x_0}^{x} \color{Purple}{\int_{x_0}^{t}f(s)ds} dt$$

Use by-parts integration on the outer integral. Set $u=\int_{x0}^{t}f(s)ds$ and $v=t$. We obtain

$$\int_{x_0}^x u(t) dv=[u(t)v(t)]_{x_0}^x-\int_{x_0}^xv(t)du.$$

Along with $du=u'(t)dt=f(t)dt$, we find the latter integral is $\int_{x_0}^x tf(t)dt$.

Note that by-parts integration comes from the product rule and fundamental theorem of calculus:

$$[uv]_a^b = \int_a^b \frac{d}{dt}(uv)dt=\int_a^b u'(t)v(t)+u(t)v'(t)dt=\int_a^b vdu+\int_a^b udv.$$

Subtract out $\int_a^b vdu$ from the RHS and we have the by-parts formula.

-