Derivative of normal standard loss function

derivativesnormal distribution

I want to calculate the derivative of the normal loss function. This is what I have:

I know that
\begin{equation}
\mathcal{L}(x) = \phi(x) – x \left(1-\Phi(x)\right)
\end{equation}

I also computed that
\begin{equation}
\phi(x) = \frac{1}{\sqrt{2\pi} } \cdot exp \left( -\frac{x^2}{2} \right)
\Longrightarrow \frac{\partial \phi(x)}{\partial x} = \frac{1}{\sqrt{2\pi} } \cdot (- x) \cdot exp \left( -\frac{x^2}{2} \right) = -x \phi(x)
\end{equation}

and
\begin{equation}
\frac{\partial \Phi(x)}{\partial x} = \phi(x)
\end{equation}

I can compute then $\mathcal{L}(x)$ as such:
\begin{align*}
\frac{\partial \mathcal{L}(x)}{\partial x} &
= \frac{\partial \phi(x)}{\partial x} – \frac{\partial \left(x \left(1-\Phi(x)\right)\right)}{\partial x} \\
&= \frac{\partial \phi(x)}{\partial x} – \frac{\partial x}{\partial x} \big(1-\Phi(x)\big) – x \frac{ \partial \left(1-\Phi(x)\right)}{\partial x} \\
& = -x\phi(x) – 1 + \Phi(x) + x\phi(x)\\
&= \Phi(x) – 1
\end{align*}

Is this correct?

Best Answer

Your answer is correct. You can also write $L(x)=\phi(x)-x+x\Phi (x)$ which gives $L'(x)=-x\phi(a)-1+(x\phi(x)+\Phi (x))=\Phi (x)-1$.