The action of a physical system My knowledge in this topic is as follows, correct me if I'm wrong.:
the action $S$ of a physical system is quantity such that the system evolves so that it's extemized, maximized or minimized, usually it's a definite integral so for example: $S=\int_{t_1}^{t_2}L(\dot{x},x,t)dt$ and the condition becomes $\delta S=0$. This can be solved using the Euler-Lagrange equation to find the $x(t)$ that extremize $S$ and it becomes the equation governing the variables of the physical system.
Now my questions are:
which one comes first? does one knows the equations of the system and then make a lagrangian for them? and if so why? or is it vice versa?
 A: Let's just talk about classical mechanics, and ignore quantum mechanics.
There are several different equivalent formulations of classical mechanics. I will review a few of them; you mentioned the first two:

*

*Newton's laws: coupled sets of second order differential equations involving particle positions and forces.

*Lagrangian mechanics: a classical system takes the path that minimizes the action (or really for which the action is stationary when small changes to the path are made).

*Hamiltonian mechanics: coupled sets of first order differential equations involving the position and momenta.

*Hamilton-Jacobi equation: A second-order wave equation describing the motion of a single particle or group of particles.

Under certain conditions (such as the lack of any dissipative forces), these different approaches can be shown to be equivalent. If you start with, say, the action, you can derive the equations of motion in Newtonian and Hamiltonian mechanics, the Hamilton-Jacobi equation, etc. You can pass from any one formalism to any other.
Since they are all equivalent, it doesn't make sense to say that one "comes first." Rather we use whatever formulation is the most useful for a given problem. The ultimate test of correctness we have on any particular model is by comparing the predictions of that model with an experiment. A model can be formulated in any of the above languages, and the same model expressed in different languages will give the same predictions.
One way in which the different approaches are not equivalent is on a psychological level: how they suggest looking for generalizations of the laws we already have. In particular, Newton's laws don't generalize very well to quantum mechanics, while Hamiltonian and Lagrangian mechanics do.
A: By solving the equation of motion for a physical system, you can get the solution $x(t)$ that describes the behavior of that system. Both Newtonian and Lagrangian methods give you a means to get the equation of motion. In the former, you have F=ma at disposal whereas, for the latter, you have the Euler-Lagrange equation. However, for rendering the E-L equation to be giving the equation of motion, the Lagrangian, L is needed, which you construct by the formula L=T-V. Therefore, speaking of the Lagrangian method entirely, basically, the Lagrangian comes before the equation of motion as you can't know the equation of motion in the first place. On the other hand, if you have known the equation of motion for a physical system, it is always an intriguing endeavor to find out the appropriate Lagrangian that leads to the known equation of motion. In the end, we are interested in the equation of motion for that system as well as the solutions.
Historically, Newtonian formalism came before Lagrangian formalism. It was only when the investigation of geometrical optics via Fermat principle and mechanics via Maupertuis's principle that the variational principle approach started and ultimately lead to Lagrange formalism and then the Hamiltonian approach. For gaining a little insight into these two different formalisms (Newtonian and Lagrangian), it is good to compare how they lead to the equation of motion. In Langrangian formalism, the notion of force is absent, and only generalized coordinates and generalized velocities are used. This gives an edge to it over the Newtonian counterpart as it can be generalized to a broader class of systems, not just the mechanical ones. For instance, the Lagrangian approach can lead to the 'equation of motion' for classical electrodynamics, namely Maxwell's equations if the scalar potential and vector potential are chosen as generalized coordinates. All these cannot be done by using the Newtonian approach except that the Lorentz force law. Note that the Lorentz force law can also be derived by the Lagrangian approach, though this time the position of particles is chosen as generalized coordinates.
Therefore, conceptually speaking, the Lagrangian approach is more fundamental than Newtonian formalism as it can lead to the equation of motion in many branches of physics. It is clear now that the equation of motion the Lagrangian formalism derived not just applies to particles, but fields as well. Mathematically speaking, these 2 approaches are equivalent in the sense that they could lead to each other mathematically, although the conceptual leap from Newtonian to Lagrangian is larger than the other way around.
If you have the equation of motion for a given system, you could still seek its Lagrangian to spot out the symmetry and its implication(s). One simple example is classical electrodynamics again. By using the Lagrangian formulation of electrodynamics, the fact that the requirement of gauge invariance implies charge conservation can be derived. The Lagrangian is not unique since there could be more than one Lagrangian that lead to the same EOM. Consider the Lagrangian functions $L(q,\dot q,t)$and $L'(q,\dot q,t)$ related by
$$L'(q,\dot q,t)=L(q,\dot q,t)+\frac{d}{dt}f(q,t).$$
Such Lagrangians are called equivalent in the sense described below. The actions $S$ and $S'$
$$S[q]=\int^{t_2}_{t_1} L(q,\dot q,t)dt,\qquad S'[q]=\int^{t_2}_{t_1} L(q,\dot q,t)dt.$$
only differs by a constant term,
$$S'[q]-S[q]=f(q_2,t_2)-f(q_1,t_1),$$
where $q_2=q(t_2)$ and $q_1=q(t_1)$. So we have
$$\delta S[q]=\delta S'[q].$$ For questions concerning the existence of some Lagrangian dynamics involving more than one, but not equivalent, Lagrangians, I am not sure about that.
