If we have a measure space $(X,\mathcal{A},\mu)$ and are given a measurable $f$ which satisfies $f\in L_p$ for all $p\in (1,\infty)$ and $$\int |f|^p\,\mathrm{d}\mu=\int |f|^q\,\mathrm{d}\mu, \ \forall p,q\in(1,\infty) $$
Show that $f=\chi_A-\chi_B$ for two $A,B\in\mathcal{A}$. The $\chi$ denotes the indicator function.
This should be easy, because the conditions are so strict, but somehow I can not seem to make progress.
What I have tried is going from $$\int |f|^p-|f|^q\,\mathrm{d}\mu=0$$ and using the fact that $p,q$ are conjugate to get expressions like $$\int |f|^q(1-|f|^{\frac{1}{q-1}})\,\mathrm{d}\mu=0$$
but these attempts seem to get me nowhere. A little help would be appreciated, as I think I am completely on the wrong track.
The assertion is equivalent to showing that $f$ takes only the values $0$, $1$ and $-1$ (up to a $\mu$-null set).
Suppose that $\mu(|f|>1)>0$, then there exists $\epsilon>0$ such that $\mu(|f| \geq 1+\epsilon)>0$. Then $$\int |f|^n \, d\mu \geq \int_{\{|f| \geq 1+\epsilon\}} |f|^n \, d\mu \geq (1+\epsilon)^n \mu(|f| \geq 1+\epsilon) \xrightarrow[]{n \to \infty} \infty,$$ which contradicts the fact that, by assumption, $\sup_{n \geq 2} \int |f|^n \, d\mu=\int |f|^2 \, d\mu< \infty$. Hence, $\mu(|f|>1)=0$, i.e. $|f| \leq 1$ $\mu$-almost everywhere.
Now suppose that $\mu(0 < |f| < 1)>0$. Then $|f|^3$ is strictly smaller than $|f|^2$ on a set of positive measure and therefore
\begin{align*} \int |f|^2 \, d\mu &= \underbrace{\int_{|f|=1} |f|^2 \, d\mu}_{=\int_{|f|=1} |f|^3 \, d\mu} + \underbrace{\int_{0<|f|<1} |f|^2 \, d\mu}_{> \int_{0<|f|<1} |f|^3 \, d\mu} \\ &> \int |f|^3 \, d\mu,\end{align*}
which contradicts our assumption that $\int f^2 \, d\mu = \int |f|^3 \, d\mu$. In conclusion, $f$ takes the values $0$, $1$ and $-1$ $\mu$-almost everywhere. If we set $A=\{f=1\}$ and $B=\{f=-1\}$, then $f=1_A-1_B$ $\mu$-a.e.