The factors of constant term in f(x) are $\pm1,\pm2,\pm3,\pm4,\pm6$ and $\pm12.$
We have,
f(1) = 1 - 2 - 7 + 8 + 12 = 12
⇒ (x - 1) is not a factor of f(x)
f(-1) = 1 + 2 - 7 - 8 + 12 = 0
⇒ (x + 1) is a factor of f(x)
f(2) = 16 - 16 - 28 - 16 + 12 = 0
⇒ (x - 2) is a factor of f(x)
f(-2) = 16 + 16 - 28 - 16 + 12 = 0
⇒ (x + 2) is a factor of f(x)
f(3) = 81 - 54 - 63 + 24 + 12 = 0
⇒ (x - 3) is a factor of f(x)
Since f(x) is a polynomial of degree 4. So, it cannot have more than 4 linear factors.
Thus, factors of f(x) are (x +1), (x - 2), (x + 2) and (x - 3).
Therefore,
f(x) = k(x + 1)(x + 2)(x - 2)(x - 3)
x4 - 2x3 - 7x2 + 8x + 12 = k(x + 1)(x + 2)(x - 2)(x - 3) ...(1)
Putting x = 0 on both sides, we get,
12 = k(1)(2)(-2)(-3)
12 = 12k
k = 1
Substituting k = 1 in (1), we get,
x4 - 2x3 - 7x2 + 8x + 12 = k(x + 1)(x + 2)(x - 2)(x - 3)






