\section{\index{Rational Roots Test}Rational Roots Test}
The solutions to a polynomial equation $p(x)=0$ such as
\[2x^3+4x^2-3x-6=0\]
are called the \emph{zeros} or \emph{roots} of the polynomial.  They are the $x$-intercepts of the graph of $y=p(x)$, the values of $x$ for which $y=0$.  When a polynomial has \emph{integer} coefficients ($0,\pm1,\pm2,\ldots$) the \textbf{Rational Roots Test} can be used to identify the \emph{rational} solutions to the polynomial equation.  A rational number is one that may be written in the fractional form $p/q$ where $p$ and $q$ are integers ($q\neq0$).  The Rational Roots Test works by narrowing down the \emph{possible} rational solutions to a handful of values.  These may then be checked in the original equation to see if they are indeed solutions or not.  For an arbitrary polynomial equation
\[a_nx^n+a_{n-1}x^{n-1}+\ldots+a_1x+a_0=0\]
where the coefficients $a_i$, $i=1,\ldots,n$, are integers, the rule is that the possible rational solutions of the equation (or equivalently zeros or roots of the polynomial) have the form:
\[\pm\frac{\text{factor of the constant term}~a_0}{\text{factor of the leading coefficient}~a_n}\]
So in the given cubic example, $2x^3+4x^2-3x-6=0$, we have that the leading coefficient is $a_3=2$ and the constant term is $a_0=-6$.  Since $2$ has factors $1$ and $2$ and $6$ has factors $1,2,3,$ and $6$ the possible rational roots to check are:
\begin{align*} x&=\pm\frac{1,2,3,6}{1,2}=\pm\frac{1}{1},\ \pm\frac{2}{1},\ \pm\frac{3}{1},\ \pm\frac{6}{1},\ \pm\frac{1}{2},\ \pm\frac{2}{2},\ \pm\frac{3}{2},\ \pm\frac{6}{2}\\
                &=\pm 1,\  \pm 2,\ \pm 3,\ \pm 6,\ \pm\frac{1}{2},\ \pm\frac{3}{2}
\end{align*}
Checking each value in the original polynomial $p(x)=2x^3+4x^2-3x-6$ gives
\[\begin{array}{c|r||c|r}
    x & p(x) & x & p(x) \\ \hline
    1 & -3 & -1 & -1\\
    2 & 20 & -2 & 0\\
    3 & 75 & -3 & -15\\
    6 & 552 & -6 & -276\\
    1/2 & -25/4 & -1/2 & -15/4\\
    3/2 & 21/4 & -3/2 & 3/4
  \end{array}\]
We see from the table that the only rational solution to $2x^3+4x^2-3x-6=0$ is the root $x=-2$ of the polynomial.

Note that the Rational Roots Test only finds the rational solutions.  The above cubic equation could have only one real solution but there may be other \emph{irrational} ones (i.e. real numbers like $\sqrt{2}$ that are not expressible as fractions).  So for instance knowing that $x=-2$ is a root of the polynomial it follows that $x-(-2)=x+2$ is a factor of the polynomial.  As we will show presently using polynomial long division or factoring by grouping, the cubic factors as $2x^3+4x^2-3x-6=(x+2)(2x^2-3)$ and so solving the original equation amounts to solving:
\[(x+2)(2x^2-3)=0\,.\]
So in addition to $x=-2$ we obtain solutions to the cubic equation by solving the quadratic equation $2x^2-3=0$ which gives the two irrational solutions
\[x=\pm\sqrt{\frac{3}{2}}\]
as well.  (Note that while $\sqrt{3/2}=\sqrt{3}/\sqrt{2}$ this is not a rational number since the numerator and denominator are not integers, nor does the expression simplify to a ratio of integers.)

