Let's say we want to calculate the remainder of $$x^7+5x^3+2x+3 $$ divided by $$x^2 + 1$$
My teacher told us to this:
$$ x^7+5x^3+2x+3=(x^2+1)Q_{(x)}+r {(x)} $$ $$ ({x^2})^3x+5(x^2)x +2x+3=(x^2+1)Q_ {(x)}+r _{(x)}$$
Let $x^2=-1$
$$({-1})^3x+5(-1)x +2x+3=((-1)+1)Q_ {(x)}+r _{(x)}$$
So
$$r_{(x)}=-x-5x+2x+3=-4x+3$$
The only problem is: i don't understand why it's legal (!) to assign a value to $x^2$ and not $x $ (won't x be equal to $i$ anyway?) and then calculate the function.
(I know that If it was $x+1$ instead of $x^2+1$ i could calculate the function for $x=-1$ with no problem!)
Thanks for your explanation!
The "trick" is legitimate, though maybe not entirely obvious.
Let $P(x)=x^7+5x^3+2x+3$, and define the polynomial in $2$ variables:
$$S(u,v)=v^3 u + 5 v u + 2 u + 3 $$
It is easily verified that $P(x)=S(x,x^2)$.
Consider now $S$ as a polynomial in $v$ alone with $u$ as a parameter, then the remainder of the division by $v+1$ will be $S(u,-1) = -4u+3$ so for some quotient $T(u,v)$:
$$S(u,v)=(v+1)T(u,v) + (-4u+3)$$
Now substitute $u=x, v=x^2$ back and you get:
$$P(x)=(x^2+1)Q(x) + (-4x+3)$$
where $Q(x)=T(x,x^2)$ so $\;-4x+3\;$ is indeed the remainder of the division of $P(x)$ by $x^2+1$.