Question about the apparent loophole in principle of least action: boundary condition vs initial condition In Lagrangian formalism, given two points $(x_1,t_1)$ and $(x_2,t_2)$, we ask the question which paths $x(t)$ make the action $S=\displaystyle \int_{t_1}^{t_2}L\ \mathrm dt$ stationary and satisfy the boundary condition $x(t_1)=x_1,\ x(t_2)=x_2$. This question is equivalent to solving the Euler-Lagrange equation 
$$\frac{\mathrm d}{\mathrm dt}\frac{\partial L}{\partial \dot{x}}=\frac{\partial L}{\partial q}$$
with boundary condtion $x(t_1)=x_1,\ x(t_2)=x_2$.
My question is why we are authorized to use the Euler-Lagrange equation to solve the initial condition problem $x(t_1)=x_1,\ \dot{x}(t_1)=v_1$. 
It seems that these are two different problems. One problem is to find a path satisfying the boundary condition $x(t_1)=x_1,\ x(t_2)=x_2$ and make the action stationary.
The other problem is to find a path with initial condition $x(t_1)=x_1,\ \dot{x}(t_1)=v_1$ and I even don't know how to put other requirements such that its equation of motion is the Euler-Lagrange equation. 
How can you prove these two problems are equivalent if you can make the second problem clear? Or maybe it is an axiom that we require the initial condition problem is solved by Euler-Lagrange equation. I'm confused about the logic of Lagrangian formalism.
 A: The issue is that the underlying classical physics is determined by equations of motion (EOMs) (i.e. Newton's 2nd law), which are common for initial value problems (IVPs) and boundary value problems (BVPs). For BVPs , the EOMs can often alternatively be formulated as Euler-Lagrange (EL) equations of a stationary action principle. The latter approach does never work for IVPs, because one does not have the correct boundary conditions to deduce EL equations via integration by parts. See also this related Phys.SE post and links therein.
A: Indeed the problem with boundary conditions, generally speaking, is not well-posed.
There are boundary conditions admitting no curves or admitting many curves, satisfying both these conditions and Euler-Lagrange equations.
Examples.
(1) Think of a particle constrained to stay on a smooth sphere where it can freely move. If you assign the North and the South  pole of the sphere as boundary conditions, you get infinitely many solutions as the motion always describes a geodesic. 
(2) Similarly, if you remove an open ball in $\mathbb R^3$ you do not have solutions when assigning boundary conditions on the opposite sides of the ball for a free particle in $\mathbb R^3$.
If $L$ is quadratic with respect to the $\dot{q}$ variables and this quadratic form is strictly positively defined, as is the case for systems of classical particles (also satisfying ideal holonomic constraints), the problem with initial conditions is always well-posed provided $L$ is sufficiently regular. There is exactly one maximal solution satisfying both Euler-Lagrange equations and initial conditions.
With these hypotheses also the problem with boundary conditions is well-posed with the additional condition that the two boundary conditions are sufficiently close to each other (this is evident from the two examples I presented above).
For these reasons a safer (mathematically minded) viewpoint is assuming that the variational principle determines the equation of motion, but not the solutions themselves.  
A: In this answer I want to discuss the habit of distinguishing between 'initial value problem' and 'boundary value problem'. This discussion will be for the context of classical mechanics. I expect the reasoning will generalize to other fields of physics.
I will first discuss the initial/boundary subject, and subsequently how that discussion ties in with the Euler-Lagrange equation.
This answer is inspired by a blog post by Chad Orzel.
(At the end of this answer I quote the key remark by Chad Orzel.)

For completeness I start with the trivial case of an object moving at a uniform velocity, with one spatial degree of freedom:
Initial value problem:
A train is moving at $x/t$ kilometers per hour. How long does it take to reach a destination $x$ kilometers away?
Boundary value problem:
A train travels to a train station $x$ kilometers away. At what velocity must the train travel such that it arrives at the destination after $t$ hours?
We have:
When the problem is stated as an initial value problem we solve it by way of extrapolation, when the problem is stated as a boundary value problem we solve it by way of interpolation. The '-polation' of 'extrapolation' and 'interpolation' is related to the verb 'to polish'; you are obtaining a smooth result.
The difference between stating a problem as an initial value problem or a boundary value problem is that the order of operations to solve the problem is different, that is all.

For the next level up we allow a known uniform acceleration, and two spatial degrees of freedom.
You have a cannon that can shoot projectiles. Firing of a projectile occurs from a level surface, so that the projectile impacting the ground is at the same height as when it was fired. Assume standard Earth gravity.
Initial value problem:
Given a nozzle velocity, and angle of the barrel with respect to the horizontal, what is the horizontal distance that the projectile will travel, and what will be the duration of the flight?
Boundary value problem:
What must the horizontal velocity component be, and what must the vertical velocity component be, such that the horizontal distance traveled is x meters, and the duration of the flight is t seconds?
The point is:
Just as in the simpler case of uniform velocity: the only difference between stating the problem as an initial value problem or a boundary value problem is the order of operations needed to solve the problem.


Distinction between 'initial value problem' and 'boundary value problem' boils down to distinction between extrapolation and interpolation, and that distinction is moot.
The common factor of interpolation and extrapolation is that you ensure continuity, smoothness. It's the condition of maintaining continuity that makes it work.
In particular: for a differential equation distinction between interpolation and extrapolation is moot. (In both cases it hinges on making sure continuity is satisfied.)


The process of deriving the Euler-Lagrange equation
The process of deriving the Euler-Lagrange equation removes all elements that are unnecessary.
I repeat with different words:
In the course of deriving the Euler-Lagrange equation various elements are removed. The elements that are removed are superfluous as far as solving the physics problem is concerned.
(From here on I will abbreviate Euler-Lagrange equation to: EL-eq.)
When you start deriving the EL-eq. the boundary conditions are treated as variables in the sense that the boundary conditions are not stated as numerical values; the boundary conditions are left unspecified. By allowing the boundary conditions to be variables you are obtaining a very general result. What you obtain is not tied to any specific boundary conditions, and what that does is that application of boundary conditions is deferred.
In the course of deriving the EL-eq. you introduce a way of representing variation. (Most often a symbol such as  $\epsilon$ is used to manipulate the variation.) In the final stage of deriving the EL-eq. the variation is eliminated. In a sense the variation is like a catalyst; it is involved in the derivation, but it is not present in the final result.
What is also eliminated: at the start of deriving the EL-eq. an integration is specified. In the final stage that integration is eliminated. You cannot not eliminate that integration. The only way to derive the EL-eq. at all is to follow through, and eliminate the integration.


We have that the Euler-Lagrange equation is a differential equation.
As we know: a differential equation is a mathematical entity that is inherently describing a local property. By contrast: integration is evaluation of a global property.
The fact that the Euler-Lagrange equation is a differential equation is the very thing that makes it so powerful.
The derivation of the Euler-Lagrange equation is set up in such a way that the boundary conditions are treated as variables. What that does is that application of the boundary conditions is deferred.
The power of the Euler-Lagrange equation is that it is a differential equation; distinction between boundary value problem and initial value problem is moot.

See also:
An october 2021 answer by me with discussion of Hamilton's stationary action








About that blog post by Chad Orzel:
Chad Orzel raises the question:

is [...] teleological interpretation of least-action principles an accurate reflection of actual physics?

Chad Orzel points out:

[...] it amounts to specifying a starting position and an ending position and being amazed that the path is determined, but if instead you specified a starting position and starting velocity, the path is equally inevitable, but somehow that feels less magical.

