In the second answer of this post, Euler-Lagrange equations and friction forces
I see a normal Lagrangian (T-V) times an exponential function. $${\cal L}=e^{t\gamma/m}\left(\frac{m}{2}\dot{x}^2 -U(t,x)\right)\:.$$
And, in the #9 of this post, https://www.physicsforums.com/threads/lagrangian-of-object-with-air-resistance.693552/ , I also see a similar Lagrangian. $$L = e^{b t}(\dfrac{1}{2} m v^2)$$
How is this Lagrangian derived?
In the textbook and lecture notes online, I only see people use $$\frac{d}{dt}\left(\frac{\partial{L}}{\partial{\dot{q_i}}}\right)-\frac{\partial{L}}{\partial{q_i}}=Q_i$$ to deal with some situation with friction or air resistance. (the lagrangian remains unchanged)
Can I use this lagrangian instead? Is it correct? $${\cal L}=e^{t\gamma/m}\left(\frac{m}{2}\dot{x}^2 -U(t,x)\right)\:.$$