Calculate integral of fractional part I have to calculate $$I=\int _0^1\left\{nx\right\}^2dx , \:\:\:\:\: n \in \mathbb N, n \ge 1$$
Where {a} is $frac(a)$.
I know that $\left\{nx\right\}^2 = (nx - [nx])^2$ so 
$$I\:=\int _0^1\:\left(n^2x^2-2nx\left[nx\right]+\left[nx\right]^2\right)dx=\frac{n^2}{3}-2n\int _0^1\:x\left[nx\right]dx+\int _0^1\:\left[nx\right]^2dx$$ What can I do next ? In my mind, because $x \in [0, 1] \implies [nx] = 0$ but the final answer is $\frac{1}{3}$.

\begin{align}
   \lfloor nx \rfloor = m
   &\iff m \le nx < m+1 \\
   &\iff \dfrac mn \le x < \dfrac{m+1}{n} \\
\end{align}
Let 
\begin{align}
   I_m &= \int_{x=\frac mn}^{\frac{m+1}{n}}\{nx\}^2 dx \\
   &= \int_{x=\frac mn}^{\frac{m+1}{n}}(nx - m)^2 dx
   & \left(\text{Let $y = x - \dfrac mn$.}\right) \\
   &= n^2\int_{y=0}^{\frac 1n}y^2 dy \\
   &= \dfrac{1}{3n} \\
\end{align}
Then
\begin{align}
   I &= \int _0^1\left\{nx\right\}^2dx \\
   &=\sum_{m=0}^{n-1} I_m \\
   &=\dfrac 1n \sum_{m=0}^{n-1} \dfrac 13 \\
   &= \dfrac 13
\end{align}
