I have got this sequence of function defined on the space $\Re_{[0,1]}$ with the integral metric. $n\in\mathbb{N}$ and $M\leq n$, $M=\sup f_n$
How can we know: $$\int_{0}^{\frac{1}{n^2}} (n-M) dx+\int_{\frac{1}{n^2}}^{\frac{1}{M^2}} \left(\frac 1x -M\right)dx \leq \int \left| f-f_n\right| dx$$ Given the fact the book presents this:
\begin{align}f:[0,1]&\to\mathbb{R}\\ x&\rightarrow\begin{cases}\frac{1}{\sqrt{x}}&\text{if }x\geq\frac{1}{n^2}\\ n&\text{otherwise}\end{cases}\end{align}
\begin{align}d(f,f_n)&=\int_0^1\left|f-f_n\right|\\ &\geq \int_0^{\frac{1}{M^2}}\left|f-f_n\right|\\ &\geq \int_{0}^{\frac{1}{n^2}}n-M\;dx+\int_{\frac{1}{n^2}}^{\frac{1}{M^2}}\frac{1}{\sqrt{x}}-M\;dx\\ &=\frac 1M - \frac 1n \end{align}