I'm trying to reduce $f(x) = x^5 - x^4 - x^3 + x^2 + x$ in $F_3[X]$ in irreducible factors.
What I came up with was $(x^2 + x + 2)(x^2 - 2x + 2)(x)$
How I did it was I first found all the irreducible polynomials of degree $2$ in $F_3[X]$. Then I did long divisions on $f(x)$ with one of the polynomials I found (brute force), until found a factor. Which was $x^3 - 2x^2 + 2x$. Dividing it by $x$ gives $x^2 - 2x + 2$. And that's how I found the factors.
Is this a correct solution to the question? I'm especially having doubts about the last part of my solution where I just divide it by X. Hopefully this is okay to ask here.
Your answer is correct.
Note that it might be easier to start dividing by $X$ since you will have one factor out right away. Dividing by $X$ is fine; it's just dividing by a linear term $X-a$ where $a$ happens to be $0$.
Note also that $(X^2+X+2) = (X^2-2X+2)$ since $-2X=X \mod 3\ \ \ (*)$
What I would do: first divide by $X$. Then you have a polynomial of degree $4$, which can only be a linear factor times a polynomial of degree $3$, or $2$ polynomials of degree $2$. Note that you can find linear factors by checking if the degree $4$ polynomial has roots in $\mathbb{F}_3$; i.e. check for $-1,0,1$ if plugging it into $X^4-X^3-X^2+X+1$ gives $0$.
As you see, that is not the case, so this degree $4$ polynomial must be split into two polynomials of degree $2$.
You have written down all irreducible polynomials of degree $2$ in $\mathbb{F}_3$ which is a good plan. Doing long division or multiplying them together to see if it works out is the way to see if the factors you found are correct.
Edit: a clever side-note by Jyrki; the resulting polynomial of degree 4 could be irreducible. In that case, you had to check all combinations or long divisions of the 2nd degree polynomials to conclude that the polynomial of degree 4 does not factor and is therefore irreducible. In this example, it's not the case.
Note that by $(*)$, you can write that $f(X) = (X)(X^2+X+2)^2$