\(M=\dfrac{n^3+2n^2-1}{n^3+2n^2+2n+1}\)
\(=\dfrac{n^3+n^2+n^2+n-n-1}{\left(n+1\right).\left(n^2-n+1\right)+2n.\left(n+1\right)}\)
\(=\dfrac{n^2\left(n+1\right)+n\left(n-1\right)-\left(n+1\right)}{\left(n+1\right).\left(n^2-n+1+2n\right)}\)
\(=\dfrac{\left(n+1\right).\left(n^2+n-1\right)}{\left(n+1\right).\left(n^2+n+1\right)}\)
\(=\dfrac{n^2+n-1}{n^2+n+1}\)