# Why $q,p,Q,P$ are Independent Variables when Using Generating Functions?

In Hamiltonian formalism, specifically generating functions, why do the variables $$q, p, Q, P$$ are treated as independent when finding the equations that arise from the generating function?

I understand that generating functions generate canonical transformations, but I'm not sure why it is valid to treat $$q,p,Q,P$$ as independent variables during the derivation of transformation equations, since we know that they are indeed dependent on each other - $$Q=Q(q,p), P=P(q,p)$$ (and the inverse relations), or even the relations that we get from the generating function (e.g. $$\frac{\partial F_1}{\partial q} = p$$)?

More clearly, as said by Arturo Don Juan in the related post: "How are $$q_i$$ and $$Q_i$$ separately independent? I thought $$Q_i$$ was, in general, a function of the original canonical coordinate variables $$q_i$$, thereby making it explicitly dependent on $$q_i$$"? (I didn't understand the answer given there)

I would be thankful if someone could clarify this, and provide references that deal with this point (if you know to direct me to an explanation for this point in Goldstein, Classical Mechanics it would be best).

• Possible duplicate: Independent canonical coordinate variables? Commented Apr 8 at 23:05
• @Qmechanic I read your answer to this question before posting mine - I am not yet sure why we can treat q, and Q (for example) as independent variables if we have the transformation relation between them. In your answer to the related question, you say that M is a 2n-dimensional submanifold embedded in a 4n-dimensional (I assume that it is a submanifold of dim 2n because the image is of 2n?), and then we can view M as a graph of the function $(q,Q) \rightarrow (p(q,Q,P(q,Q)$. but why and when we can do that? Commented Apr 9 at 5:46

In Hamiltonian formalism, specifically generating functions, why do the variables $$q, p, Q, P$$ are treated as independent when finding the equations that arise from the generating function?

Let us agree to consider a pedagogical example with just one degree of freedom. A well known example of this type is the simple harmonic oscillator in one dimension. There is just one degree of freedom $$n=1$$, meaning there is one coordinate $$q$$ and one momentum $$p$$, so phase space is $$2n = 2$$ dimensional. The Hamiltonian is well known to be: $$H(q,p) = \frac{1}{2m}p^2 + \frac{k}{2}q^2\;.$$

We should all understand that in this Hamiltonian formalism we know that we are treating $$q$$ and $$p$$ as two independent variables and this is made clear by how we write our function $$H$$ with a pair of parenthesis and a comma separating $$q$$ and $$p$$ a la $$H(q,p)$$. Indeed, this is all that such notation means. In other words, the Hamiltonian is a function of two independent variables.

I understand that generating functions generate canonical transformations, but I'm not sure why it is valid to treat $$q,p,Q,P$$ as independent variables during the derivation of transformation equations, since we know that they are indeed dependent on each other - $$Q=Q(q,p), P=P(q,p)$$ (and the inverse relations),

It is not valid to generally treat all of $$q,p,Q,P$$ as independent variables. Indeed, they are not all independent

or even the relations that we get from the generating function (e.g. $$\frac{\partial F_1}{\partial q} = p$$)?

Here we are now talking about a more-specific generating function form $$F_1$$, which is described in Goldstein as $$F_1 = F_1(q,Q)$$, which is only a function of $$q$$ and $$Q$$. I.e., only a function of two variables in our example case, where one is from the first set of variables (the old $$q$$) and one is from the second set of variables (the new $$Q$$).

Further, I will direct you to page 371 of Goldstein reading: "Indeed, F is useful... only when half of the variables... are from the old set and half are from the new." $$F_1(q,Q)$$ has this form since half of two is one. One variable, $$q$$ is from the old set, and one variable $$Q$$ is from the new.

Because we started off with $$2n=2$$ independent variables (which we initially agreed were $$q$$ and $$p$$), it should not be surprising that we can pick $$2n=2$$ new variables ($$q$$ and $$Q$$) that we treat as independent.

More clearly, as said by Arturo Don Juan in the related post: "How are $$q_i$$ and $$Q_i$$ separately independent? I thought $$Q_i$$ was, in general, a function of the original canonical coordinate variables $$q_i$$, thereby making it explicitly dependent on $$q_i$$"? (I didn't understand the answer given there)

In general $$Q$$ could be a function of $$q$$ and thus we could not, in general, take them as independent. But we are not interested in the completely general case, we are interested in the case of specific useful canonical transformations such as those generated by $$F_1(q,Q)$$.

For example, if we take $$F_1 = qQ$$ then $$P=-q$$ and $$Q=p\;,$$ where we see that $$Q$$ is not a function of $$q$$ in this useful case of a specific canonical transformation generated by $$F_1(q,Q)$$.

So, perhaps it is better to say that we require $$q$$ and $$Q$$ to be independent in our derivation of the $$F_1=F_1(q,Q)$$ specific canonical transformation. And this is certainly expected to be possible since there are two independent dimensions in phase space and there are two variables in the $$F_1$$ transformation.

I would be thankful if someone could clarify this, and provide references that deal with this point (if you know to direct me to an explanation for this point in Goldstein, Classical Mechanics it would be best).

The best explanation in Goldstein is probably the one I cited to above. I see no other more fulsome discussion that would specifically address your point. Probably all of Chapter 9 is generally relevant.

To complete our discussion of the simple harmonic oscillator, the canonical transformation generated by $$F_1 = qQ$$ leads to $$K = H(q(P),p(Q)) = H(-P, Q) = \frac{1}{2m}Q^2 + \frac{k}{2}P^2\;,$$ which basically just flips what we meant by "position" with what we meant by "momentum."

The system with $$s$$ degrees of freedom has a $$2s$$-dimensional phase space. Hence, as a description of the system state, out of the $$4s$$ variables - which includes $$2s$$ old phase space coordinates and $$2s$$ new phase space coordinates - only $$2s$$ are independent. From the perspective of the generating function, it needs to establish a connection between the new and old variables, so these $$2s$$ independent variables are always taken as "s old variables" and "s new variables". In the above discussion, the generating function $$F(t, q, Q)$$ is a function of $$s$$ old generalized coordinates and $$s$$ new generalized coordinates. The premise for this is that the $$2s$$ new and old generalized coordinates $$\{q, Q\}$$ are independent of each other, but this is not always the case. For example, in the case of an identity transformation $$Q^a = q^a, P_a = p_a$$ (which is certainly a canonical transformation), the new and old generalized coordinates $$\{q, Q\}$$ are not independent. In this case, one can only take the old generalized coordinates and new generalized momenta $$\{q, P\}$$, or the old generalized momenta and new generalized coordinates $$\{p, Q\}$$ as the $$2s$$ independent variables. Therefore, it is necessary to discuss other forms of generating functions. Since generating functions always involve both new and old variables, and involve different generalized coordinates and momenta, there are four basic types. These basic types are connected through Legendre transformations.

• Thank you, but i still don't get why we are allowed to take whatever 2s coordinates out of the 4s to be independent. Commented Apr 11 at 17:29
• @R24698 imagine the $\mathbb{R}^2$ plane. You can either describe it with $(x,y)$ or $(r, \theta)$. You have functions connecting the two sistems, but out of $(x,y, r,\theta)$ you can only pick 2 as indipendent variables, the other two are instead dependent on the indipendent ones Commented Apr 12 at 19:26
• @LolloBoldo thank you for answering, so if i got what you say is that we have 2 possible representations of the phase space - q,p and Q,P. We pick 2 of the coordinates, and we know from transformation equations (here they arise from the generating functions) how to relate q, p to Q, P, even though we started from a description, for example, of q and Q? Commented Apr 12 at 19:34
• Yep, just like you can use $(x, r)$ to describe your sistem if you know $(y,\theta)$ Commented Apr 12 at 21:19

As QMechanic described in his answer to the related post, the generating functions are defined on a $$4n$$ dimensional manifold. By definition you have $$4n$$ independent coordinates to describe a point on this manifold. The coordinate transformations come in by identifying $$2n$$ of these coordinates as the "old coordinates" $$\mathbf q$$ and $$\mathbf p$$, and the other $$2n$$ as the "new coordinates" $$\mathbf Q$$ and $$\mathbf P$$, and then defining $$2n$$ constraints between these coordinates which any physical state must satisfy. These $$2n$$ constraints allow you to express $$2n$$ of the $$4n$$ coordinates as functions of the other $$2n$$ (and possibly time). For example (using $$n=1$$ for simplicity), a type 1 generating function $$G(q,Q,t)$$ provides the constraint functions $$f_p(q,Q,t) = \frac{\partial G}{\partial q}$$ and $$f_P(q,Q,t) = -\frac{\partial G}{\partial Q}$$ so that a point on the constraint surface is $$(q,f_p(q,Q,t), Q, f_P(q,Q,t))$$ I used the notation $$f_p$$ and $$f_P$$ rather than $$p$$ and $$P$$ because I want to emphasize that these functions are constraints ($$p=f_p$$, $$P=f_P$$) rather than the independent coordinates themselves, and I hope this gets at your question directly by clarifying that the coordinates by themselves are independent and only become dependent via the constraint functions (and their inverses) which define coordinate transformations: Since a physical state is asserted to lie on the constraint surface, specifying $$q$$ and $$p$$ uniquely determines $$Q$$ and $$P$$. In particular, the constraints derived from generating functions are ensured to defined transformations to and from canonical coordinates.