Application of Fatou's lemma to show that a function is the characteristic of some measurable set I need some help solving this problem:
Let $(X,\mathcal{M},\mu)$ be a measure space and $f:X\mapsto[0,\infty]$ be a $\mu-$measurable function such that there exists $C\geq0$ such that $$\int_X(f(x))^nd\mu(x)=C,\;\text{for each }n\geq1$$
I'm asked to show that there exist a measurable set $E$ such that $f=\chi_E$ almost everywhere.
My idea was to show that the sets $A=\{x\in X|f(x)>1\}$ and $B=\{x\in X|f(x)\in(0,1)\}$ have measure 0, so the function only takes values 0 and 1 a.e. and then I could take $E=f^{-1}(1)$ which will be measurable because $f$ is measurable and $f=\chi_E$ a.e.
We're told to use Fatou's lemma but I'm a bit lost. I think that we can say that $\mu(A)=0$ because for each $x\in A$ the sequence $(f(x)^n)$ is not bounded so the integral cannot be finite. And $\mu(B)=0$ because for $x\in B$ $(f(x)^n)$ tends to 0 so the function would be end up being 0 in $B$ because $f\geq 0$. But I don't know if it is a good start and how to prove it rigorously. Any hint?
Thanks for your help.
 A: Define $A_k := \{ x \in X \mid f(x) \geq 1+1/k\}$, then by assumption
$$C = \int_X f(x)^n \, \mu(dx) \geq \int_{A_k} f(x)^n \, \mu(dx) \geq \left(1+ \frac{1}{k} \right)^n \mu(A_k)$$
for any $n \in \mathbb{N}$. When we let $n \to \infty$, then the right-hand side converges to $\infty$ unless $\mu(A_k)=0$. Since we know that the right-hand side is bounded in $n$, we obtain that $\mu(A_k)=0$ for all $k \geq 1$. Hence, $\mu(\{f>1\}) = \mu(\bigcup_k A_k)=0$.
It remains to show that $\mu(\{0<f<1\})=0$.
Possibility 1: Since $f(x)^n \to 0$ for $x \in \{0<f<1\}$, it follows from the dominated convergence theorem that
$$\mu(\{f =1 \}) = \int_{0 \leq f \leq 1} \lim_{n \to \infty} f(x)^n \, \mu(dx) = \lim_{n \to \infty} \int f(x)^n \, \mu(dx)=C,$$
where we used that we know from our previous consideration that $f \in [0,1]$ almost everywhere. Thus $$C = \int f(x) = \underbrace{\int_{f=1}\, d\mu}_{=\mu(f=1)=C} + \int_{0<f<1} f(x) \, \mu(dx),$$ i.e. $\int_{0<f<1} f(x)\,\mu(dx)=0$, implying $\mu(\{0<f<1\})=0$.
Possibility 2: We prove this by contradiction. If the set $\{x \in X \mid f(x) \in (0,1)\}$ had strictly positve measure, then
$$\int f(x) \, \mu(dx) = \int_{0<f<1} f(x)\, \mu(dx) + \mu(\{f=1\})$$
would be strictly larger than
$$\int f(x)^2 \, \mu(dx) = \int_{0<f<1} f(x)^2 \, \mu(dx) + \mu(\{f=1\}),$$
contradicting the assumption that both integrals equal the constant $C$.
