Showing that $\int^b_a(b-x)f(x)dx=\int^b_a(\int^x_afdt)dx$ by integration by parts. Problem: Show $\int^b_a(b-x)f(x)dx=\int^b_a(\int^x_afdt)dx$   by integration by parts.
Attempt:
For this to be true $(b-x) \int f(x)dx $ must be zero but I don't understand why.
 A: Hint. Just observe that
$$
\begin{align}
\left[(b-x) \int_a^x f(t)dt\right]_a^b&=(b-b) \int_a^b f(t)dt-(b-a) \int_a^a f(t)dt\\\\
&=0\times\int_a^b f(t)dt -(b-a) \times0\\\\
&=0.
\end{align}
$$
A: What the other answerers have done but not quite stated explicitly: Since you are calculating a definite integral, you need to evaluate the $uv$ term (of the by-parts formula) at $b$ and $a$. Similarly, don't leave out the bounds for the double integral.
A: $f(x)dx = d\left(\int_{a}^x f(t)dt\right) \to \int_{a}^b (b-x)f(x)dx = (b-x)\int_{a}^xf(t)dt|_{a}^b + \int_{a}^b(\int_{a}^x f(t)dt)dx = 0 + \int_{a}^b(\int_{a}^x f(t)dt)dx$
A: Put $u = b -x$, $dv = f(x)\,dx$.  Then $du = -dx$ and $dv = \int_a^x f(t)\,dt$.
Applying integration by parts
$$\int_a^b (b-x)f(x)\, dx = u(b)v(b) - u(a) v(a) + \int_a^b\int_a^x f(t)\,dt\,dx.
= \int_a^b\int_a^x f(t)\,dt\,dx$$
A: here is one way to show $$\int_a^b (b-x) f(x) \, dx = \int_a^b \left(\int_a^x f(t)\, dt\right) dx$$
observe that by the fundamental theorem of calculus $$ \text{ if } v = \int_a^x f(t) \, dt, \text{ then } \frac{dv}{dx} = f(x), v(a) = 0.$$
now, $$\begin{align} \int_a^b \left(\int_a^x f(t)\, dt\right) dx &= \int_a^b v(x) \,dx  = \int_a^b v(x) d(x-b) \\&= (x-b)v(x)\big|_a^b - \int_a^b(x-b) dv \\&= \int_a^b (b-x)f(x) \, dx\end{align}$$ 
