Range of function $g(x)=\frac{e^{f(x)}-e^{|f(x)|}}{e^{f(x)}+e^{|f(x)|}}$ If range of $ f(x)$ is$[-1,1]$,then what is the range of function $g(x)=\frac{e^{f(x)}-e^{|f(x)|}}{e^{f(x)}+e^{|f(x)|}}$?
My attempt:As $-1\leq f(x)\leq 1\Rightarrow 0\leq |f(x)|\leq 1 $
Therefore $e^{-1}\leq e^{f(x)} \leq e$ and $1\leq e^{|f(x)|} \leq e$
$e^{-1}-1\leq e^{f(x)}-e^{|f(x)|} \leq 0$
$e^{-1}+1\leq e^{f(x)}+e^{|f(x)|} \leq 2e$
I could not solve further to get the answer.Can someone help me get the answer?I will really appreciate that.
 A: Write
\begin{align*}
& g(x) = \frac{e^{f(x)} - e^{\left|f(x)\right|}}{e^{f(x)} + e^{\left|f(x)\right|}} \\
= & \frac{e^{f(x)} + e^{\left|f(x)\right|} - 2e^{\left|f(x)\right|}}{e^{f(x)} + e^{\left|f(x)\right|}} \\
= & 1 - 2\frac{e^{\left|f(x)\right|}}{e^{f(x)} + e^{\left|f(x)\right|}} \\
= & 1 - \frac{2}{e^{f(x) - \left|f(x)\right|} + 1}.
\end{align*}
In addition, $-1 \leq f(x) \leq 1$ implies that 
$$ -2\leq f(x) - \left|f(x)\right| \leq 0.$$
Therefore, by the monotonicity of the function, we have
$$g(x) \in \left[1 - \frac{2}{e^{-2} + 1}, 1 - \frac{2}{e^{0} + 1}\right].$$

Details on why $-2 \leq f(x) - \left|f(x)\right| \leq 0$.
On one hand, $a \leq \left|a\right|$ for every real number $a$, hence $f(x) - \left|f(x)\right| \leq 0$, and the equality can be attained at, for example, $x_0$ such that $f(x_0) = 1$.
On the other hand, by triangle inequality and the fact that $\left|f(x)\right| \leq 1$:
$$\left|f(x) - \left|f(x)\right|\right| \leq \left|f(x)\right| + \left|f(x)\right| \leq 1 + 1 = 2,$$
it then follows that $f(x) - \left|f(x)\right| \geq -2$, and the equality can be attained at, for example, at $x_1$ such that $f(x_1) = -1$.
A: When $f$ is positive, i.e. When $0\leq f(x)\leq 1$ we can dispense with the modulus signs, so $g(x)$ is identically zero.
When $f$ is negative, i.e. When $-1\leq f(x)<0$ we can replace the modulus signs with minus signs and get $$g(x)=\frac{e^f-e^{-f}}{e^f+e^{-f}}=\tanh(f(x))$$
So the range of $g(x)$ is $\tanh(-1)\leq g(x) \leq 0$
A: If you break out e^(f(x)) in both the numerator and denominator you can cancel it, leaving sgn(f(x)) in g(x). Now, since sgn(f(x)) can only attain two values (-1 or +1), you can see that also the range of g(x) has to be two values.
