If those are factors, then x=-1 and x=2 are roots of the expression. This means at these x values, the expression is zero.
(-1)4 + p(-1)3 + 5(-1)2 + 5(-1) + q = 0
4 - p + 5 - 5 + q = 0
-p + q = -4 eq1
34 + p(3)3 + 5(3)2 + 5(3) + q = 0
81 + 27p + 45 + 15 + q = 0
27p + q = -141 eq2
Solve for p and q from the system of equations. This is the factor theorem.
According to the reminder theorem, if the remainder is zero, then (x+1) and (x-3) are factors.
Q(x + 1) = x4 + px3 + 5x2 + 5x + q eq1
Q(x + 3) = x4 + px3 + 5x2 + 5x + q eq2
where Q is the arbitrary quotient
What this process means is multiply the quotient by the factor and add it to the remainder to get the expression.
If we substitute eq1 into eq2 to replace Q in eq2, we get
[(x4 + px3 + 5x2 + 5x + q) / (x + 1)](x + 3) = x4 + px3 + 5x2 + 5x + q
Multiply both sides of the equation by (x+1).
(x4 + px3 + 5x2 + 5x + q)(x + 3) = (x4 + px3 + 5x2 + 5x + q)(x + 1)
Expand each side of the equation. Once you've done that, equate coefficients.