# Partial derivative confusion.

I don't understand partial derivatives. Here's an example that nails down my confusion:

Suppose we have some variables $x$, $p$, and $q$ with $p=x^2$ and $q=e^x$. Then $$\frac{\partial q}{\partial p} = \frac{\partial}{\partial p}e^{\left(p^{1/2}\right)}=\frac{e^{\left(p^{1/2}\right)}}{2p^{1/2}}$$

So far so good.

Now suppose we have variables $p$, $q$ and $a$ with $a=pq$. Then $$\frac{\partial q}{\partial p}=\frac{\partial}{\partial p}\frac{a}{p}=-\frac{a}{p^2}$$(where $a$ is being held constant)

What happens when we have both of these at once? i.e. $p=x^2$, $q=e^x$ and $a=pq$. What's $\frac{\partial q}{\partial p}$? Does it depend on what we hold constant? Does holding $x$ constant even make sense?

-

This confusion of yours is very widespread and has played a role in several questions here on math.SE; see e.g. Calculus of variations question from Darcogona, Derivative of a complicated inverse function, Finding a derivative and Interchangeable derivatives. It has to do with the fact that our notation for partial derivatives doesn't indicate the fact that the partial derivative is an operation on functions of several variables and its meaning depends on which variables the function is considered to depend upon. It can be cleared up by always writing the variables that are being held constant, either as arguments of the function:

$$\frac{\partial f(x,y,z)}{\partial x}$$

or with a vertical bar:

$$\left.\frac{\partial f}{\partial x}\right|_{y,z}\;.$$

In your examples, you haven't defined any functions that depend on several variables, so it's not entirely clear what you mean by $\partial q/\partial p$. One way to interpret these examples consistently might be as follows.

In the first example, there are fixed relationships between $p$ and $x$ and between $q$ and $x$. Thus there is only one independent variable in this case, and thus no need for partial derivatives. You can consider $q$ as a function of $x$ and write

$$\frac{\mathrm dq}{\mathrm dx} =\mathrm e^x\;,$$

or you can substitute $\sqrt p$ for $x$ (ignoring sign issues), consider $q$ as a function of $p$ and write

$$\frac{\mathrm dq}{\mathrm dp} =\frac{\mathrm e^\sqrt p}{2\sqrt p}\;,$$

both with ordinary derivatives.

In the second example, you have only one relationship between all three variables and no fixed relationship between any two of them, so this situation is different. You can consider any two of the three as the independent variables, and correspondingly you get two different derivatives of $q$ with respect to $p$:

$$\left.\frac{\partial q(p,q)}{\partial p}\right|_{q}=0\;,$$

$$\left.\frac{\partial q(p,a)}{\partial p}\right|_{a}=-\frac a{p^2}\;.$$

In the last example, you have the same situation as in the first example again; all the variables are in a fixed relationship with each other so you can't choose more than one of them independently, so there's no need for partial derivatives and you can consider any of them as a function of any other.

The answers to your last two questions are: Yes, if you do have more than one independent variable then it does depend on what you hold constant; and no, it doesn't make sense in the last example to hold $x$ constant, and neither does it make any sense to hold any of the other variables constant, since each of them determines all the others (which is why you don't need partial derivatives here).

-
Thank you. In general is it true that if I have n variables with m relations between them then I need to hold $n-m-1$ of them constant? –  Oscar Cunningham Jan 21 '12 at 15:23
@Oscar: Yes, in general this is true, but the relations might be inconsistent or redundant, so it does depend on the relations. For example, in the case of linear relations, in the generic case $n-m-1$ linear relations between $n$ variables with $m$ variables given leave one degree of freedom, but if the relations are linearly dependent they leave more freedom and if they're inconsistent they leave none. –  joriki Jan 21 '12 at 15:27