How many solutions does the expression $3^x(3^x+1)+2=|3^x-1|+|3^x+2|$ have? I can solve this by opening every single modulus, doing alternate combinations of $\pm$  and checking whether every $3^x$ is $>0$ or not. But that consumes a lot of time. Is there is a shorter way to solve such questions. 
The answer is 1

Simplify the equation by substituting $a=3^x$ and using the fact that $a>0$.
$a(a+1)+2=|a-1|+a+2$ since $a+2>0$
There are only two cases to be checked:
Case 1: $a^2 + a+2=a-1+a+2$
$\Longleftrightarrow a^2 -a+1=0$
Here $D=b^2-4ac=1-4=-3<0$
Therefore no real solutions.
Case 2: $a^2 + a+2=-a+1+a+2$
$\Longleftrightarrow a^2+a-1=0$
$\Longleftrightarrow a= \frac{-1+ \sqrt 5}{2} $ since $a>0$ we neglect $a= \frac{-1- \sqrt 5}{2} $
Therefore, there's only one root.
Further, if you want to find $x$,
$3^x=\frac{-1+ \sqrt 5}{2} $
Take $\log$ on both sides,
$x= \log_3\frac{\sqrt 5 -1}{2}$
This is the only solution to the expression given.
