The problem statement is as follows: Let $f: [0, 2]\to \mathbb R_{+}$ be defined by $f(t)=m(\{x\in [0, \pi]: t\leq 1+\cos (3x)\leq 3t\}).$ Compute $\int_0^2 f(t)\,dt$.
I'm not certain how to begin understanding this function other than solving the inequality and finding lengths of resulting solution intervals. This doesn't seem to lead to any nice pattern. Is there a fundamental theorem for Lebesgue integrals? What should I do?
By Fubini-Tonelli, we can interchange the order of integration as follows:
$$\begin{align*} \int_0^2 f(t)\mathsf dt &= \int_0^2 m(\{x\in[0,\pi]: t\leqslant 1 + \cos(3x) \leqslant 3t\} \mathsf dt\\ &= \int_0^2 \int_0^\pi \chi_{\{t\leqslant 1 + \cos 3x\leqslant 3t\}}(x)\mathsf dx\,\mathsf dt\\ &= \int_0^\pi \int_0^2 \chi_{\{t\leqslant 1 + \cos 3x\leqslant 3t\}}(t)\mathsf dt\,\mathsf dx. \end{align*}$$ Now, we have $0\leqslant t\leqslant 2$ and $t\leqslant 1+\cos3x\leqslant 3t$. Since $0\leqslant 1+\cos3x\leqslant2$ for any $x$, this is equivalent to $$\frac13(1+\cos3x)\leqslant t \leqslant 1+\cos3x.$$ Hence the integral is equal to $$ \int_0^\pi\int_{\frac13(1+\cos3x)}^{1+\cos3x}\mathsf dt\,\mathsf dx = \int_0^\pi \frac23(1+\cos3x)\mathsf dx = \frac{2\pi}3. $$