# Why is the cancellation of partial derivatives like fractions justified in this example?

Suppose we have two functions $Q=Q(q,p)$ and $p=p(q,Q)$ (the context is not important here, but if you're wondering $(p,q)$ arise as coordinates in a Hamiltonian system, and $(P,Q)$ are alternative coordinates derived from a canonical transformation). I'm looking at an example and the final step is: \begin{equation} \dots=\frac{\partial{Q}}{\partial{p}}\Bigg{|}_q\frac{\partial{p}}{\partial{Q}}\Bigg{|}_q = 1 \end{equation}

Now I have looked at various stackexchange posts and spent quite a while trying understand why you can treat normal derivatives like fractions, and why you can't do the same for partial derivatives, which perhaps seems contradictory to the last step above. I have tried to justify it in the following way, can someone please tell me if this is correct (I've taken out the vertical restriction bars to save time). We have: \begin{equation} dQ=\frac{\partial{Q}}{\partial{q}}dq + \frac{\partial{Q}}{\partial{p}}dp~~~~~,~~~~~dp=\frac{\partial{p}}{\partial{q}}dq + \frac{\partial{p}}{\partial{Q}}dQ \end{equation}

Now, since $q$ is held constant, $dq=0$. Hence if we divide through by $dp$ in the left equation and $dQ$ in the right we get $\frac{\partial{Q}}{\partial{p}}=\frac{dQ}{dp}$ and $\frac{\partial{p}}{\partial{Q}}=\frac{dp}{dQ}$, and using the fact that we can cancel total derivatives like fractions (for reasons I'm not wanting to discuss here, unless they are important to the dicussion), we have:

\begin{equation} \frac{\partial{Q}}{\partial{p}}\frac{\partial{p}}{\partial{Q}} = \frac{dQ}{dp}\frac{dp}{dQ}=1 \end{equation}

Is this correct, and if so, am I overcomplicating things at all? Is there perhaps a more intuitive reason why in this case, we can cancel the partial derivatives like fractions? Thanks

You're on the right track. I would view things as follows.

Let $Q=f(q,p)$ and $p=g(q,Q)$. Then, we have both

$$dQ=f_1(q,p)dq+f_2(q,p)dp \tag 1$$

and

$$dp=g_1(q,Q)dq+g_2(q,Q)dQ \tag 2$$

Substitution of $dQ$ as given in $(1)$ into $(2)$ yields

\begin{align} dp&=g_1(q,Q)dq+g_2(q,Q)\left(f_1(q,p)dq+f_2(q,p)dp \right)\\\\ &=\left(g_1(q,Q)+g_2(q,Q)f_1(q,p)\right)dq +f_2(q,p)g_2(q,Q)\,dp\tag 3 \end{align}

Inasmuch as the differential terms on both sides of $(3)$ must be equal, we obtain

$$\bbox[5px,border:2px solid #C0A000]{f_2(q,p)g_2(q,Q)=\frac{\partial Q}{\partial p}\times \frac{\partial p}{\partial Q}=1}$$

which was to be shown along with

$$g_1(q,Q)+g_2(q,Q)f_1(q,p)=\frac{\partial p}{\partial q}+\frac{\partial p}{\partial Q}\times \frac{\partial Q}{\partial q}=0$$

With the variable $q$ held constant, one can define a function $Q|_q(p) = Q(q,p)$ which depends only on $p$. By definition of partial derivative we have

$$\frac{\partial Q}{\partial p} \Bigg{|}_q = \frac{d Q|_q}{dp}$$

and you can treat the partial derivative as an ordinary derivative, as long as the other variables don't appear. So in particular the inverse function theorem holds.