# Differentiating with respect to a function

I have a question regarding partial differentiation of a function of $x,y$ with respect to another function of $x,y$.

Specifically, I was wondering whether my logic or technique would hold true for most stuations.

\begin{align*} \frac{\partial(x-y)}{\partial y} & = -1 \\ & = -1\cdot\frac{\partial f(x-y)}{\partial f(x-y)} \end{align*}

Then, cross multiplying, we get:
\begin{align*} \frac{\partial f(x-y)}{\partial (x-y)} = -1 \cdot \frac{\partial f(x-y)}{\partial y} \end{align*}

My technique consisted of first constructing a partial derivative with respect to a variable, which equaled a quantity (it happened to be a scalar in the above example). Then, I multiplied by $1 = \frac{\partial f(x-y)}{\partial f(x-y)}$. Then, I rearranged the terms.

Is this a valid technique? I checked my calculus book under partial derivatives, under the chain rule, and also did a general search on derivative with respect to a function. I’m not sure if what I am doing relates closely to calculus of variations.

Thanks.

#### Solutions Collecting From Web of "Differentiating with respect to a function"

Your calculation is correct, but I’m hesitant to call it a “valid technique.” Let me explain a bit:

In the context you’re working in, we have a function $f(u)$, which is a function of a single variable, and also $u(x,y) = x – y$ is a function of two variables. In this setup, the chain rule reads as follows:

$$\frac{\partial f}{\partial x} = \frac{df}{du}\frac{\partial u}{\partial x}$$
$$\frac{\partial f}{\partial y} = \frac{df}{du}\frac{\partial u}{\partial y}$$

Since $\frac{\partial u}{\partial y} = -1$, we can conclude that $\frac{\partial f}{\partial y} = -1\cdot \frac{df}{du}$, and therefore that $$\frac{df}{du} = -1\cdot \frac{\partial f}{\partial y},$$
which, in your (somewhat non-standard) notation reads $\frac{\partial f(x-y)}{\partial (x-y)} = -1\cdot \frac{\partial f(x-y)}{\partial y}$. So, this equation is true, yes.

The reason I hesitate to call your method a “valid technique” is because one usually cannot manipulate the symbols $\partial x$ and $\partial y$ as independent entities.

For instance, if $f$ were instead a function of two variables, say $f(u,v)$, where both $u$ and $v$ were themselves functions of two variables (say $u = u(x,y)$ and $v = v(x,y)$), then the chain rule would read

$$\frac{\partial f}{\partial x} = \frac{\partial f}{\partial u}\frac{\partial u}{\partial x} + \frac{\partial f}{\partial v}\frac{\partial v}{\partial x}$$
$$\frac{\partial f}{\partial y} = \frac{\partial f}{\partial u}\frac{\partial u}{\partial y} + \frac{\partial f}{\partial v}\frac{\partial v}{\partial y}.$$
If you’ll notice, we really can’t interpret the $\partial u$ and $\partial v$ signs as canceling without getting false identities like $\frac{\partial f}{\partial x} = \frac{\partial f}{\partial x} + \frac{\partial f}{\partial x}$.

Amusing Example: Just to really drive the point home, consider the ideal gas law (from chemistry) $PV = nRT$, where $n$ and $R$ are constants. We can consider $P$, $V$, and $T$ as functions
$$P = P(V,T) = nR\frac{T}{V}$$
$$V = V(P,T) = nR \frac{T}{P}$$
$$T = T(P,V) = \frac{1}{nR}PV.$$
One can then check that, in fact:
$$\frac{\partial P}{\partial V} \frac{\partial V}{\partial T}\frac{\partial T}{\partial P} = -1.$$
So much for canceling.

Generally speaking it is not ok to use cross-multiplication for partial derivatives, because unlike full derivatives they are not represented as ratios of differential forms, so $\frac{\partial}{\partial x}$ must be regarded as one symbol (a vector in fact).

Not sure which connection to calculus of variations you had in mind, however there is only one delicate case that I am aware of where full and partial derivative get entangled in a subtle way. That is, variation of the functional
$$v[z(x,y)]=\iint_D F\left(x,y,z,p,q\right)dxdy$$
where $p=\frac{\partial z}{\partial x}$, $q=\frac{\partial z}{\partial x}$ results in the following expression
$$\delta v=\iint_D\left(F_z-\frac{\partial}{\partial x}\{F_p\}-\frac{\partial}{\partial y}\{F_q\}\right) \delta z dxdy$$
where $\frac{\partial}{\partial x}\{F_p\}$ is the so-called “full partial derivative by x” (L.E. Elsgoltz, “Calculus of Variations”, 1958). It means that $y$ is considered constant, however the dependence of $z$, $p$ and $q$ on $x$ is taken into account. Which results in the following expression
$$\frac{\partial}{\partial x}\{F_p\}=F_{px}+F_{pz}\frac{\partial z}{\partial x}+F_{pp}\frac{\partial p}{\partial x}+F_{pq}\frac{\partial q}{\partial x}$$