What is the remainder on division of $z^{400} + z^{303} + 1$ by $z^4-1$? I am asked to determine the remainder when the polynomial $f(z)=z^{400}+z^{303}+1$ is divided by the polynomial $g(z)=z^4-1$.
I expressed f as $f(z) = h(z)(z^4-1) + r(z)$ where $r(z)$ is a polynomial
Realising that $z^4-1 = (z^2-1)(z^2+1) = (z-1)(z+1)(z^2+1)$, I expressed f as 
$f(z) = h(z)(z-1)(z+1)(z^2+1) + r(z)$
I also wrote f as $f(z) = q(z)(z-1) + 3$, since $f(1)=3$, and q is some polynomial.
So I had $f(z)= q(z)(z-1) + 3 = h(z)(z-1)(z+1)(z^2+1) + r(z)$
Hence, for some constant k, $q(z)=h(z)(z+1)(z^2+1) + k$
We know $f(-1) = 1$
From $f(z) = q(z)(z-1) + 3$, we have $f(-1)=q(-1)(-2) + 3 = 1$, which implies
$q(-1) = 1$.
Then $q(-1)=h(-1)(0) + k = 1$. Thus, $k=1$
We then have $q(z)=h(z)(z+1)(z^2+1) + 1$, and from this, we have
$f(z)= q(z)(z-1) + 3 = (h(z)(z+1)(z^2+1) + 1)(z-1) + 3$
Which simplifies to $f(z) = h(z)(z^4-1) + z+2$
And gives $r(z) =z+2$.
But I am given the answer is $r(z) = z^3+ 2$. What is going wrong here? Can I use modular arithmetic instead? How?

Another way:
Since
\begin{align*}
z^{400}+z^{303}+1&=z^{400}-1+(z^{300}-1)z^3 +z^3+2 \\
&=(z^4-1)(z^{396}+z^{392}+\ldots +1)+(z^4-1)(z^{296}+z^{292}+\ldots +1)z^3+z^3+2\\
\end{align*}
It follows that $z^3+2$ is the asked remainder.
