Derivative of an Expectation over an Indicator function I have a small question on how to compute the derivative of an expectation when an indicator function gets in the way. Let $x$ be a random variable. We are interested in computing the derivative wrt A of 
$E_x [(A-x)1_{(x \leq A)}]$
where $1_n$ is the indicator function 1 when $n$ is true. A paper I am reading mentions that this is simply 
$F(A)$
but I am unsure how to get that result. Your intuitive explanations are most appreciated.

$$E_x [(A-x)1_{(x \leq A)}]$$
$$=\int_{-\infty}^\infty(A-x)1_{(x\leq A)}p_x(x)dx$$
$$=\int_{-\infty}^A(A-x)p_x(x)dx$$
$$=\int_{-\infty}^AAp_x(x)dx-\int_{-\infty}^Axp_x(x)dx$$
$$=A\int_{-\infty}^Ap_x(x)dx-\int_{-\infty}^Axp_x(x)dx$$
$$=AF(A)-\int_{-\infty}^Axp_x(x)dx$$
So taking the derivative with respect to $A$ we get
$$F(A) + AF'(A)-\frac{d}{dA}\int_{-\infty}^Axp_x(x)dx$$
$$=F(A)+Ap_x(A)-Ap_x(A)$$
$$=F(A)$$
