### 11.9.2 Euclidean remainder

In Xcas mode, Rem is simply the inert form of rem; namely, it returns the Euclidean remainder of two polynomials without evaluation. (See Section 11.2.3.) In Maple mode, the Rem command can additionally be used in conjunction with mod to compute the Euclidean remainder of two polynomials with coefficients in ℤ/pℤ.

- In Maple mode, Rem takes two arguments: P and Q, two polynomials with coefficients in ℤ/pℤ.
- Rem(P,Q) returns the Euclidean remainder of P divided by Q.

#### Examples

Input in Xcas mode:

Rem((x^3+x^2+1) mod 13,(2*x^2+4) mod 13)

rem | ⎛ ⎝ | ⎛ ⎝ | 1%13 | ⎞ ⎠ | x3+ | ⎛ ⎝ | 1%13 | ⎞ ⎠ | x2+1%13, | ⎛ ⎝ | 2%13 | ⎞ ⎠ | x2+4%13 | ⎞ ⎠

To get the result of the division:

eval(ans())

| ⎛ ⎝ | ⎛ ⎝ | −2 | ⎞ ⎠ | %13 | ⎞ ⎠ | x+ | ⎛ ⎝ | −1 | ⎞ ⎠ | %13

Input in Maple mode:

Rem(x^3+x^2+1,2*x^2+4) mod 13

−2 x−1 |  |  |  |  |  |  |  |  |  |

Rem(x^2+2*x,x^2+6*x+5) mod 5

x |  |  |  |  |  |  |  |  |  |