The rational root theorem suggests the following possible rational roots:
22, -22, 11, -11, 2, -2, 1, -1
(obtained by dividing all divisors of the constant term, 22, by the coefficient of the leading term, 1). Checking all of these possibilities, we happen to find that [tex]f(-2)=f(-1)=0[/tex].
By the polynomial remainder theorem (if [tex]p(c)=0[/tex] for some polynomial [tex]p(x)[/tex], then [tex]x-c[/tex] divides [tex]p(x)[/tex]), we then know that [tex]x+2[/tex] and [tex]x+1[/tex] are factors.
Performing the division gives
[tex]\dfrac{x^4-3x^3-5x^2+21x+22}{(x+2)(x+1)}=x^2-6x+11[/tex]
The remaining quadratic has discriminant
[tex]\Delta=(-6)^2-4(1)(11)=-8<0[/tex]
which means the remaining two terms are complex and the quadratic cannot be factored any further (over the real numbers). So
[tex]x^4 - 3 x^3 - 5 x^2 + 21 x + 22=(x+2)(x+1)(x^2-6x+11)[/tex]