Previous Up Next

9.1.10  Factoring

The factor and cfactor commands factor expressions over their coefficient fields or extensions of their fields. (See also Section 11.1.18.)

Examples

Factor x4−1 over ℚ.

factor(x^4-1)
     

x−1

x+1

x2+1
          

The coefficients are rationals, hence the factors are polynomials with rationals coefficients.

Factor x4−1 over ℚ[i]. This can be done in several ways.

Using cfactor:

cfactor(x^4-1

or, using factor with adding i to the extension field:

factor(x^4-1,i)

or, using factor in complex mode:

factor(x^4-1)
     

x−1

x+1

x+i

xi
          

Factor x4+1 over ℚ.

factor(x^4+1)
     
x4+1           

Indeed, x4+1 has no factor with rational coefficients.

Factor x4+1 over ℚ[i]. Using complex mode:

cfactor(x^4+1)
     

x2+i

x2i
          

Factor x4+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 the complex box in the CAS configuration:

solve(x^4+1,x)

     



1
2
 
2
 
1−i
,−
1
2
 
2
 
1−i
,−
1
2
 
2
 
1−i
i,
1
2
 
2
 
1−i
i


          

The roots depend on √2, and so will be in ℚ[√2]. Putting Xcas back in real mode, either check the sqrt box in the CAS configuration or:

factor(x^4+1,sqrt(2))
     


x2
2
 x+1



x2+
2
 x+1

          

To factor over ℂ input:

cfactor(x^4+1,sqrt(2))

or put Xcas back in complex mode.


Previous Up Next