# The Factor and FactorAll Command

The **Factor** command can either factor only the highlighted term or factor out the
highlighted term from any of its parent terms. The **Factor** command is primarily used with
algebraic expressions. The keystroke for the **Factor** command is the "*f*" key.
There is also a **FactorAll** command that acts on all terms in the expression rather than
only those including the term being factored. The keystroke of the **FactorAll** command is
the "*F*" key.

Examples of the use of the **Factor** command where the intent is to factor out the
highlighted term from a larger expression include:

- On x + 4*x^3 with x highlighted, the
**Factor**command returns x(1+4*x^2) - On (a + b)*sin x - c sin^3 x with sin x highlighted, the
**Factor**command returns sin x(a + b - c sin^2 x)

Examples of the use of the **Factor** command where the intent is to factor the highlight
term only include:

- On x^2 - y^2 with the whole term highlighted, the
**Factor**command returns (x + y)(x - y) - On x * y - x^3 * z with the whole term highlighted, the
**Factor**command returns x(y + x^2 * z) - On 6 + 4*x with the whole term highlighted, the
**Factor**command returns 2(3 + 2*x)

The Factor command only does factoring on terms that contain the highlighted term. For example, the Factor comand on:

4*x + 5*x^2 + y

with "x" highlighted returns

x(4 + 5*x) + y

the "y" term, which doesn't contain an "x" is excluded from the factoring.

When appropriate, you can use the **FactorAll** (*F*) command rather than the
**Factor** command. The **FactorAll** command on this same expression (also with "x"
highlighted) will return

x(4 + 5*x + y/x)

The **FactorAll** command acts on all terms and will put the factored term in the
denominator when necessary in order to include all terms in the factored result. Similarly,
the **FactorAll** command on

4*x^2 + 5*x + 3

with x^2 highlighted will return

x^2(4 + 5/x + 3/x^2)