Factor the expression below completely. All coefficients should be integers.
COMMONx^COMMON_VAR ? 3 : 2 +
COMMON * LINEARx^COMMON_VAR ? 2 : 1 +
COMMON * CONSTANTCOMMON_VAR ? "x" : ""
COMMONx(x-A)(x-B)
COMMON(x-A)(x-B)
If we notice that all terms have a common factor, we can rewrite the expression as,
COMMONx(x^2 + LINEARx + CONSTANT)
.
COMMON(x^2 + LINEARx + CONSTANT)
.
We can now focus on factoring the polynomial x^2 + LINEARx + CONSTANT
.
When we factor a polynomial, we are basically reversing this process of multiplying linear expressions together:
\qquad \begin{eqnarray}
(x + a)(x + b) \quad&=&\quad xx &+& xb + ax &+& ab \\ \\
&=&\quad x^2 &+& \green{(a + b)}x &+& \blue{ab}
\end{eqnarray}
\qquad \begin{eqnarray}
\hphantom{(x + a)(x + b) \quad}&\hphantom{=}&\hphantom{\quad xx }&\hphantom{+}&\hphantom{ (a + b)x }&\hphantom{+} & \\
&=&\quad x^2 &
LINEAR >= 0 ? "+" : ""&
plus( "\\green{" + LINEAR + "}x" )&
CONSTANT >= 0 ? "+" : ""&
plus( "\\blue{" + CONSTANT + "}" )
\end{eqnarray}
The coefficient on the x
term is LINEAR
and the constant term is CONSTANT
, so to reverse the steps above, we need to find two numbers
that add up to LINEAR
and multiply to
CONSTANT
.
You can try out different factors of CONSTANT
to see if you can find two
that satisfy both conditions. If you're stuck and can't think of any, you can also rewrite the conditions as a system of equations and
try solving for a
and b
:
\qquad \pink{a} + \pink{b} = \green{LINEAR}
\qquad \pink{a} \times \pink{b} = \blue{CONSTANT}
The two numbers -A
and -B
satisfy both conditions:
\qquad \pink{-A} + \pink{-B} =
\green{LINEAR}
\qquad \pink{-A} \times \pink{-B} =
\blue{CONSTANT}
So we can factor the polynomial as:
(x A < 0 ? "+" : "" \pink{-A})(x B < 0 ? "+" : "" \pink{-B})
The fully factored expression is:
COMMONx(x + -A)(x + -B)
COMMON(x + -A)(x + -B)