(Just some recalls)
We have an action on which we want to apply Least action principle.
$$ S=\int_{t_i}^{t_f} L(q,\dot{q},t)dt$$
We assume that $t \mapsto q(t)$ is the function that will extremise the action, thus if we replace :
$$q(t) \rightarrow q(t)+\delta q(t)$$
with $ \delta q(t_i)=\delta q(t_f)=0$
We will have at first order in $\delta q$ the variation of the action that will be zero.
$$ \delta S = \int_{t_i}^{t_f} \frac{\partial L}{\partial q} \delta q + \frac{\partial L}{\partial \dot{q}} \delta \dot{q} = 0 $$
And we say that because : $ \delta \frac{dx}{dt} = \frac{d \delta x}{dt} $, we can integer by part (the boundary term vanish because of (*)): $$ \delta S = \int_{t_i}^{t_f} (\frac{\partial L}{\partial q} - \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} )\delta q = 0 $$
My question :
It makes sense to me to say that, as :
$$q(t) \rightarrow q(t)+\delta q(t)$$
then by derivation I will have :
$$\dot{q}(t) \rightarrow \dot{q}(t)+\frac{d}{dt} \delta q(t)$$
We immediately find that $ \delta \frac{dx}{dt} = \frac{d \delta x}{dt} $, so it seems to be very general for any transformation.
But my teacher said it could'nt be the case for any transformation. I don't see why ??
What's more, just to understand :
In a Lagrangian, we consider $q(t)$ and $\dot{q}(t)$ as independant variables, because at a given point, if I have a value of a function, its derivative can take any values.
But the functions $q$ and $\dot{q}$ are not independant functions (they are linked by derivative operation).
So, we always have $\delta q(t)$ and $\delta \dot{q}(t)$ that are independant, and to proove that $ \delta \frac{dx}{dt} = \frac{d \delta x}{dt} $, we use the "trick" that, the functions associated are not independant.
In a sense, we "go" in the function space where functions are not independent and then we go back in "variable" spaces where they are independent.
Am I right ? And why did my teacher said that $ \delta \frac{dx}{dt} = \frac{d \delta x}{dt} $ is not always true, was him wrong?