# Calculation step in deriving Hamiltonian from Lagrangian

Suppose we have the following equation :

$$L=\frac{1}{2}\sum_{ij}\dot{q_i}\space T_{ij}\space\dot{q_j}$$

Here $$T_{ij}$$ is a symmetric matrix, that depends on $$q_i,t$$. Suppose, I want to evaluate $$\frac{\partial L}{\partial\dot{q_j}}$$. So now we have,

$$\frac{\partial L}{\partial\dot{q_k}}=\frac{1}{2}\frac{\partial }{\partial\dot{q_k}}\sum_{ij}\dot{q_i}\space T_{ij}\space\dot{q_j}$$

In one of the lecture notes, my professor wrote that this is equivalent to,

$$\sum_i T_{ik}\space\dot{q_k}$$

However, this doesn't seem correct to me. According to me,

$$\frac{\partial L}{\partial\dot{q_k}}=\frac{1}{2}\frac{\partial }{\partial\dot{q_k}}\sum_{ij}\dot{q_i}\space T_{ij}\space\dot{q_j}=\sum_i T_{ik}\space\dot{q_i}$$

This should be the correct equation ( note that I've replaced $$\dot{q_k}$$ by $$\dot{q_i}$$, which is what we are summing over. )

Suppose both $$i,j$$ range from $$1$$ to $$3$$. Then according to my teacher,

$$\frac{\partial L}{\partial \dot{q_3}}=T_{13}\dot{q_3}+T_{23}\dot{q_3}+T_{33}\dot{q_3}$$

According to me however,

$$\frac{\partial L}{\partial \dot{q_3}}=T_{13}\dot{q_1}+T_{23}\dot{q_2}+T_{33}\dot{q_3}$$

Can someone tell me who is correct ? Was there a simple printing error in my teacher's notes, or am I making an obvious mistake in here ?

• I am wondering who instant downvoted this question ... May 26, 2022 at 15:25
• Your indices are a bit messed up. If you want a contraction you need above and lower indice. In first equation, I would have written $\dot{q}^i T_{ij} \dot{q}^j$ but I suppose if you know what you are doing it is fine May 26, 2022 at 15:26
• Secondly, you're abusing notation a bit when you did the partial derivative, you should do the partial with a new index. Otherwise there is a conceptual difficulty of discerning between summation variables and the derivative variables May 26, 2022 at 15:27
• is T_{ij} independent of position? May 26, 2022 at 15:33
• @Aplateofmomos thank you so much, I understood this. Moreover, I think my mistake here was to not use the covariant and contravariant indices properly. I'll look up the reference on tensor notation surely. May 26, 2022 at 16:29

Just use Einstein summation to clear things up. $$L=\frac{1}{2}T_{ij}\dot{q_i}\dot{q_j}$$ $$\frac{\partial L}{\partial \dot{q_k}}=\frac{1}{2}T_{ij}\left[\dot{q_i}\frac{\partial \dot{q_j}}{\partial \dot{q_k}}+\dot{q_j}\frac{\partial \dot{q_i}}{\partial \dot{q_k}}\right]=\frac{1}{2}T_{ij}[\dot{q_i}\delta_{jk}+\dot{q_j}\delta_{ik}]=\frac{1}{2}T_{ij}\dot{q_i}\delta_{jk}+\frac{1}{2}T_{ij}\dot{q_j}\delta_{ik}=\frac{1}{2}\dot{q_i}T_{ij}\delta_{jk}+\frac{1}{2}\dot{q_j}T_{ij}\delta_{ik}=\frac{1}{2}\dot{q_i}T_{ik}+\frac{1}{2}\dot{q_j}T_{jk}$$ where we have used $$T_{ij}=T_{ji}$$ for evaluation of the second term in the sum. Since the summation is over $$i,j$$ these two are really the same quanity, hence we have $$\frac{\partial L}{\partial \dot{q_k}}=\dot{q_i}T_{ik}=\sum_i\dot{q_i}T_{ik}$$ So$$\frac{\partial L}{\partial \dot{q_3}}= \dot{q_1}T_{13}+\dot{q_2}T_{23}+\dot{q_3}T_{33}$$ It would seem that you are correct, not the professor.

• Good answer. But.. how does this answer say something I haven't said o_o May 26, 2022 at 21:23
• @Aplateofmomos It doesn't say anything new, but I feel that it shows a bit more clearly how terms get condensed with the Kronecker delta and Einstein summation.
– tmaj
May 27, 2022 at 5:21
• Don't take me in the wrong way, if your idea was to write it in Einstein notation your indices are all messed up. Here you are considering covariant and contra as total same. But disregarding that , reason I wrote way I did is because idts OP is well versed with einstein notation May 27, 2022 at 8:51
• @Aplateofmomos The concern with covariance/contravariance doesn't arise here because we are not treating the Kronecker delta as a $(1,1)$ tensor in this calculation.
– tmaj
May 27, 2022 at 13:58
• I mean however you treat it, there is a conceptual depth to it rather than index bashing. The indical signature tells you how they transform. The way you wrote suggest it not even is a tensor. Well it is so with me as well but that was mostly intentional May 27, 2022 at 15:30

We have,

$$L = \frac12 \sum \dot{q}_i T_{ij} \dot{q}_j$$

Taking the derivative of both side with $$p$$th coordinate and interchanging derivative with sum:

$$\partial_{\dot{q}_p} L = \frac12 \sum \partial_{\dot{q}_p} (\dot{q}_i T_{ij} \dot{q}_j)$$

Tricky term is $$\partial_{\dot{q}_p} (\dot{q}_i T_{ij} \dot{q}_j)$$, we will work that out seperately:

$$\partial_{\dot{q}_p} (\dot{q}_i T_{ij} \dot{q}_j)= \delta_{ip} T_{ij} \dot{q}_j + \dot{q}_i T_{ij} \delta_{pj}$$

Now, let's put this back in the summation:

$$\partial_{\dot{q}_p} L = \frac12 \sum_{i,j} \delta_{ip} T_{ij} \dot{q}_j + \dot{q}_i T_{ij} \delta_{pj} + \dot{q}_i \dot{q}_j\partial_{\dot{q}_p} T_{ij} = \frac12 \left[\sum_{i,j} \delta_{ip} T_{ij} \dot{q}_j + \sum_{i,j} \dot{q}_i T_{ij} \delta_{pj} \right]$$

Now suppose we consider the second summation $$\sum_{i,j} \dot{q}_i T_{ij} \delta_{pj}$$, since $$i,j$$ are dummy and further more the matrix is symmetric we can swap $$i <--> j$$, this gives the same thing as first term giving us:

$$\partial_{\dot{q}_p} L= \sum_{i,j} \dot{q}_i T_{ij} \delta_{pj}$$

At this point , we can use the property of the $$\delta$$ symbol. Since the it is only equal $$1$$ when $$p=j$$, we can replace all our $$j$$ with $$p$$:

$$\partial_{\dot{q}_p} L= \sum_{i,p} \dot{q}_i T_{ip}$$

But, $$p$$ is just one number (derivative index, so we have:

$$\partial_{\dot{q}_p} L= \sum_{i} \dot{q}_i T_{ip} = \dot{q}_1 T_{1p} + \dot{q}_2 T_{2p} + \dot{q}_3 T_{3p}$$

*:Note that I am abusing tensor notation a bit, but I am doing it so that it is smthn OP is familiar with. Many physics book don't get the right index placement so who cares anyways.