This is a very easy question I suppose. I am trying to help my niece for solving some equations, i.e. finding real roots. There was one equation which we solved, but I wasn't particularly satisfied with how we solved it, we guessed the end result, which was correct in the end. Let me state the equation:
$$(x^2-4)(x+1)=4-2x$$
So we first simply did the multiplication on the left first and rewrote it as:
$$x^3+x^2-2x-8=0$$
Next we started to figure out if there exists a factorization of the form:
$$(x^2+ax+b)(x+c)=x^3+(a+c)x^2+(ac+b)x+bc$$
So in order for this to exist, we should have:
\begin{align*} a+c &= 1 \\ ac+b &= -2 \\ bc &= -8 \end{align*}
So we simply solved that $a=1-c$ and $b=-\frac{8}{c}$ and inserted these into the the equation in the middle to get: \begin{align*} c(1-c)-\frac{8}{c} &=-2 \\ -c^3+c^2+2c-8 &=0 \\ c(-c^2+c+2) &= 8 \end{align*}
at which point I noticed that we didn't get anything more useful for trying to find out this factorization. Anyhow, a solution of $c=-2$, which we simply guessed by trial and error, seemed to work on this case:
$$-2(-4-2+2)=8$$
and we got so that $a=3,b=4$, and indeed the factorization is:
$$(x^2+3x+4)(x-2)=x^3+x^2-2x-8$$
and the only real root is $x=2$.
So we got it solved, but I didn't like that we guessed the solution. My questions is: what did we miss in this problem? Since there often is some trick to notice, what should have we seen so we would not have had to resort to this trial and error guessing?
You could have noticed that $x^2-4=(x-2)(x+2)$ and $4-2x=-2(x-2)$, so that $$\begin{align}(x^2-4)(x+1)=4-2x&\iff(x-2)(x+2)(x+1)=-2(x-2)\\&\iff(x-2)\left((x+2)(x+1)+2\right)=0\\&\iff(x-2)(x^2+3x+4)=0. \end{align}$$