Let $g$ be a non-negative measurable function. For $1 \leq p < \infty$, show that $$\int g(x)^p d\mu = \int_0^\infty p t^{p-1} m_g(t) dt$$ where $\mu$ is the Lebesgue measure and we are given $$m_g(t) = \mu\{x | g(x) > t \}.$$
Attempt
The first thing I did is show that $$\int g(x) d\mu = \int_0^\infty m_g(t) dt$$ by creating a suitable simple function to approximate the right hand side and showing that it in fact equals the left hand side when we take the $\sup$ over all such simple functions. In attempting to show something similar for $g(x)^p$, note that for $t_i > t_{i+1}$ $$m_{g^p}(t_i^p) - m_{g^p}(t_{i+1}^p) = m_g(t_i) - m_g(t_{i+1})$$ since $$ t_{i+1} < g(x) \leq t_i \iff t_{i+1}^p < g(x)^p \leq t_i^p.$$
However, how do we achieve the $p t^{p-1}$ term on the right-hand side?