Polynomial $p(x)$ leaves a remainder of $4$ when divided by $x-1$ and a remainder of $-2$ when divided by $x+1$.
Find the remainder when $p(x)$ is divided by $x^2 -1$ .
According to Remainder Theorem, when a polynomial $p(x)$ is divided by $(ax+b)$, the remainder is $p\left( -\frac {b}{a}\right)$ .
So, I did the following:
\begin{align}p(1)&=4\\ p(-1)&= -2\end{align}
\begin{align}p(x)&= (x^2-1)q(x) + Ax+ B\\ p(x)&= (x-1)(x+1)q(x) + Ax+B\end{align}
When \begin{align}p(1) &= A(1) + B\\ A+B&=4\tag{1}\end{align}
When \begin{align}p(-1)&= -A+ B\\ -A+B&= -2\tag{2}\end{align}
Doing $(1)+(2)$ gives:
\begin{align}2B&=2\\ B&=1\end{align}
Substitute $B=1$ into $(1)$ gives $A=3$
So, I got the remainder as $3x+ 1$
But, the answer in the book is $x+3$ , which means my values of $A$ and $B$ have been mixed up.
Please tell me where I went wrong