Given $f(x)=ax^3-ax^2+bx+4$ Find the Value of $a+b$ Let $f(x)=ax^3-ax^2+bx+4$. If $f(x)$ divided by $x^2+1$ then the remainder is $0$. If $f(x)$ divided by $x-4$ then the remainder is $51$. What is the value of $a+b$?
From the problem I know that $f(4)=51$.
Using long division, I found that remainder of $\frac{ax^3-ax^2+bx+4}{x^2+1}$ is $a+b+x(b-a)$.
Then
$$a+b+x(b-a)=0$$
I can't proceed any further so I'm guessing the other factor of $f(x)$ is $ax+4$.
Then
$$f(x)=(ax+4)(x^2+1)=ax^3+4x^2+ax+4=ax^3-ax^2+bx+4$$
I found that $a=-4$ and $b=a=-4$. Then $f(x)=-4x^3+4x^2-4x+4$. But I doesn't satisfy $f(4)=51$

Let $a+b=c$.
Solving in pari/gp:
? lift(Mod(a*x^3-a*x^2+b*x+4,x^2+1))
%9 = (-a + b)*x + (a + 4)
?
? lift(Mod(a*x^3-a*x^2+b*x+4,x-4))
%10 = 48*a + (4*b + 4)
?
? polresultant(%9,a+b-c,a)
%11 = (-2*b + c)*x + (b + (-c - 4))
?
? polresultant(%10-51,a+b-c,a)
%12 = 44*b + (-48*c + 47)
?
? polresultant(%11,%12,b)
%13 = (52*c - 94)*x + (-4*c + 223)

Or in Wolfram.
I.e. $a+b=\dfrac{94x-223}{4(13x-1)}$.
If $x=4$ then $\begin{cases}4(b-a)+a+4=0\\48a+4b+4=51\end{cases} \Longrightarrow \begin{cases}a=1\\b=-1/4\end{cases} \Longrightarrow (a+b)\bigg|_{x=4}=\dfrac{3}{4}$.
Verifying: $(a+b)\bigg|_{x=4}=\dfrac{94\cdot 4-223}{4(13\cdot 4-1)}=\dfrac{3}{4}$.
By modulo $x^2+1$ remainder is $x(b-a)+a+4$ and quotient is $a(x-1)$:
$ax^3-ax^2+bx+4=\bigg(x(b-a)+a+4\bigg)+\bigg(a(x-1)\bigg)\cdot(x^2+1)$.
I think that from remainder$=0$ $\not\Rightarrow ax^3-ax^2+bx+4=a(x-1)(x^2+1)$, but only $ax^3-ax^2+bx+4 \equiv 0 \equiv x(b-a)+a+4 \equiv a(x-1)(x^2+1) \pmod {x^2+1}$. Thus is not correct to match the coefficients of $ax^3-ax^2+bx+4$ and $a(x-1)(x^2+1)$ whitout modulo.
