To derive the relation between work function and potential energy 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
 A: I) Forget Lanczos's book & terminology for a moment. Recall that


*

*the Lagrangian 
$$\tag{1}L(q,v,t)~=~T(q,v,t)-U(q,v,t)$$ 
is usually of the form kinetic term minus potential term, where $U(q,v,t)$ is the generalized (possibly velocity-dependent) potential.

*the Lagrangian energy function is usually defined as$^1$
$$\tag{2}h_L(q,v,t)~:=~ v\frac{\partial L(q,v,t)}{\partial v}-L(q,v,t).$$

*if the Lagrangian $L$ does not depend explicit on time $t$, then the energy $h$ is conserved on-shell. 
II) Now let's define 
$$\tag{3} h_T(q,v,t)~:=~ v\frac{\partial T(q,v,t)}{\partial v}-T(q,v,t),$$
and 
$$\tag{4} h_U(q,v,t)~:=~ v\frac{\partial U(q,v,t)}{\partial v}-U(q,v,t).$$
Then 
$$\tag{5} h_L(q,v,t)~=~h_T(q,v,t)-h_U(q,v,t).$$
Note that (3) is just the kinetic term  $h_T=T$ if $T$ is quadratic in the velocities $v$.
III) Now let's return to Lanczos's notation. 


*

*What Lanczos calls the work function is minus the above generalized potential $U$. 

*What Lanczos calls the potential energy is $$\tag{6} V(q,v,t)~:=~-h_U(q,v,t).$$ 
Note that eq. (6) is not a Legendre transformation of some variables. Lanczos makes this definition (6) so that he gets to say that the total energy (2) is the sum $h_L=T+V$ of the kinetic and the potential energy when $T$ is quadratic in the velocities $v$.
References:


*

*C. Lanczos, The variational principles of mechanics, 1949.


--
$^1$ The energy function $h_L(q,v,t)$ in the Lagrangian formalism corresponds to the Hamiltonian $H(q,p,t)$ in the Hamiltonian formalism. See also e.g. this Phys.SE post.
