# Can all canonical transformation be obtained through generation function approaches?

The question can be formulated as following:

Suppose $$\delta \int_{t_1}^{t_2}{[p\cdot \dot{q} - H(p,q,t) ]dt} = 0$$ $$\delta \int_{t_1}^{t_2}{[P\cdot \dot{Q} - K(P,Q,t) ]dt} = 0$$

in which $$P = P(p,q,t), Q = Q(p,q,t)$$ is an invertible transformation.

Can we prove that there must exist a $\lambda$ and function $G(p,q,t)$ (or $G(p,Q,t)$, $G(P,Q,t)$, $G(P,q,t)$), such that $$\lambda[p\cdot \dot{q} - H(p,q,t) ] = [P\cdot \dot{Q} - K(P,Q,t) ] + \frac{dG}{dt}~?$$

Before we begin, note first of all, that there exist various definitions of a canonical transformation (CT) in the literature, cf. e.g. this Phys.SE post. For instance, OP's last equation (v1) is called an extended canonical transformation (ECT) in Ref. 1.

If we have a transformation $$\tag{A} (q,p)~\longrightarrow~ (Q,P)$$ (with possible explicit time dependence) that transforms the Hamilton's eqs. into Kamilton's eqs., will it be an ECT, at least locally?
The answer is: No, not necessarily. For instance, the example in this Phys.SE post is a counterexample. This can be shown by a slight modification of the proof in eqs. (4)-(7) of my answer in order to allow an arbitrary scale factor $\lambda$.
For completeness, let us mention that the opposite of (A) is true: An ECT transforms the Hamilton's eqs. into Kamilton's eqs. This follows because their two action functionals $S_K=\lambda S_H$ are proportional to each other (up to boundary terms). Therefore the EL eqs. (=Hamilton's eqs.) for $S_H$ corresponds to the EL eqs. (=Kamilton's eqs.) for $S_K$.