A question on polynomial (Divide a polynomial function)

When a polynomial $$f(x)$$ is divided by $$(x-2),$$ the remainder is $$7$$. When $$f(x)$$ is divided by $$(x+1)$$ the remainder is $$-2$$.

(a) If the remainder is $$px+q$$ when $$f(x)$$ is divided by $$(x-2)(x+1)$$, find the values of $$p$$ and $$q$$.

(b) Find the remainder when $$f(x+3)$$ is divided by $$(x+1)(x+4)$$

I found the values of $$p$$ and $$q$$ which are $$3$$ and $$1$$ by using remainder theorem.
$$f(x)=Q(x)*(x-2)(x+1)+(px+q)$$

However I don't know how to get the remainder of part(b).

Let $$g(x)=f(x+3)$$. When $$g(x)$$ is divided by $$(x+1)$$, the remainder
$$=g(-1)$$
$$=f(-1+3)$$
$$=f(2)$$

When $$g(x)$$ is divided by $$(x+4)$$, the remainder
$$=g(-4)$$
$$=f(-4+3)$$
$$=f(-1)$$

At this point, since the two remainders I got are the same when $$f(x)$$ is divided by $$(x-2)$$ and $$(x+1)$$,
I assume $$f(x+3)=Q(x)*(x+1)(x+4)+(px+q)$$.
But $$3x+1$$ is not the answer.
What mistakes have I made and how to solve part(b)?

• Welcome to MSE. Please use MathJax to format your posts. You'll get a lot more help if your posts are easy to read. May 26 '19 at 13:24
• Just replace $x$ by $x+3$ in the equation that you got in the first part. It becomes $f(x+3)=Q(x+3)(x+1)(x+4)+p(x+3)+q$. Since the degree of $p(x+3)+q$ is smaller than the degree of $(x+1)(x+4)$, then the remainder of dividing $f(x+3)$ by $(x+1)(x+4)$ is $p(x+3)+q$. May 26 '19 at 13:26

Hint  Simply shift $$\,x\to x\!+\!3\,$$ in the prior division with remainder, i.e.
Lemma $$\,\ f(x\!+\!a)\bmod g(x\!+\!a)\, = \,(f\bmod g)(x\!+\!a)$$
Proof $$\,\ f = gh + r,\ \deg r < \deg g,\ \ r = (f\bmod g),\$$ by Euclidean Division wtih Remainder
hence $$\ f(x\!+\!a) = g(x\!+\!a)h(x\!+\!a) + r(x\!+\!a),\,\ \deg r(x\!+\!a) = \deg r < \deg g =\deg g(x\!+\!a)$$
therefore $$\ f(x\!+\!a)\bmod g(x\!+\!a) \,=\, r(x\!+\!a)\$$ by the uniqueness of the remainder.
Remark  Your argument doesn't work because - though the remainders are the same - they are at different (shifted) points, i.e. $$\,g(-1) = f(2) =7\,$$ and $$\, g(-4) = f(-1) = -2,\,$$ i.e. the line $$\, r(x+3)\,$$ is a shifted version of the line $$\,r(x) = 3x+1\,$$ While they take the same values at the corresponding shifted points, they are different lines.