Is the Lagrangian formulation a mathematical inevitability? An analogy with functions:
Say, we have a function $f(x)$ and we have an equation to solve, $f(x)=0$. We can always re-formulate the problem of solving $f(x)=0$ with the problem of extremising $F(x)$, where $F(x)$ is the anti-derivative of $f(x)$. This is purely mathematical.
In physics, we postulate that the path taken by a particle $x(t)$ is completely determined by the initial conditions $x(t_0)$ and $v(t_0)$. Mathematically, this can be expressed as:
$$\frac{d^2 x(t)}{dt^2}=F(x(t),v(t))$$
or equivalently,
$$\frac{d^2 x(t)}{dt^2}-F(x(t), v(t))=0$$
This is an equation which takes a path $x(t)$ as input and evaluates to 0. This is similar to $f(x)=0$ in the analogy at the top of the post.
So, is it a mathematical certainty that we are able to re-formulate this problem in terms of extremising a functional which takes the path $x(t)$ as input? If yes, it's not obvious to me how.
 A: The cheapest way to make $F(x,\,\dot{x})-\ddot{x}=0$ an ELE is with an auxiliary variable $y$ viz. $L=y(F(x,\,\dot{x})-\ddot{x})$, so $y$ is dynamical. You may prefer to add a total derivative $\frac{d}{dt}(y\dot{x})$ to get an alternative Lagrangian, $L=yF(x,\,\dot{x})+\dot{y}\dot{x}$. If $x$ were complex-valued, the choice $y=x^\ast$ would be a common quantum-mechanical technique, although you'd want to make your Lagrangian Hermitian in the last step by adding a total derivative.
A: The title of the question is slightly different from the body of the question.
The Lagrangian formulation can be seen as resulting from extremizing an action (not extremizing in the same sense as the OP), but there are plenty of problems (with dissipation, or with forcing for instance) where generalized forces must be included "by hand" because they are not obtained from a potential.  For such problems the Lagrange function $L=T-V$ does not contain all the information to obtain the correct equations of motion without adding generalized forces explicitly.
That's not quite the same as interpreting $\ddot{x}-F(x(t),v(t))=0$ as an extremum problem since $F$ in this might be constructed to include generalized forces, and thus cannot necessarily be connected with the Lagrangian formulation.
A: Yes, it is. It is particularly obvious when the force $F$ is dependent only on the position and in 1D, we may always guarantee that there will always be a function $U$ such that $F=-\frac{\mathrm{d} U}{\mathrm{d} x}$, and thus one can write a lagrangian $L=T-U$. But even for dissipative systems one can have a Lagrangian formulation. In fact, it may be shown that every 1D Newtonian system has a Lagrangian formulation.
Speaking of 2D and 3D systems, while not all of them can be formulated as a variational problem for which $\delta \int_{t_1} ^{t_2}L \mathrm{d} t$, most systems that one may found in nature do and even those that do not have one, they always may be formulated in the form $$\frac{\mathrm{d}}{\mathrm{d} t}\frac{\partial T}{\partial \dot{q_i}}-\frac{\partial T}{\partial q_i}=Q_i,$$ a non-variational form of the Lagrange equations.
Here's a relevant talk on the topic https://www.youtube.com/watch?v=NJFa30hJY0Y (it's in Spanish, but the slides are in English.
