# Velocity in generalized coordinates

Consider the expression of velocity in generalized coordinates, $\mathbf v = \frac {d \mathbf x}{dt}$, where $\mathbf x = \mathbf x (\mathbf q(t), t)$. We end up with a total derivative, i.e $$\mathbf v=\frac {d\mathbf x}{dt}=\sum_i \frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t} + \frac {\partial \mathbf x}{\partial t}$$

The meaning of such construction is clear to me...but what would stop me from using the chain rule in the following way:$$\frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t}=\frac {\partial \mathbf x}{\partial t}~?$$

• Because you are not accounting for the dependency on $t$ in $\mathbf{x}$. The second construction is incomplete. – John Alexiou Dec 6 '17 at 18:47
• Isn't it also because $$\frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t}$$ is more correctly written as $$\frac {\partial\mathbf x}{\partial q_i} \frac{dq_i}{dt}?$$ – Lo Scrondo Dec 6 '17 at 21:43

The partial derivative is a very confusing object. Say you have a function of two variables, $f(q,t)$. In this case, $f$ has a direct dependence on $t$. The partial derivative is defined as: $$\frac{\partial f}{\partial t}=\lim_{h\to0}\frac{f(q,t+h)-f(q,t)}{h}$$ What this means effectively is that you're holding constant all the other variables (in this case $q$). Since $q$ has no $t$ dependence, in this case the total derivative is the same as the partial derivative: $$\frac{df}{dt}=\frac{\partial f}{\partial t}$$ This is consistent with the chain rule.

However, you may also consider a "path" $q(t)$. Now $f$ depends on $t$ both directly (like before) and indirectly through $q(t)$. The partial derivative stays the same (you can replace $q=q(t)$ in the formula above, but you're still holding $q$ constant). However now when you compute the total derivative, you need to take into account both the direct and the indirect $t$ dependence of $f$: $$\frac{df}{dt}=\frac{\partial q}{\partial t}\frac{\partial f}{\partial q}+\frac{\partial t}{\partial t}\frac{\partial f}{\partial t}=\frac{dq}{dt}\frac{\partial f}{\partial q}+\frac{\partial f}{\partial t}$$ The partial derivative of $q(t)$ is the same as the total derivative because it only has one argument (write down the two definitions: they are the same). In terms of limits what you're doing now is: $$\frac{\partial f}{\partial t}=\lim_{h\to 0}\frac{f(q(t+h),t+h)-f(q,t)}{h}$$ which you can see is different than what we previously had.

As an example if $f(q,t)=tq^2$, then of course $\frac{\partial f}{\partial t}=q^2$. If moreover we're interested in the path $q(t)=2t$, then we can of course substitute it directly. Defining a new function of one argument, $g(t)=f(q(t),t)=tq(t)^2=4t^3$ we can compute its total derivative directly: $$\frac{dg}{dt}=12t^2$$ We could have equally used the chain rule: $$\frac{df(q(t),t)}{dt}=\frac{dq}{dt}\frac{\partial f}{\partial q}+\frac{\partial f}{\partial t}=(2)(2tq)+q^2=8t^2+4t^2=12t^2$$ This illustrates an important distinction. Since $g(t)$ only has one argument, $$\frac{dg}{dt}=\frac{\partial g}{\partial t}$$ However, it is not true that the partial and total derivatives of $f$ with respect to $t$ are the same. So despite $g(t)=f(q(t),t)$, their partial derivatives are not the same. Carefully, one should really write: $$\left(\frac{\partial f(q,t)}{\partial t}\right)_q$$ This notation is meant to emphasise the fact that while differentiating with respect to $t$, you're keeping $q$ constant. However people rarely use this.

The generalisation to several variables is straightforward.

To answer your question in the comments, you can equally write $$\frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t}\,\,\,\,\,\,\,\,\, \mathrm{or}\,\,\,\,\,\,\,\,\, \frac {\partial\mathbf x}{\partial q_i} \frac{dq_i}{dt}$$ because the $q_i$ are functions of one variable. That's not the crucial point. When you write something like: $$\frac {\partial \mathbf x}{\partial t}=\frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t}$$ you're probably relying on an intuitive "cancelling" of the $q$ factors. That can take you far with one-variable calculus, but it doesn't work with partial derivatives. You have to be a lot more careful in keeping track of what you're keeping constant. Note however that you can write something like: $$\frac {\partial \mathbf x}{\partial t}=\frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t}+\frac {\partial \mathbf x}{\partial t}$$ but you should always remind yourself of what you're holding constant in the partial derivative. If nothing is written, all the other variables are kept constant. So more properly that would be: $$\left(\frac {\partial \mathbf x}{\partial t}\right)_{\textbf q}=\frac {\partial\mathbf x}{\partial q_i} \left(\frac{\partial q_i}{\partial t}\right)_{\textbf q}+\left(\frac {\partial \mathbf x}{\partial t}\right)_{\textbf q}$$ The formula is therefore self-consistent, because the first term on the RHS is zero.

Getting used to partial derivatives take time. My advice is to give up usual intuitive rules from single variable calculus, and always remember that when you're doing a partial derivative you're keeping something constant.

There is nothing wrong with using the chain rule over there, since you are expressing only a partial derivative. It is perfectly correct.

What cannot be done is to write $\frac{d\bf{x}}{dt} = \frac{\partial \bf{x}}{\partial q_i}\frac{\partial q_i}{\partial t}$. This is wrong because it neglects the meaning of $\frac{d}{dt}$ as a total derivative.

• No because $$\frac {\partial\mathbf x}{\partial q_i} \frac{\partial q_i}{\partial t} \neq \frac {\partial \mathbf x}{\partial t}$$ Consider the example of $\mathbf{x} = \pmatrix{K_1 \\ K_2} \sin t + \pmatrix{q_1(t) + q_2(t) \\ q_2 (t)}$ – John Alexiou Dec 6 '17 at 18:56