Why do we prefer “Lagrangian and Hamiltonian mechanics ” over the newtonian mechanics? [duplicate]

Basically, I just want to know the advantages of Lagrangian and Hamiltonian mechanics over Newtonian mechanics, that made it much more preferable and widely used!

One of the chief practical advantages is that it allows you a crapload more freedom in your choice of coordinate system - letting you pick just the right one to be able to best simplify the equations of motion for the task at hand. What that means is we're not just confined to using things like Descartes-Fermat ("Cartesian"), cylindrical, or polar/spherical polars, but can use virtually arbitrary curvilinear coordinates.

Never underestimate the power of a good choice of coordinates. For example, orbital motion is better treated in polar coordinates than in Cartesian - just compare the equations for even simple circular orbital motion:

$$x(t) = R \cos(\omega t),\ \ y(t) = R \sin(\omega t)$$

versus

$$r(t) = R,\ \ \theta(t) = \omega t$$

Which one do you think is easier to work with algebraically? Which one gives you a better clue as to the shape of the motion?

Or with a system like the pendulum - ideally, you don't want to solve its motion in terms of Cartesian coordinates, but in terms of the angle $\theta$, since it is naturally constrained to move along an angular path. Effectively it has one dimension, not two.

The very general approach that lets you deal with such things - e.g. a bead moving along a spiral like in some old kids' toys (do they still use those things anymore?), is Lagrangian, and Hamiltonian, mechanics. The reason you need that is because while, say in the above example you can relatively straightforwardly get the polar from Cartesian example and vice versa, to do so you effectively need to apply a general coordinate change to all of space - and how would you make that necessary change for something as weird as the "helical coordinates" you'd need for the kids' toy?

Another advantage, however, is theoretical, is that you could argue that Lagrangian/Hamiltonian mechanics are a more fundamental way of dealing with physics problems. In regular Newtonian mechanics, we deal with force. But force isn't really so fundamental a concept as the one the other two deal with which is energy. Energy, momentum, angular momentum - these are the three most basic (along with space and time) quantities of mechanics. Force is actually a derived quantity - note Newton's second law is really best given as $\mathbf{F}_\mathrm{net} = \frac{d\mathbf{p}}{dt}$ and not the more "elementary" (really, pedagogical) $\mathbf{F}_\mathrm{net} = m\mathbf{a}$. L/H mechanics demonstrates its profound significance when you transition from classical physics to modern physics ... particularly, quantum mechanics, where the chief governing equation uses a Hamiltonian in it that is effectively the quantum generalization of the very same Hamiltonian that you heard in you know where... And even BETTER, when you get to the fully mature grand theory of Quantum Field Theory where you can finally begin to apprehend the Standard Model, our best theory of physics to date, in its full glory and thus after your long tutelage cast your eyes on the location of the frontiers of physics where all the work is being done by the cool folks with the cool stuff you hear about in the casual mags all the time about space and time and quantum gravity and all that good stuff only now to see it with the eyes of an expert, the Lagrangian makes its comeback as well.

(Why is this? Why not use force in QM still? Well if you think about it, force really only "persists" in CM because that there are times when energy seems to disappear, e.g. friction, and thus the description in terms of forces is more often useful than in terms of energy when dealing with real-world problems. But as we know, forces like friction that appear to not conserve energy are really just macroscopic manifestations of conservative forces acting on a microscopic scale (e.g. friction converting kinetic energy into heat and sound). QM is the theory of the microscopic scale, and thus you should be able to account for all energies in the description and indeed you can.)