$5x^2+4e^{7-x}=x^2e^{7-x}+20$, find $x$ Given that $5x^2+4e^{7-x}=x^2e^{7-x}+20$.
The given solution is the equation is factorised to $e^{-x}(5e^x-e^7)(x^2-4)=0$, but I've no idea how it's factorised. Can anyone show it? 
 A: You might start by putting similar terms on the same side:
$$5x^2-20 = x^2 e^{7-x}-4e^{7-x},$$
and then factor:
$$5(x^2-4) = e^{7-x}(x^2-4).$$
Luckily, there's a common factor on both sides, you can  write
$$5(x^2-4) -e^{7-x}(x^2-4)=0$$
and so
$$(5-e^{7-x})(x^2-4)=0.$$
To pretty up the exponent on $e$, multiply both sides by $e^{-x}e^x=1$:
$$e^{-x}(5e^x-e^{7})(x^2-4)=0.$$
A: \begin{align*}
5x^2 + 4e^{7-x} &= x^2e^{7-x} + 20\\
\\
5x^2 + 4e^7e^{-x} - x^2 e^7e^{-x} - 20 &= 0\\
\\
5x^2e^xe^{-x} + 4e^7e^{-x} - x^2e^7e^{-x} - 20e^xe^{-x} &= 0\\
\\
e^{-x}(5x^2e^x + 4e^7 - x^2e^7 - 20e^x) &= 0\\
\\
e^{-x}(5x^2e^x - 4\cdot 5e^x  - x^2e^7 + 4e^7) &= 0\\
\\
e^{-x}[5e^x(x^2 - 4) - e^7(x^2+4)] &= 0\\
\\
e^{-x}[(5e^x - e^7)(x^2-4)] &= 0\\
\\
e^{-x}(5e^x - e^7)(x-2)(x+2) &= 0
\\
\end{align*}
I guess they didn't factor the $x^2-4$ into $(x-2)(x+2)$ but there you have it.  It's basically just factoring out $e^{-x}$ from everything (and noting that if a term doesn't have an $e^{-x}$ in it then it will have $e^x$ in it after factoring) and then factoring by grouping.
