Reduction modulo p I am going to begin the Tripos part III at Cambridge in October (after going to a different university for undergrad) and have been preparing by reading some part II lecture notes. 
Here is an extract from some Galois theory notes:
'$f(X) = X^4 + 5X^2 − 2X − 3 = X^4 + X^2 + 1 = (X^2 + X + 1)^2$ (mod 2)
$f(X) = X^4 + 5X^2 − 2X − 3 =X^4 + 2X^2 + X = X(X^3 + 2X + 1)$ (mod 3) 
So f is irreducible, since f = gh implies deg g = 1 or deg g = 2, which is impossible by
reduction modulo 2 and 3, respectively.'
Could someone please explain the last sentence? Why is deg g=1 or 2 impossible by reduction modulo 2/3?
Thank you in advance.

First, note that if a polynomial $f$ is reducible, then you could witness these same factors modulo any prime. For instance, $x^2 - 1$ is reducible, and we see this mod 2: $(x+1)^2$ and mod 3: $(x+1)(x+2)$. Of course, it is possible that an irreducible factor of $f$ were further reduced mod $p$, for instance $x^2+1$ will appear as $(x+1)^2$ mod $2$.
Thus, if $f$ has an irreducible factor of degree $n$ it means that modulo any prime $p$ there must be a subset of the reducible factors such that the degree sum up to $n$.
In this particular case if $f$ were reducible, it would have a factor of degree $2$ or $3$. (Linear factors are easily found using the rational root test.(°)) But no subset of the irreducible factors mod $2$ sums up to $3$; whereas no subset of the degrees of the irreducible factors mod $3$ sums op to $2$. (°°) So this is impossible.

(°) As Mathmo123 writes in his answer: it is also clear from the factorization mod 2 that there could not be a linear factor. 
(°°) See the answer by André Nicolas for why the factors of $f$ are indeed irreducible.
