How is this Lagrangian derived? (Lagrangian with an exponential function) 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)\:.$$
 A: In general field theories Lagrangian are not derived: they are instead assigned (postulated) and proven against the equations of motion. Every Lagrangian that gives rise to the correct equations of motion is in principle a good Lagrangian for the system.
One can prove that for mechanical systems described by conservative forces $\textbf{F} = - \textrm{grad}\,V$ the expression $L = T-V$ is always a good Lagrangian, as it always generates the correct equations of motion.
In general, though, Lagrangian can be assigned according to conservation laws (or, equivalently other constraints) that one wants the system to obey to (this is the case when interaction terms among fields are present and they must satisfy this or that other condition). Furthermore, starting from one Lagrangian, one can prove that it may exist a group of transformations such that, acting on the initial one, further Lagrangian can be generated still preserving the equations of motion.

Can I use this lagrangian instead? Is it correct? 

As long as it generates the correct equations of motion.
