I'm trying to understand the following worked problem:

So, . And did they subtract from to get because the result had degree 4? Does this mean every time the degree gets larger than or equal to 4, we must subtract m(x) from it (to have everything in mod m(x))?