The probability density function of the truncated normal distribution $TN\left( \mu ,{{\sigma }^{2}};a,b \right)$ can
be specified as
\begin{equation*}
f\left( x \right)=\frac{\exp \left( \frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}} \right)}{\int_{a}^{b}{\exp \left(
\frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}} \right)dx}}.
\end{equation*}
Applying (2.2), we can derive
\begin{equation*}
\int_{a}^{b}{\exp \left( \frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}} \right)dx}=\\ \frac{x-\mu }{2}\exp \left(
\frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}} \right)h_{\tfrac{-1}{2}}^{\frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma
}^{2}}}}{\Bigr|}_{a}^{b}.
\end{equation*}
The cumulative distribution of the truncated normal distribution is
\begin{equation*}
F\left( x \right)=\frac{\frac{x-\mu }{2}\exp \left( \frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}}
\right)h_{\tfrac{-1}{2}}^{\frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}}}{\Bigr|}_{a}^{x}}{\frac{x-\mu }{2}\exp \left(
\frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}} \right)h_{\tfrac{-1}{2}}^{\frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma
}^{2}}}}{\Bigr|}_{a}^{b}}.
\end{equation*}
Let
\begin{equation*}
D=\frac{x-\mu }{2}\exp \left( \frac{-{{\left( x-\mu \right)}^{2}}}{2{{\sigma }^{2}}} \right)h_{\tfrac{-1}{2}}^{\frac{-{{\left( x-\mu
\right)}^{2}}}{2{{\sigma }^{2}}}}{\Bigr|}_{a}^{b},
\end{equation*}
and we derive the moment-generating function
\begin{equation*}
{{M}_{x}}\left( t \right)=\frac{\left[ x-\left( \mu +{{\sigma }^{2}}t \right) \right]}{2D}\exp \left( \mu t+\frac{{{\sigma
}^{2}}{{t}^{2}}}{2}-\frac{{{\left[ x-\left( \mu +{{\sigma }^{2}}t \right) \right]}^{2}}}{2{{\sigma }^{2}}}
\right)h_{\tfrac{-1}{2}}^{\frac{-{{\left[ x-\left( \mu +{{\sigma }^{2}}t \right) \right]}^{2}}}{2{{\sigma
}^{2}}}}{\Bigr|}_{a}^{b}.\tag{4.13}
\end{equation*}
[Proof for (4.13)]
With a few operations, we can deduce the first and second moment of the truncated normal distribution
\begin{equation*}
{{m}_{1}}=\mu-\frac{{{\sigma }^{2}}}{D}\exp \left( \frac{-{{\left[ x-\mu \right]}^{2}}}{2{{\sigma }^{2}}} \right){\Bigr|}_{a}^{b}
\tag{4.14}
\end{equation*}
[Proof for (4.14)]
\begin{equation*}
{{m}_{2}}={{\mu }^{2}}+{{\sigma }^{2}}-\frac{{{\sigma }^{2}}}{D}\exp \left( \frac{-{{\left[ x-\mu \right]}^{2}}}{2{{\sigma }^{2}}} \right)\left( x+\mu \right){\Bigr|}_{a}^{b}. \tag{4.15}
\end{equation*}
[Proof for (4.15)]
The mean and variance are therefore can be concluded as
\begin{align*}
E\left( x \right)&=\mu -\frac{{{\sigma }^{2}}}{D}\exp \left( \frac{-{{\left[ x-\mu \right]}^{2}}}{2{{\sigma }^{2}}}
\right){\Bigr|}_{a}^{b}\ \\
V\left( x \right)&={{\sigma }^{2}}-\frac{{{\sigma }^{2}}}{D}\exp \left( \frac{-{{\left[ x-\mu \right]}^{2}}}{2{{\sigma }^{2}}}
\right)\left( x-\mu \right)|_{a}^{b}-{{\left\{ \frac{-{{\sigma }^{2}}}{D}\exp \left( \frac{-{{\left[ x-\mu \right]}^{2}}}{2{{\sigma
}^{2}}} \right){\Bigr|}_{a}^{b}\right\}}^{2}}. \tag{4.16}
\end{align*}
[Proof for (4.16)]