### 5.26.4 Euclidean remainder : rem

rem returns the euclidean remainder between two polynomials
(decreasing power division). If the polynomials are represented as
expressions, the variable may be specified as a third
argument.

Input :

rem(x`^`

3-1,x`^`

2-1)

Output :

x-1

To have the remainder of x^{2}+2x+4 by x^{2}+x+2 we can also input :

rem([1,2,4],[1,1,2])

Output :

[1,2]

i.e. the polynomial x+2.