I am solving a pendulum attached to a cart problem. Without going into unnecessary details, the generalised coordinates are chosen to be $x$ and $\theta$. The kinetic energy of the system contains a term (which contains) $\dot x\dot\theta\cos\theta$. Now when evaluating $\frac{\mathrm d}{\mathrm dt}(\frac{\partial T}{\partial\dot\theta})$ for this term, should the answer be just $\ddot x\cos\theta$ or $\ddot x\cos\theta-\dot x\dot\theta\sin\theta$? The former gives the correct equation of motion but I am not able to understand why it is not the latter, because $\theta$ also varies with time. I have checked that my kinetic energy expression is correct.
EDIT: To make the question clearer, I do not have a doubt in the fact that $$\frac{\partial}{\partial\dot\theta}(\dot x\dot\theta\cos\theta)=\dot x\cos\theta$$ My doubt is what is $$\frac{\mathrm d}{\mathrm dt}(\dot x\cos\theta)$$ equal to, more particularly, do we use the product rule to evaluate it or not? Because the correct answer seems to come about without using the product rule but that would mean assuming $\theta$ does not depend on time. Where am I wrong?