Factor the following expression:
format(QUESTION)
We first notice that all terms have a common factor. We can rewrite the expression as:
format(POLY_AND_FACTOR)
We can now focus on factoring the polynomial: format(POLY_NO_FACTOR)
When we factor a polynomial, we are basically reversing this process of multiplying linear expressions together:
\qquad formatGroup(GROUP1, [0, 1])
\qquad formatGroup(GROUP1, [2])
The coefficient on the x term is SIMPLELINEAR
and the constant term is SIMPLECONSTANT, so to reverse the steps above, we need to find two numbers
that add up to SIMPLELINEAR and multiply to
SIMPLECONSTANT.
You can start by trying to guess which factors of SIMPLECONSTANT add up to
SIMPLELINEAR. In other words, you need to find the values for a and
b that meet the following conditions:
\qquad parseFormat("#a+#b=#{"+ SIMPLELINEAR + "}", [PINK, PINK, GREEN])
\qquad parseFormat("#a \\times #b = #{" + SIMPLECONSTANT + "}", [PINK, PINK, BLUE])
If you're stuck, try listing out every single factor of SIMPLECONSTANT and its opposite as
a in these equations, and see if it gives a value for b
that validates both conditions. For example, since Math.abs(A) is a factor of SIMPLECONSTANT,
try substituting Math.abs(A) for a as well as -Math.abs(A).
The two numbers -A and -B satisfy both conditions:
\qquad parseFormat("#{" + (-A) + "}+#{" + (-B) + "}=#{" + SIMPLELINEAR + "}", [PINK, PINK, GREEN])
\qquad parseFormat("#{" + (-A) + "}\\times #{" + (-B) + "}=#{" + SIMPLECONSTANT + "}", [PINK, PINK, BLUE])
So we can factor the polynomial as: parseFormat("(x + #{" + (-A) + "})(x + #{" + (-B) + "})", [PINK, PINK], simplifyOptions.checkInput)
The fully factored expression is: format(SOLUTION)