Aganippe76

2022-07-04

How to derive this simple equality?
Let us define
${L}_{i}\triangleq \mathrm{log}\left(\frac{Prob\left({x}_{i}=+1\right)}{Prob\left({x}_{i}=-1\right)}\right)$
$E\left\{{x}_{i}\right\}\triangleq Prob\left({x}_{i}=+1\right)-Prob\left({x}_{i}=-1\right)$
I need to show that
$E\left\{{x}_{i}\right\}=\mathrm{tanh}\left({L}_{i}/2\right)$
I can write
$\begin{array}{}\text{(1a)}& E\left\{{x}_{i}\right\}& ={e}^{log\left(Prob\left({x}_{i}=+1\right)-Prob\left({x}_{i}=-1\right)\right)}\text{(1b)}& & ={e}^{{L}_{i}}\end{array}$
if I use the following:
$\mathrm{tanh}\left(z\right)=\frac{\mathrm{sinh}\left(z\right)}{\mathrm{cosh}\left(z\right)}=\frac{{e}^{z}-{e}^{-z}}{{e}^{z}+{e}^{-z}}=\frac{{e}^{2z}-1}{{e}^{2z}+1}$
and put $z={L}_{i}/2$, then
$\begin{array}{}\text{(2)}& \mathrm{tanh}\left({L}_{i}/2\right)=\frac{{e}^{{L}_{i}}-1}{{e}^{{l}_{i}}+1}\end{array}$
how do I arrive at (2) using (1a)

jugf5

Expert

Where you went wrong is here:
$\mathrm{log}\left(A/B\right)\ne \mathrm{log}\left(A-B\right).$
Observe that
${L}_{i}\triangleq \mathrm{log}\left(\frac{Prob\left({x}_{i}=+1\right)}{Prob\left({x}_{i}=-1\right)}\right)$
$E\left\{{x}_{i}\right\}\triangleq Prob\left({x}_{i}=+1\right)-Prob\left({x}_{i}=-1\right)$
$\mathrm{tanh}\left(\frac{{L}_{i}}{2}\right)=\frac{{e}^{{L}_{i}}-1}{{e}^{{L}_{i}}+1}=\frac{\frac{Prob\left({x}_{i}=+1\right)}{Prob\left({x}_{i}=-1\right)}-1}{\frac{Prob\left({x}_{i}=+1\right)}{Prob\left({x}_{i}=-1\right)}+1}=\frac{Prob\left({x}_{i}=+1\right)-Prob\left({x}_{i}=-1\right)}{Prob\left({x}_{i}=+1\right)+Prob\left({x}_{i}=-1\right)}.$
Assuming the only two events are ${x}_{i}=+1$ and ${x}_{i}=-1$, we have
$Prob\left({x}_{i}=+1\right)+Prob\left({x}_{i}=-1\right)=1.$
Therefore,
$\mathrm{tanh}\left(\frac{{L}_{i}}{2}\right)=E\left\{{x}_{i}\right\}.$

Do you have a similar question?