\section{\index{polynomial long division}Polynomial Long Division}
\label{sec:polynomiallongdiv}
As shown in the previous section, the Rational Roots Test can be used to find one or more zeros of a polynomial.  A zero $x=a$ of $p(x)$ implies that $(x-a)$ is a factor of that polynomial.   The latter can then be factored out of the polynomial, thereby reducing the order of the remaining polynomial to solve in the equation $p(x)=0$.  This was shown in the special case of a cubic equation in the last example.  There we found that $a=-2$ was a root of polynomial $p(x)=2x^3+4x^2-3x-6$.  This means that $(x-a)=(x+2)$ is a factor of $p(x)$. One method of finding the remaining factor is by dividing $p(x)$ by $(x+2)$ using \textbf{polynomial long division}.  This process is essentially the same as long division with numbers.     As with long division we place the \emph{divisor} $(x+2)$ to the left of the \emph{dividend} $2x^3+4x^2-3x+6$:
% \longdiv{293}{3}
\[\polylongdiv[stage=1]{2x^3+4x^2-3x-6}{x+2}\]
(Here it is important to leave space or put zeros for any terms with zero coefficient in the dividend.) Next we ask how many times $x+2$ goes into the expression on the right.  We only need to look at the highest power of the divisor ($x$) and that of the expression on the right ($2x^3$) and conclude that it will go $2x^2$ times.  We place that number above the corresponding column with the same order of $x$ on the right:
\[\polylongdiv[stage=2]{2x^3+4x^2-3x-6}{x+2}\]
Next multiply $2x^2$ times the divisor $x+2$ to get $2x^3+4x^2$.  Place that expression directly below the relevant columns, multiplying each term by -1 because we subtract $2x^3+4x^2$ from the previous expression: 
\[\polylongdiv[stage=3]{2x^3+4x^2-3x-6}{x+2}\]
Subtracting $2x^3+4x^2$ gives:
\[\polylongdiv[stage=4]{2x^3+4x^2-3x-6}{x+2}\]
Here we bring down as many terms from the preceding line as are required to continue the division. Next ask how many time $x$ goes into $-3x$.  The answer is~$-3$ and we place that result in the appropriate column at the top.
\[\polylongdiv[stage=5]{2x^3+4x^2-3x-6}{x+2}\]
Multiplying $x+2$ by $-3$ gives $-3x-6$.  Subtracting that is the same as adding $3x+6$ and we have
\[\polylongdiv[stage=7]{2x^3+4x^2-3x-6}{x+2}\]
The final result is zero (i.e. no remainder) which is what we expected since $x+2$ is a factor.  The resulting \emph{quotient} $2x^2-3$ can be read off the top.  We have therefore shown that $(2x^3+4x^2-3x-6)\div(x+2)=(2x^2-3)$, or, as a ratio,
\[\frac{2x^3+4x^2-3x-6}{x+2}=2x^2-3\,.\]
Equivalently the cubic factors as $2x^3+4x^2-3x-6=(x+2)(2x^2-3)$.

Consider an example where there is a non-zero remainder.  Dividing \mbox{$3x^4+4x^2-5$} by $x^2+2x+1$ with long division results in
\[\polylongdiv{3x^4+4x^2-5}{x^2+2x+1}\]
Notice we stop when the degree of the divisor $x^2+2x+1$ (which is 2) exceeds that of the remainder term $-20x-18$ (which is 1).  In symbols we have shown that
\[(3x^4+4x^2-5)\div(x^2+2x+1)=(3x^2-6x+13)\ \text{R}\, (-20x-18)\,.\]
The non-zero remainder of $-20x-18$ indicates that $x^2+2x+1$ is not a factor of $3x^4+4x^2-5$.  If we want to write an equivalent result we can write:
\[\frac{3x^4+4x^2-5}{x^2+2x+1}=3x^2-6x+13+\frac{-20x-18}{x^2+2x+1}\,.\]
Here the ratio in the last term is required because the remainder $-20x-18$ still must be divided by the divisor $x^2+2x+1$.

As a final note, a convenient shorthand that simultaneously checks potential roots from the Rational Roots Test and gives the remaining polynomial factor as well is known as \textbf{\index{synthetic division}synthetic division}.  The student may consult other books or online references if interested in this simplifying process.

