Ta có: \(M=\dfrac{x^5+3x^3-x^2+3x-7}{x^2+2}\)
\(=\dfrac{x^5+2x^3+x^3+2x-x^2-2+x-5}{x^2+2}\)
\(=\dfrac{x^3\left(x^2+2\right)+x\left(x^2+2\right)-\left(x^2+2\right)+\left(x-5\right)}{x^2+2}\)
\(=\dfrac{\left(x^2+2\right)\left(x^3+x-1\right)+\left(x-5\right)}{\left(x^2+2\right)}\)
\(=x^3+x-1+\dfrac{x-5}{x^2+2}\)
Để M nguyên thì \(x-5⋮x^2+2\)
\(\Leftrightarrow\left(x-5\right)\left(x+5\right)⋮x^2+2\)
\(\Leftrightarrow x^2-25⋮x^2+2\)
\(\Leftrightarrow x^2+2-27⋮x^2+2\)
mà \(x^2+2⋮x^2+2\)
nên \(-27⋮x^2+2\)
\(\Leftrightarrow x^2+2\inƯ\left(-27\right)\)
\(\Leftrightarrow x^2+2\in\left\{1;-1;3;-3;9;-9;27;-27\right\}\)
\(\Leftrightarrow x^2+2\in\left\{3;9;27\right\}\)(Vì \(x^2+2\ge2\forall x\))
\(\Leftrightarrow x^2\in\left\{1;7;25\right\}\)
hay \(x\in\left\{1;-1;\sqrt{7};-\sqrt{7};5;-5\right\}\)
Vậy: Để M nguyên thì \(x\in\left\{1;-1;\sqrt{7};-\sqrt{7};5;-5\right\}\)