### 11.8.8 Division in ℤ/pℤ or in ℤ/pℤ[x]

The / operator divides two integers in ℤ/pℤ or two polynomials A and B in ℤ/pℤ[x]. (See also Section 7.3.2.) Since ℤ/pℤ is only a field if p is prime, the quotient is only guaranteed to exist if p is prime (unless the denominator is 0 (mod p )).

##### For integers in ℤ/pℤ.

Since 13 is prime:

5%13/2%13

| ⎛ ⎝ | −4 | ⎞ ⎠ | %13

Since 3(mod 14 ) is invertible in Z/14ℤ:

5%14/3%14

| ⎛ ⎝ | −3 | ⎞ ⎠ | %14

Since 7(mod 14 ) is not invertible in Z/14ℤ, this results in an error:

5%14/7%14

Not invertible Error: Bad Argument Value |  |  |  |  |  |  |  |  |  |

##### For polynomials.

The result of P/Q is its irreducible representation in ℤ/pℤ[x]:

(2*x^2+5)%13/(5*x^2+2*x-3)%13

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