\section{\index{factoring!by grouping}Factoring by Grouping}
Consider again the problem of solving
\[2x^3+4x^2-3x-6=0\]
by factoring the polynomial.  When \textbf{factoring by grouping} we break the terms into groups and seek to factor out a \emph{common factor} from each group.  In this example we can group the first two terms and the last two terms together
\[\underline{2x^3+4x^2}\ \underline{-3x-6}=0\,\]
and observe that we can pull out a common factor of $(x+2)$ from each grouping:
\[\underline{2x^2(x+2)}\ \underline{-3(x+2)}=0\,.\]
Because multiplication is distributive over addition we can pull the common factor out to get the final factoring of the cubic into a quadratic and linear factor:
\[(2x^2-3)(x+2)=0\,.\]
We could have also chosen to group the first and third terms and the second and fourth terms together to get:
\[\underline{2x^3-3x}\ \underline{+4x^2-6}=0\,\]
and factored each to get
\[\underline{x(2x^2-3)}\ \underline{+2(2x^2-3)}=0\,.\]
We find a common factor of $(2x^2-3)$ to pull out:
\[(x+2)(2x^2-3)=0\]
resulting in the same final factorization. In this example observe that from the Rational Roots Test we knew that $(x+2)$ had to be a factor of the cubic and hence seeking a grouping of the terms that generated that common factor, in this case the first grouping, made sense.  This approach then is an alternative to doing polynomial long division to find the second factor.

Consider solving the following cubic equation by grouping:
\[2x^3+5x^2-4=0\,.\]
In this case with only three terms no useful grouping would seem possible.  If one uses the Rational Roots Test one finds that possible rational roots are
\[\pm\frac{1,2,4}{1,2}=\pm1, \pm2,\pm 4,\pm 1/2\]
Evaluating these in $2x^3+5x^2-4$ shows that $a=-2$ is a root.  Therefore $(x-a)=(x+2)$ is a factor of the polynomial.  Looking at our original cubic we note that we can make it into four terms by breaking the $5x^2$ into a sum of two terms.  Knowing that we want to find a common factor of $(x+2)$ and noticing that the first term in the cubic is $2x^3$ it follows that writing $5x^2=4x^2+x^2$ will do the trick:
\begin{align*}
  2x^3+5x^2-4&=0\\
  \underline{2x^3+4x^2}+\underline{x^2-4} & = 0\\
  \underline{2x^2(x+2)}+\underline{(x-2)(x+2)} & = 0\\
  [2x^2+(x-2)](x+2) & = 0\\
  (2x^2+x-2)(x+2) & = 0
\end{align*}
Now we can use the quadratic formula on $2x^2+x-2=0$ to find the other solutions.

Note that for factoring by grouping to work the factor found must indeed be common to the grouped terms.  For example, grouping and factoring as follows will not work since there is no common factor found in each group that can be removed:
\begin{align*}
  3x^4+9x^3+x^2-16 & = 0 \\
  \underline{3x^4+9x^3}\ \underline{+x^2-16} & = 0 \\
  \underline{3x^3(x+3)}\ \underline{+(x+4)(x-4)} & = 0
\end{align*}
So in general factoring by grouping will not necessarily work.  One place where it can be used is to solve certain quadratic equations.  We know that to solve a quadratic where the highest order coefficient is one, like
\[x^2+6x+8=0\,,\]
that we seek two numbers that multiply to get the constant term (here 8) and add to get the linear coefficient (here 6).  In this case the numbers are 2 and 4 and we have
\[(x+2)(x+4)=0\,.\]
Now consider a quadratic equation where the highest order coefficient is not one, like
\[2x^2-5x-12=0\,.\]
In this case we look for two numbers that multiply to get the product of the quadratic coefficient and constant term (here $(2)(-12)=-24$) and add to get the linear coefficient (here $-5$).  Two such numbers are $-8$ and $3$.  How do these help?  We can use them to break up the linear term $-5x=-8x+3x$ and use grouping as follows:
\begin{align*}
  2x^2-5x-12&=0\\
  \underline{2x^2-8x}\ \underline{+3x-12}&=0\\
  \underline{2x(x-4)}\ \underline{+3(x-4)}&=0\\
  (2x+3)(x-4)&=0
\end{align*}
Setting each linear factor to zero and solving gives the solutions -3/2 and 4.  In general if one is solving $ax^2+bx+c=0$ and can actually find two numbers that multiply to get $ac$ and add to get $b$ and split up $bx$ accordingly, then grouping will always work.  As usual if no two such numbers can be found one should use the quadratic formula.

\textbook{\clearpage}
\textbook{\addtoanswerkey{\clearpage}}
\begin{exercise}
\input{ADVANCED_FACTORING/advanced-factoring}
\end{exercise}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:
