### The Maxima on-line user's manual

Algebra Calculator

#### Factor

Function: factor (<expr>)

Function: factor (<expr>, <p>) Factors the expression <expr>, containing any number of variables or functions, into factors irreducible over the integers. `factor (<expr>, <p>)` factors <expr> over the field of rationals with an element adjoined whose minimum polynomial is <p>.

`factor` uses `ifactors` function for factoring integers.

`factorflag` if `false` suppresses the factoring of integer factors of rational expressions.

`dontfactor` may be set to a list of variables with respect to which factoring is not to occur. (It is initially empty). Factoring also will not take place with respect to any variables which are less important (using the variable ordering assumed for CRE form) than those on the `dontfactor` list.

`savefactors` if `true` causes the factors of an expression which is a product of factors to be saved by certain functions in order to speed up later factorizations of expressions containing some of the same factors.

`berlefact` if `false` then the Kronecker factoring algorithm will be used otherwise the Berlekamp algorithm, which is the default, will be used.

`intfaclim` if `true` maxima will give up factorization of integers if no factor is found after trial divisions and Pollards rho method. If set to `false` (this is the case when the user calls `factor` explicitly), complete factorization of the integer will be attempted. The users setting of `intfaclim` is used for internal calls to `factor`. Thus, `intfaclim` may be reset to prevent Maxima from taking an inordinately long time factoring large integers.

Examples:

```          (%i1) factor (2^63 - 1);
2
(%o1)              7  73 127 337 92737 649657
(%i2) factor (-8*y - 4*x + z^2*(2*y + x));
(%o2)               (2 y + x) (z - 2) (z + 2)
(%i3) -1 - 2*x - x^2 + y^2 + 2*x*y^2 + x^2*y^2;
2  2        2    2    2
(%o3)          x  y  + 2 x y  + y  - x  - 2 x - 1
(%i4) block ([dontfactor: [x]], factor (%/36/(1 + 2*y + y^2)));
2
(x  + 2 x + 1) (y - 1)
(%o4)                ----------------------
36 (y + 1)
(%i5) factor (1 + %e^(3*x));
x         2 x     x
(%o5)              (%e  + 1) (%e    - %e  + 1)
(%i6) factor (1 + x^4, a^2 - 2);
2              2
(%o6)             (x  - a x + 1) (x  + a x + 1)
(%i7) factor (-y^2*z^2 - x*z^2 + x^2*y^2 + x^3);
2
(%o7)              - (y  + x) (z - x) (z + x)
(%i8) (2 + x)/(3 + x)/(b + x)/(c + x)^2;
x + 2
(%o8)               ------------------------
2
(x + 3) (x + b) (x + c)
(%i9) ratsimp (%);
4                  3
(%o9) (x + 2)/(x  + (2 c + b + 3) x```

2 2 2 2 + (c + (2 b + 6) c + 3 b) x + ((b + 3) c + 6 b c) x + 3 b c )

`          (%i10) partfrac (%, x);`
`                     2                   4                3`
`          (%o10) - (c  - 4 c - b + 6)/((c  + (- 2 b - 6) c`

2 2 2 2 + (b + 12 b + 9) c + (- 6 b - 18 b) c + 9 b ) (x + c))

c - 2 - --------------------------------- 2 2 (c + (- b - 3) c + 3 b) (x + c)

b - 2 + ------------------------------------------------- 2 2 3 2 ((b - 3) c + (6 b - 2 b ) c + b - 3 b ) (x + b)

1 - ---------------------------------------------- 2 ((b - 3) c + (18 - 6 b) c + 9 b - 27) (x + 3)

`          (%i11) map (factor, %);`
`                        2`
`                       c  - 4 c - b + 6                 c - 2`
`          (%o11) - ------------------------- - ------------------------`
`                          2        2                                  2`
`                   (c - 3)  (c - b)  (x + c)   (c - 3) (c - b) (x + c)`

b - 2 1 + ------------------------ - ------------------------ 2 2 (b - 3) (c - b) (x + b) (b - 3) (c - 3) (x + 3)

`          (%i12) ratsimp ((x^5 - 1)/(x - 1));`
`                                 4    3    2`
`          (%o12)                x  + x  + x  + x + 1`
`          (%i13) subst (a, x, %);`
`                                 4    3    2`
`          (%o13)                a  + a  + a  + a + 1`
`          (%i14) factor (%th(2), %);`
`                                 2        3        3    2`
`          (%o14)   (x - a) (x - a ) (x - a ) (x + a  + a  + a + 1)`
`          (%i15) factor (1 + x^12);`
`                                 4        8    4`
`          (%o15)               (x  + 1) (x  - x  + 1)`
`          (%i16) factor (1 + x^99);`
`                           2            6    3`
`          (%o16) (x + 1) (x  - x + 1) (x  - x  + 1)`

10 9 8 7 6 5 4 3 2 (x - x + x - x + x - x + x - x + x - x + 1)

20 19 17 16 14 13 11 10 9 7 6 (x + x - x - x + x + x - x - x - x + x + x

4 3 60 57 51 48 42 39 33 - x - x + x + 1) (x + x - x - x + x + x - x

30 27 21 18 12 9 3 - x - x + x + x - x - x + x + 1)

There are also some inexact matches for `factor`. Try `?? factor` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### factor

factor(a*-5*a+6*a);

Calculate

g:q-(q-p)/(1-p);

factor(g);

Calculate

##### factor-integrate

f(x):= a0 + a1 * x;

g(x):= b0 + b1 * x;

factor(integrate (f(y...

Calculate

##### factor-kill-length-makelist-map-plot2d-rhs-solve-sum

kill(all);

Punkt:[[0,3],[1,1],[2...

n:length(Punkt);

Calculate

##### factor

factor ( 2 ^ 8 - 1 );

Calculate

b1: 2*b2+3*c1;

b: a+b1;

c: a+b1+c1;

Calculate

##### factor

factor((x^4)+(4*x^3)+...

Calculate

##### factor

factor(x+2)*(x^2-4);

Calculate

##### factor

factor( a^3-5*a^2+6*a);

factor( 3*a^4-6*a^3);

factor(5*a^2-20);

Calculate

##### factor

factor(18*a**2*b-15*a...

factor(x**3-4*x**2+5*...

factor(8*x**2-32);

Calculate