Derivative of expression under total expectation

27 Views Asked by At

This seems like a rather elementary question, but I wish to be certain here. Suppose we have the following expression which we wish to optimize against the variable $w$: $$f(w) = \mathbb{E}_x[L(w, x)] = \mathbb{E}_x[L(w,x) | c(w,x) \ge 0]\mathbb{P}(c(w,x)\ge 0) + \mathbb{E}_x[L(w,x) | c(w,x) < 0]\mathbb{P}(c(w,x) < 0)$$ Here, $L, c: \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$ are scalar-valed functions. The second equality comes from the law of total expectation. Now suppose I want to consider the first-order optimality condition of this expression, so I take the derivative of $f(w)$ against $w$. My question is, should the resulting expression only involve the $L'(w)$ terms, or should I also take derivative of $P(c(w,x) \ge 0)$ and $P(c(w,x)<0)$ against $w$? Why? Any help is appreciated.