History of Principle of Least Action I am interested in how Lagrange came up with Principle of Least Action. 
Is it derived from some experimental data or by mathematical deduction? And how? Either seems hard. 
I hope this might provide some better insight into Principle of Least Action.
 A: This question does belong here, I think.
It seems to me that the underlying purpose of the question is to seek for better understanding of the principle of least action. From that perspective, I'd say this question belongs here.
Here is what I remember from when I tried to find information about the history of Hamilton's principle of least action. (I'm not sure of my memory here; I recommend that you verify.)
I remember reading that Hamilton devoted much work to theoretical optics. Snell's law can be obtained from Fermat's principle of least time. As a mathematician, Hamilton was interested in finding a generalization of that particular application. That is, to find a comprehensive formulation of theoretical optics using variational calculus. If I remember correctly Hamilton achieved that, and these results were published.
Having accomplished much in optics Hamilton became interested in the question whether mechanics could also be restated in terms of variational calculus.
Hamilton was successful, but unfortunately, there is little if anything to learn from the result. Hamilton's approach was highly abstract. His strength was mathematical operations, and that is what he did. I assume that when publishing Hamilton provided proof that the variational form is mathematically equivalent to f=ma, but that doesn't necessarily give a perspective on why they are mathematically equivalent.
Current physics textbooks:
Some physics textbooks present a mathematical proof that the principle of least action is mathematically equivalent to f=ma, the usual form (to my knowledge) is to present a proof that uses integration by parts. This is one of those cases where the mathematics is good, but the steps of the proof give no clue whatsoever as to why it works.
There is a sept, 2020 answer that I wrote to a question about the reason for the principle of least action That answer focuses on the physical content.

David R. Wilkins, Trinity College Dublin, has made new transcriptions of the two essays by William R. Hamilton on Dynamics.
The titles of the essays are:

*

*On a General Method in Dynamics

*Second Essay on a General Method in Dynamics

William R. Hamilton's works on dynamics, Trinity College Dublin
Direct links to PDF's:
On a General Method in Dynamics
Second essay on a general method in Dynamics
A: It comes within the broader context of virtual work laws (which themselves ultimately originate from the law of the lever).
See:


*

*Danilo Capecchi, History of Virtual Work Laws: A History of Mechanics Prospective. (Springer, 2012).


*

*esp. §17.1.1 on Lagrange


*René Dugas, A History of Mechanics, trans. John Royden Maddox (London: Routledge, 1957).


*

*pt. 3 ch. 5


