# Finding the quotient and the remainder in $\mathbb{Z}_5[x]$

$f(x) = x^3 + 2x + 4$
$g(x) = 3x + 2$
$f,g \in \mathbb{Z_5}[x]$, $\mathbb{Z}_5 = \{0, 1, 2, 3, 4 \}$.
I am to find the quotient and the remainder of polynomial division.
How can it be done if $f,g \in \mathbb{Z}_5[x]$?

To sum up it will look like this to my mind. $$f(x) = q(x)g(x) + r, q(x)\in \mathbb{Z_5}[x], r\in \mathbb{Z_5}$$ First I am to find $a: a \cdot 3x = x^3 \rightarrow a = \frac{1}{3}x^2 = 2x^2$ in $\mathbb{Z_5}$.
$$f_1(x) = f(x) - 2x^2g(x) = x^2 + 2x + 4$$ I am to find $b: b \cdot 3x = x^2 \rightarrow b = 2x$. $$f_2(x) = f_1(x) - 2xg(x) = 3x + 4$$ Like above $c = 1$ thus $1\cdot3x = 3x$ and now $$f_3(x) = f(2) - g(x) = 2$$ and that is the remainder. Am I right?
Thus $f(x) = (2x^2 + 2x + 1)g(x) + 2$

• All good! Way to go. Mar 10, 2018 at 22:13
• @ArnaudMortier Thank you! Mar 10, 2018 at 22:46

First you need to find the inverse of the leading coefficient, $3$. If it is not invertible then quotient and remainder don't always exist.

When you have found what $3^{-1}$ is mod $5$, you can answer the question

What will give $x^3$ when I multiply it by $3x$?

The answer will give you the leading coefficient $ax^k$ of the quotient.

Then proceed just like in a usual division (of integers by integers).

• To my mind $3^{-1} = 2$ in $\mathbb{Z_5}$. Am I right? I don't think I understand the next step however Jan 16, 2018 at 20:42
• Yes! Now you need to solve ?? x $3x = x^2$. The ?? does two things: it cancels the $3$ (now you know how to do that), and it brings $x$ up to $x^3$... Jan 16, 2018 at 20:43
• So I figured out that $?? = 2x^2$. So that will be the first part of our quotient? Jan 16, 2018 at 20:46
• Yes! Now take out $2x^2\times g(x)$ from $f(x)$: that will decrease the degree of $f$. Repeat to get the next part of the quotient. Keep doing that until the degree of your new $f$ is less than that of $g$, so that you can't proceed further (and then the last $f$ is your remainder). Jan 16, 2018 at 20:49
• So now because $2x^2g(x) = x^3 + 4x^2$ I must find $??$ such as $?? \cdot 4x^2 = 2x?$ Jan 16, 2018 at 20:54

We want to find polynomials $q,r \in \mathbb{Z}_5[x]$ so that $$x^3 +2x+4 = q(3x + 2) + r.$$ By inspection we see that $q = 2x^2 + 2x + 1$ and $r = 2$ works.