# Differentiation in proof of Roy's identity

I have an issue deriving the proof of Roy's Identity. It's merely a math issue since I cannot understand how the derivative works. More specifically:

When it says: "differentiating the above identity with respect to the price of a generic commodity j we have: ... Well, i cannot understand how this derivative works. how is it possible that we have the first element in the RHS and then plus (+) something?? Can someone be clear about this please? I am struggling with the proof.

Thanks to all.

• You might want to have a look at the Chain Rule: en.wikipedia.org/wiki/Chain_rule Commented Jan 22 at 15:25
• Long story short: if you have a function $f$ of two variables $x,g$, and if one of these two variables, say $g$ depends on the other variable, say $x$, so that we can write $g (x)$ the partial derivative of this function $f(x, g (x))$ with respect to $x$ is given by the "direct" effect of the change $f$ due to the marginal change in x, plus the "indirect" effect that the marginal change in $x$ has on the other variable. Idk why there is this fxxg in the end of my comment Commented Jan 22 at 15:41

Mathematically, when the variables $$x_1,x_2$$ of a function depend on some parameter $$a$$, the total effect of (infinitesimally) changing this parameter is $$\frac{\text{d} F(x_1(a),x_2(a))}{\text{d} a} = \frac{\partial F(x_1,x_2)}{\partial x_1} \frac{\text{d} x_1(a)}{\text{d} a} + \frac{\partial F(x_1,x_2)}{\partial x_2} \frac{\text{d} x_2(a)}{\text{d} a}.$$
Define the area of a rectangle with sidelengths $$a,b$$: $$A(a,b) = ab.$$ If this is a square, then $$A(a,a) = a^2.$$ What is the effect on area of lengthening one side of the square? You get this by taking the partial derivative of $$T$$: $$\frac{\partial A(a,a)}{\partial a} = a.$$ Here $$\partial$$ denotes that we are taking the derivative of the function $$A( a , b)$$ w.r.t the first variable. We could also write this as: $$\left.\frac{\partial A(x_1,x_2)}{\partial x_1}\right|_{x_1=x_2=a} = \left.x_2\right|_{x_1=x_2=a} = a.$$
You can also look at the effect of increasing the parameter $$a$$ while maintaining a square shape, i.e. increasing both sides at the same time. This is the total derivative: $$\frac{\text{d} A(a,a)}{\text{d} a} = \frac{\text{d} a^2}{\text{d} a} = 2a$$ or $$\begin{equation*} \frac{\text{d} A(a,a)}{\text{d} a} = \left.\frac{\partial A(x_1,x_2)}{\partial x_1} \frac{\text{d} x_1(a)}{\text{d} a}\right|_{x_1=x_2=a} + \left.\frac{\partial A(x_1,x_2)}{\partial x_2} \frac{\text{d} x_2(a)}{\text{d} a}\right|_{x_1=x_2=a} = \\ \left.x_2\right|_{x_1=x_2=a} \frac{\text{d} a}{\text{d} a} + \left.x_1\right|_{x_1=x_2=a} \frac{\text{d} a}{\text{d} a} = a + a = 2a. \end{equation*}$$