Why don't we differentiate velocity wrt position in the Lagrangian?
Solution 1:
This is an excellent question! And the answer has its roots back in the origin of the Euler-Lagrange equations as solutions to Hamilton's variational principle.
Recall that the Euler-Lagrange equations are the result of extremising the action $$S(q[t]) = \int_0^T L(q, \dot q)\,dt.$$ It is conventional to write $L$ as function of $q$ and $\dot q$ (and this will lead to the cleanest formulation of the Euler-Lagrange equations) but it is by no means rigidly required: you could add $q^2$ as a third argument to the functional $L$, if you really wanted to, and of course $q$ and $q^2$ are not independent.
Now the usual derivation is to look at variations $\delta q(t), \delta q(0) = \delta q(T) = 0$, which yields
$$\frac{d}{ds}S(q[t]+s\delta q[t])\Bigg\vert_{s\to 0} = \int_0^T \left[(D_1 L)(q, \dot q)\delta q + (D_2 L)(q,\dot q) \delta \dot q\right]\,dt,$$ where $D_iL$ means differentiating $L$ with respect to the $i$th parameter. Notice that the above in no way requires that the values that are plugged in to $L$ (namely $q$ and $\dot q$) are independent! $D_1L$ is often written as $\frac{\partial L}{\partial q}$, but this is an abuse of notation: we are merely differentiating the two-parameter function $L$ with respect to its first argument, without knowing or caring what we will eventually plug into $L$.
Now we apply the usual integration by parts,
$$\int_0^T \left[(D_1L)(q,\dot q) - \frac{d}{dt}\left[(D_2L)(q,\dot q)\right]\right]\delta q = 0,$$ where the time derivative, unlike the two derivatives of $L$, happens after plugging in $q$ and $\dot q$, and we recover the usual equations of motion by taking $\delta q$ to be bump functions at all times in $(0,T)$.
Solution 2:
This is an excellent question (and I'm biased because I also have it) no one seems able to answer it well. Here are some threads about it I have found which discuss it:
(1) https://physics.stackexchange.com/questions/168551/independence-of-position-and-velocity-in-lagrangian-from-the-point-of-view-of-ph
(2) https://physics.stackexchange.com/questions/885/why-does-calculus-of-variations-work
The best I have been able to discern is the following: the Euler-Lagrange equation essentially defines the velocity to be the derivative of the position with respect to time. Without assuming the Euler-Lagrange equation, velocity is NOT the time derivative of position.
When we consider phase space, $q$ and $\dot{q}$ are just variables, so I will denote $\dot{q}=r$. I.e. in general NO relationship holds between $q$ and $\dot{q}$.
So the Lagrangian is just a regular function of two variables.
(In the simplest case, phase space is just $\mathbb{R}^3$ with axes $t,q,r$).
The Euler-Lagrange equation then gives us a particular curve in phase space (NOT all of phase space).
The curve is in three dimensions and we can project it onto the $tq$ plane.
On this plane, the curve happens to define $q$ implicitly as a function of $t$ (I don't know how to prove this or exactly why it's true, but it does seem to be the case).
So we have a function, denote it $x : \mathbb{R} \to \mathbb{R}$ such that for all $t$: $x(t)=q$, i.e. $x: t \mapsto q$.
For some reason (which I also don't know and can't prove) $x(t)$ is a differentiable function of $t$. So $x'(t)$ is well-defined for all $t$.
Therefore, for every point $t \in \mathbb{R}$, we have a point in $\mathbb{R}^2$=tq-plane which is $(t, x(t))=(t,q)$ defined implicitly by the projection of the curve given by the solution to the Euler-Lagrange equation.
Therefore, given any point in the projection of the curve in the tq-plane, we consider the original point in $\mathbb{R}^3$ it was projected from --> $(t,q,r)=(t,x(t),r)$.
Now the Euler-Lagrange equations are such that it turns out that $x'(t)=r$ (I don't know how to prove this either) -- hence our point on this curve in 3-space can be written as $(t,x(t),x'(t))=(t,x(t),r)=(t,q,r)$.
Since physicists already know in advance that, for the curve in 3-space defined by the Euler-Lagrange equation which they will be considering (note that they don't consider any remaining part of phase space where this is NOT true), it will be true that $r=x'(t)$ and $q=x(t)$, they just call the variables $x$ and $\dot{x}$ i.e.
The notation that physicists use is a sloppy abuse of notation that assumes in advance that only the solution curve of the Euler-Lagrange equation (which is equivalent to the principle of least action) will hold (since they always assume that it holds).
So in some sense (if you consider the entire $r$ axis in phase space, and not just those points which are part of the solution curve of the Euler-Lagrange equation) $\dot{x}$ isn't the velocity of $x$, so they really are just independent variables.
I would love to see to a rigorous proof of all of this myself, but so far this is the only answer that has made sense to me.
A picture that sort of explains the idea of what I am trying to say:
Solution 3:
I think your are getting confused by the notations of the partial derivative. If $L$ is a function of two variables, $L:(x,y)\mapsto L(x,y)$, $\dfrac{\partial L}{\partial x}$ is the derivative with respect to the first variable and $\dfrac{\partial L}{\partial y}$ w.r.t to the second (if you write these derivatives $\partial_1 L$ and $\partial_2 L$, there is no possible confusion). Then $x$ and $y=\dot x$ are two independent variables of the function $L$ and $\partial_2 L$ is the derivative of $L$ w.r.t. the second variable. Here, you need to evaluate this second derivative in a particular value (i.e. $\dot x$).
In short, $x$ and $\dot x$ are independent variables of $L$.
Solution 4:
[Second answer, separately because it is different]
Maybe this will help: This independency of position and velocity can be seen in Newton's equation: it is a second order differential equation. To solve it (uniquely) for a 1-dof system, you need two initial conditions (initial position and initial velocity).