# Total Derivative of an Expected Value Function

Suppose I have a fair six-sided die, and want to calculate the expected value of a roll:

E(X) = p1(X1) + p2(X2) + p3(X3) + p4(X4) + p5(X5) + p6(X6)

(Where p1-p6 are the probabilities of outcomes X1-X6 materialising). Imagine the die can modified to make it more biased towards an outcome. How can I calculate the change in the expected value when the die is modified towards one of the outcomes?

Suppose I want to calculate the change in E(X) if I increase p1 (i.e. I modify the die so it's biased towards X1). If I increase p1 then not only does that increase the chances of X1 coming about, but it also decreases the chances of (at least one of) the other outcomes materialising. So I'm after the total derivative, because I want to take both the direct and indirect effect into account. I know what the equation for a total derivative is, but I don't quite see how I could know what, for instance, d(p1)/d(p2) is. Although the probability of the other outcomes together must decrease by the amount by which p1 increases, the decrease need not be spread equally across them.

I resorted to differentiating the following equation:

E(X) = p1(X1) + (1 - p1 - p3 - p4 - p5 - p6)(X2) + (1 - p1 - p2 - p4 - p5 - p6)(X3) + ... (and so on).

I'm fairly confident this is wrong, but is there a general solution for differentiating expected value functions with respect to one of the probabilities? Or is there simply no way of knowing how the expected value will change without knowing how the change in one probability affects the others (which would make sense)?

I'm not a mathematician and I'm completely new to math.stackexchange - so please forgive all the errors in my super basic question. Some guidance on how to tackle questions of this ilk would be immensely appreciated - thanks!

We can think of $$E(X)$$ as a Lagrangian, viz.$$E(X)=\sum_ip_iX_i+\lambda\left(1-\sum_ip_i\right).$$Thus$$\frac{\partial E(X)}{\partial p_i}=X_i-\lambda.$$These sum over the $$i$$ to $$0$$ if we take $$\lambda=E(X)$$.