Symbolics > Working with Symbolics > Factoring and Expanding Expressions > Example: Factoring and Expanding Expressions
  
Example: Factoring and Expanding Expressions
Use the keyword factor to find the factors of an integer, a radical expression, or an algebraic expression.
Use the keyword expand to expand expressions.
Factoring Integers
1. Define an integer.
Click to copy this expression
2. Insert the symbolic evaluation operator.
Click to copy this expression
3. Type the keyword factor in the placeholder above the symbolic evaluation operator and press Enter.
Click to copy this expression
Factoring Radical Expressions
1. Define a radical expression.
Click to copy this expression
2. Insert the symbolic evaluation operator.
Click to copy this expression
3. Type the keyword factor in the placeholder above the symbolic evaluation operator and press Enter.
Click to copy this expression
Factoring Polynomials
1. Define a polynomial in x.
Click to copy this expression
2. Insert the symbolic evaluation operator.
Click to copy this expression
3. Type the keyword factor in the placeholder above the symbolic evaluation operator and press Enter.
Click to copy this expression
This keyword factors the polynomial over the rational numbers. In other words, the coefficients of the two factors are rational numbers (integers or ordinary fractions). You cannot factor the second term any further over the rational numbers, because its roots involve the square root of 5, which is irrational.
4. Find the roots using the keyword solve, which returns the roots in a vector.
Click to copy this expression
5. To factor the original polynomial completely over the real numbers, add the radical expression square root of 5 as an argument by typing a comma after factor and then typing square root of 5 in the placeholder that appears after the comma.
Click to copy this expression
* 
In general, using the keyword factor with no additional arguments factors a polynomial over the field of numbers generated by its coefficients. That is, if the coefficients of polynomial are all rational numbers, the coefficients of the factors must all be rational. However, if the coefficients of the polynomial include a radical expression, the coefficients of the factors can also contain the same radical expression.
Expanding Expressions
1. Use the expand keyword to expand the following expression:
Click to copy this expression
2. Type a comma after expand, then type a subexpression of the main expression.
Click to copy this expression
PTC Mathcad expands all terms except for the subexpression.
3. Type a subexpression that is not in the original expression.
Click to copy this expression
Click to copy this expression
The result is the same as if you had not included the modifier.
Factoring Polynomials Completely over the Real Numbers
1. Use the keyword solve to find the real coefficients of this polynomial over the real numbers.
Click to copy this expression
2. Replace the keyword solve with factor and type a comma-separated list of all the radicals appearing in the roots of the polynomial.
Click to copy this expression
Factoring the Polynomial Completely over the Complex Numbers
1. To factor any polynomial completely over the complex numbers, add the complex number i to the list of radicals.
Click to copy this expression
2. Alternatively, define a vector by the symbolic roots and then insert entries of the vector after factor.
Click to copy this expression
Click to copy this expression
Since v0 contains both radicals appearing in the roots, as well as i, you only need to enter one of the roots.
3. Factor a polynomial over the real or complex numbers into terms with floating-point coefficients, rather than symbolic ones, using the modifiers real or complex.
Click to copy this expression
Click to copy this expression
The keyword float is used to reduce the number of decimal places displayed in the coefficients.