# Derivative of an integral of a random normal variable

Let $$x$$ be a random normal variable with pdf $$h(x)$$ and CDF $$H(x)$$. Also let $$\alpha$$ be a constant, and $$x^\star$$ a variable.

I am trying to take the following derivative:

$$\frac{d}{d x^\star} \bigg [ \int_{-\infty}^{x^\star} (x^\star-x) dH(x) + \frac{1}{1-\alpha} \int_{x^\star}^{+\infty} (x^\star-x) dH(x) \bigg ]$$

where $$\alpha$$ is a parameter.

Here's what I have tried. I started by breaking the integral in two parts. The first part, given the normality assumption I can rewrite as:

$$\begin{eqnarray*} \int_{-\infty}^{x^\star} x dH(x) + \frac{1}{1-\alpha} \int_{x^\star}^{+\infty} x dH(x) = && -h(x^\star) + \frac{1}{1-\alpha} h(x^\star) \\ = && h(x^\star) \frac{\alpha}{1-\alpha}, \end{eqnarray*}$$ so that, I can bring both parts together to write: $$\begin{eqnarray*} \int_{-\infty}^{x^\star} (x^\star-x) dH(x) + \frac{1}{1-\alpha} \int_{x^\star}^{+\infty} (x^\star-x) dH(x) = && H(x^\star) + \frac{1-H(x^\star)}{1-\alpha} - (x^\star) \frac{\alpha}{1-\alpha} \\ \end{eqnarray*}$$

Now is the derivative just:

$$h(x^\star) + \frac{1-h(x^\star)}{1-\alpha}$$

What am I missing?

• Sorry. It’s a typo. It should be H and h. Will fix it. Feb 7, 2023 at 23:03
• Using $x$ to denote a random variable as well as a real variable as in "pdf $h(x)$ is a sure-fire way of getting into trouble in writing formulas and making sense of them. Yes, I know that this notation and usage is standard in physics, but on stats.SE, people like to distinguish between random variables and ordinary variables, even going so far as to (horrors!) use capital letters for random variables and lower case letters for real variables. Thus "Let $X$ denote a normal random variable with density function $h(x)$ and CDF $H(x)$." Feb 7, 2023 at 23:14
• I couldn't quite follow your intermediate step though. I will just apply the Leibniz integral rule. Feb 7, 2023 at 23:25
• The basic rules of integration (linearity) and differentiation (linearity; and constants have zero derivatives) immediately reduce this question to differentiating $\int^{x^*} x^* \mathrm dH(x) = x^* H(x^*)$ (that's the Fundamental Theorem of Calculus) with respect to $x^*.$ Use the product rule.
– whuber
Feb 8, 2023 at 0:03

For the second way, simplify the function first (for typing convenience, I will replace $$x^\star$$ in your question with $$u$$, and denote $$(1 - \alpha)^{-1}$$ by $$\beta$$): \begin{align} & F(u) := \int_{-\infty}^u (u - x)dH(x) + \beta\int_u^\infty(u - x)dH(x) \\ =& \int_{-\infty}^u (u - x)h(x)dx + \beta\int_u^\infty(u - x)h(x)dx \\ =& uH(u) - \int_{-\infty}^u xh(x)dx + \beta u(1 - H(u)) - \beta\int_u^\infty xh(x)dx. \end{align} It then follows by the fundamental theorem of calculus and $$H'(u) = h(u)$$ that \begin{align} & \frac{dF(u)}{du} = H(u) + uh(u) - uh(u) + \beta(1 - H(u)) - \beta uh(u) + \beta uh(u) \\ =& H(u) + \beta(1 - H(u)). \end{align} Switching back to your original notations, the answer should be \begin{align} H(x^\star) + \frac{1 - H(x^\star)}{1 - \alpha}. \end{align}