<s>[INST] $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? 
 [/INST] \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.
</s>