Let $f$ be a nonnegative Lebesgue measurable function on $[0, \infty)$ such that $\int_0^\infty f(x) dx < \infty$. Show that there exists a positive, nondecreasing, Lebesgue measurable function $\phi$ on $[0, \infty$ such that $\lim_{x\to\infty} \phi(x) = \infty$, and such that $\int_0^\infty \phi(x) f(x) dx < \infty$.
This problem is discussed here but I want to solve the problem by contructing $\phi$ explicitly.
We can write $[0, \infty) = \cup_{n=0}^{\infty} [n, n+1)$ and then define $\phi(x) = n$ for $x \in [n, n+1)$. But then I don't know how to prove that $\int_0^\infty \phi(x) f(x) dx < \infty$ or if my example of $\phi$ will actually work.
That example will not work, and any answer for $\phi$ you get must depend on $f$. For your example take $f(x) = \frac{1}{n^2}$ for $x \in [n, n + 1)$ (and $f(x) = 0$ for $x \in [0, 1)$). Then $$ \int_0^{\infty} \phi(x) f(x) \, \text{d}x = \sum_{n=1}^{\infty} \frac{1}{n} = \infty $$