Suppose there is a matrix $\displaystyle A\in\mathbb{Q}$ that satisfies the polynomial $\displaystyle x^{3}+x^{2}-x-1$. Prove that 3 divides n.
1) There is no "n" in the given information.
2) It makes no sense to say that something "satisfies a polynomial". A number or matrix may satisfy a polynomial equation but you have no equation here. Do you mean "satisfies the polynomial equation $\displaystyle x^2+ x^2- x- 1= 0$"?
If $\displaystyle A^3+A^2-A+I = 0$ then the minimum polynomial of A must be a factor of $\displaystyle p(x) = x^{3}+x^{2}-x+1$. But that polynomial is irreducible over the rationals. Therefore p(x) must be the minimum polynomial of A. The factors of the characteristic polynomial of A must be the same as those of the minimum polynomial. But again, since p(x) is irreducible over $\displaystyle \mathbb{Q}$, it only has one factor, namely itself. Therefore the characteristic polynomial must be of the form $\displaystyle p(x)^k$ for some integer k. This has degree 3k, and so $\displaystyle A\in M_{3k}(\mathbb{Q})$, as required.
That naturally raises the question of whether there are any such matrices. In fact there are, and you can check that $\displaystyle B = \begin{bmatrix}1&1&0 \\ -1&-1&1 \\ 0&1&-1 \end{bmatrix}$ satisfies p(B)=0. The most general 3x3 matrix satisfying the equation would then be similar to B. In other words, it would be of the form $\displaystyle P^{-1}BP$, where P is any invertible matrix in $\displaystyle M_{3}(\mathbb{Q})$. In general, any matrix satisfying the equation would be similar to a direct sum of copies of B.