5.12.9 Factorization : factor
factor takes as argument an expression.
factor factorizes this expression on the field of its coefficients,
with the addition of i in complex mode. If sqrt is enabled
in the Cas configuration, polynomials of order 2 are factorized in
complex mode or in real mode if the discriminant is positive.
Examples

Factorize x^{4}−1 over ℚ.
Input :
factor(x^
41)
Output :
(x^
2+1)*(x+1)*(x1)
The coefficients are rationals, hence the factors are polynomials with
rationals coefficients.
 Factorize x^{4}−1 over ℚ[i]
To have a complex factorization, check complex in the cas
configuration (red button displaying the status line).
Input :
factor(x^
41)
Output :
i*(x+i)*(i*x+1)*(x+1)*(x+1)
 Factorize x^{4}+1 over ℚ
Input :
factor(x^
4+1)
Output :
x^
4+1
Indeed x^{4}+1 has no factor with rational coefficients.
 Factorize x^{4}+1 over ℚ[i]
Check complex in the cas
configuration (red button rouge displaying the status line).
Input :
factor(x^
41)
Output :
(x^
2+i)*(x^
2+i)
 Factorize x^{4}+1 over ℝ.
You have to provide the square root required for extending the
rationals. In order to do that with the help of Xcas,
first check complex in the cas
configuration and input :
solve(x^
4+1,x)
Output :
[sqrt(2)/2+(i)*sqrt(2)/2,sqrt(2)/2+(i)*((sqrt(2)/2)),
sqrt(2)/2+(i)*sqrt(2)/2,sqrt(2)/2+(i)*((sqrt(2)/2))]
The roots depends on √2. Uncheck complex mode in the Cas configuration
and input :
factor(x^
4+1,sqrt(2))
Output :
(x^
2+sqrt(2)*x+1)*(x^
2+((sqrt(2)))*x+1)
To factorize over ℂ, check complex in the
cas configuration or input cFactor(x^
4+1,sqrt(2))
(cf cFactor).