\(1^2+2^2+3^2...+n^2=1+2\left(1+1\right)+3\left(2+1\right)+...+n\left(n-1+1\right)\\ =1+1\cdot2+2+3\cdot2+3+...+n\left(n-1\right)+n\\ =\left(1+2+3+...+n\right)+\left[1\cdot2+2\cdot3+...+n\left(n-1\right)\right]\)
Ta có \(1\cdot2+2\cdot3+...+n\left(n-1\right)\)
\(=\dfrac{1}{3}\left[1\cdot2\cdot3+2\cdot3\cdot3+...+3n\left(n-1\right)\right]\\ =\dfrac{1}{3}\left[1\cdot2\left(3-0\right)+2\cdot3\left(4-1\right)+...+n\left(n-1\right)\left(n+2+n+1\right)\right]\\ =\dfrac{1}{3}\left(1\cdot2\cdot3-1\cdot2\cdot3+2\cdot3\cdot4-...-\left(n-2\right)\left(n-1\right)n+\left(n-1\right)n\left(n+1\right)\right)\\ =\dfrac{\left(n-1\right)n\left(n+1\right)}{3}\)
\(\Rightarrow1^2+2^2+...+n^2=\dfrac{n\left(n+1\right)}{2}+\dfrac{\left(n-1\right)n\left(n+1\right)}{3}\\ =\dfrac{3n\left(n+1\right)+2n\left(n-1\right)\left(n+1\right)}{6}=\dfrac{n\left(n+1\right)\left(3+2n-2\right)}{6}\\ =\dfrac{n\left(n+1\right)\left(2n+1\right)}{6}\)