I want to compute the loss function for a normal distribution with mean $\mu$ and standard deviation $\sigma$. I need this for an inventory optimization model as basically I want to know "If I purchase Q units, what is the expected amount of loss sales if the demand follows $\mathcal{N}(\mu,\sigma)$.
I know that for a unit normal distribution function $\mathcal{N}(0,1)$ we have $ L(Q) = \int_{x=Q}^{\infty}(x-Q)\phi(x)dx =\phi(Q) - Q(1-\Phi(x)) $
but I want to solve this for $\mathcal{N}(\mu,\sigma)$
Starting from $L(Q)$ definition, I have,
$L(Q) = \int_{x=Q}^{\infty}(x-Q)\phi(x)dx = \int_{x=Q}^{\infty}x\phi(x)dx - Q\int_{x=Q}^{\infty}\phi(x)dx$
solving $Q\int_{x=Q}^{\infty}\phi(x)$ is fine.
The issue I face is to integrate $\int_{x=Q}^{\infty}x\phi(x)$.
This is what I have so far:
Step #1 - use the definition of $\phi(x)$ for a normal distribution:
$ \phi(x) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x - \mu)^2}{2 \sigma^2}} $
So that
$ \int_{x=Q}^{\infty}x\phi(x)dx = \frac{1}{\sqrt{2\pi\sigma^2}} \int_{x=Q}^{\infty}xe^{-\frac{(x - \mu)^2}{2 \sigma^2}}dx $
Steph #2 - I guess I have now to define something like
$ u = \frac{(x - \mu)^2}{2 \sigma^2} \text{ and } dx = \frac{x - \mu}{\sigma^2} dd $
but I am unsure. I also guess, that the result could be something like $\sigma^2\phi(Q) + (\mu-Q)*(1-\Phi(Q)) $