I'm reading "The variational principles of mechanics- Lanczos",
The author mentions a relation between Work-Function $U(q_1,q_2,\cdots,q_n,\dot q_1,\dot q_2,\cdots,\dot q_n)$ and the potential energy $V(q_1,q_2,\cdots,q_n)$
$$V=\sum_{i=0}^n \frac{\partial U}{\partial \dot q_i}\dot q_i-U \tag{1}$$
$q_i$'s are the generalized coordinates
The work function and the generalized force $(Q_j)$ are related as
$$Q_j=\frac{\partial U}{\partial q_j}-\frac{d}{dt}\frac{\partial U}{\partial \dot q_j} \tag{2}$$
Looking at the equation $(1)$ I can only tell that $V$ is the legendre transform of $U$ but I'm not able to prove it, The work function as we can see depends also on $\dot q_i$
And we usually have velocity-independent work functions, in this case equation $(1)$ reduces to $V=-U$, and equation $(2)$ becomes
$$Q_i=-\frac{\partial V}{\partial q_i}$$
Which is the well known equation for conservative forces
I searched the internet but couldn't find anything close to this, Can somebody give me a clue on how to derive this? Any help is appreciated