# Factoring a polynomial with coefficients in a Galois field: factor

### 5.34.19 Factoring a polynomial with coefficients in a Galois field: factor

The factor command can factor univariate polynomials with coefficients in a Galois field.

- factor takes one mandatory argument and one optional argument:
  - expr, an expression or a list of expressions.
  - Optionally, α, to specify an extension field.
- factor(expr) returns expr factored over the field of its coefficients, with the addition of i in complex mode (see Section 2.5.5). If sqrt is enabled in the Cas configuration (see Section 2.5.7), polynomials of order 2 are factorized in complex mode or in real mode if the discriminant is positive.
  factor(expr,α) returns expr factored over F[α], where F is the field of coefficients of expr.
- cfactor factors like factor, except the field includes i whether in real or complex mode.

#### Examples.

factor can also factorize a univariate polynomial with coefficients in a Galois field.
Input (for example to have G=F4):

G:=GF(2,2,[’w’,’G’])

Output:

GF(2,w^2+w+1,[w,G],undef)

Input (for example):

a:=G(w)
factor(a^2*x^2+1)

Output:

(G(w+1))*(x+G(w+1))^2