How to prove this equality: $\int_0^x(x-t)e^{\cos t}dt=\int_0^x\bigg(\int_0^te^{\cos s}ds\bigg)dt$ I'm trying to show this equality is true:
$$\int_0^x(x-t)e^{\cos t}dt=\int_0^x\bigg(\int_0^te^{\cos s}ds\bigg)dt$$
I used the fundamental theorem of calculus without success. I need a hint how to solve this question.
 A: Let's switch the order of integration for the double integral on the right side. 
The current bounds are $0 \le t \le x$ and $0 \le s \le t$. This can be combined as $0 \le s \le t \le x$. So the bounds when integrating with respect to $t$ first are $0 \le s \le x$ and $s \le t \le x$. 
Therefore, $\displaystyle\int_0^x\left(\int_0^te^{\cos s}\,ds\right)\,dt$ $= \displaystyle\int_0^x\left(\int_s^xe^{\cos s}\,dt\right)\,ds$ $= \displaystyle\int_0^x(x-s)e^{\cos s}\,ds$. 
Now replace $s$ in the last integral with $t$.
A: Integrate by parts:
$$ \int_0^x (x-t) e^{\cos{t}} \, dt = \left[ (x-t)\int_0^t e^{\cos{s}} \, ds \right]_{t=0}^x - \int_0^x (-1) \int_0^t e^{\cos{s}} \, ds \, dt. $$
The first term vanishes at the endpoints, the second is what you want.
A: Consider
$$
F(x)=\int_0^x(x-t)e^{\cos t}\,dt=
x\int_0^xe^{\cos t}\,dt-\int_0^xte^{\cos t}\,dt
$$
Then, by the fundamental theorem of calculus,
$$
F'(x)=\int_0^xe^{\cos t}\,dt+xe^{\cos x}-xe^{\cos x}=
\int_0^xe^{\cos t}\,dt
$$
Compute the derivative of the right-hand side and then evaluate both at $0$.
A: Hint: Try to differentiate $(x-t)e^{cos t}$ with respect to $t$. :-)
