<s>[INST] Polynomial division modulo $7$ 
We are given polynomials $f(x)=x^5+2x^4+3x^3+4x^2+5x+6,\ g(x)=3x^3+x$ in the polynomial ring $(\mathbb{Z}/7\mathbb{Z})[x]$. I want to find the polynomials $q,r$ for which $f=gq+r$. Note that $deg(r)<deg(q)$

Attempt:
Either $r=0$, or $r\ne 0$ and $\deg(r)<\deg(q)$. Note that $\deg(q)=\deg(f)-\deg(g)=2$. Hence $\deg(r)=1$. As such we can write $q(x)=ax^2+bx+c, \ r(x)=cx+d.$ Performing the multiplication we obtain $$x^5+2x^4+3x^3+4x^2+5x+6=(3x^3+x)(ax^2+bx+c)+dx+e.$$
Expanding and simplifying, this reduces to $$x^5+2x^4+3x^3+4x^2+5x+6=3ax^5+3bx^4+(3c+a)x^3+bx^2+(c+d)x+e$$
We immediately see that $b=4$ as it is the coefficient of $x^2$. Further we have;
$[3a]=1$ and so $[a]=5$
$[3b]=2$ so $[b]=3$
$[3c+a]=3$ so $[c]=4$
$[c+d]=5$ so $[d]=1$, and $[e]=6$
This gives $f(x)=g(x)(5x^2+4x+4)+(x+6)$, but this equality is actually incorrect upon expanding.
Checking $b=4$ in the coefficient of $x^4$ we get $4\times 3\equiv 5\bmod 7$ which isn't what we want. Where have I gone wrong?
 [/INST] Your coefficient of $24x^2$ in the original problem changed to $4x^2$, but with reduction mod $7$, it should change to $3x^2$. This should also help resolve in your solution that in one place $b=3$ and in another $b=4$.

Edit after revision of problem:
The remainder polynomial is potentially of degree $2$. That is $\deg(r)<\deg(g)=3$. [Not $\deg(r)<\deg(q)=2$.]
</s>