First question on Math StackExchange here. I have been staring at this for a bit, but wasn't quite able to get the hang of it. Here it goes.
We are given \begin{align} \frac{\partial}{\partial x} = \cos{\theta}\frac{\partial}{\partial r} - \frac{\sin{\theta}}{r}\frac{\partial}{\partial \theta}. \end{align}
We would like to square this operator to get \begin{align} \frac{\partial^2}{\partial x^2} & = \Big[\cos{\theta}\frac{\partial}{\partial r} - \frac{\sin{\theta}}{r}\frac{\partial}{\partial \theta} \Big]^2 \\\\ & = \Big(\cos{\theta}\frac{\partial}{\partial r} - \frac{\sin{\theta}}{r}\frac{\partial}{\partial \theta} \Big) \Big(\cos{\theta}\frac{\partial}{\partial r} - \frac{\sin{\theta}}{r}\frac{\partial}{\partial \theta} \Big) \\\\ & = \cos^2{\theta} \frac{\partial^2}{\partial r^2} - 2 \Big(\frac{\sin{\theta}\cos{\theta}}{r} \Big) \frac{\partial^2}{\partial r \partial \theta} + \frac{\sin^2{\theta}}{r^2} \frac{\partial^2}{\partial \theta^2} + \frac{2\sin{\theta}\cos{\theta}}{r^2} \frac{\partial}{\partial \theta} + \frac{\sin^2{\theta}}{r}\frac{\partial}{\partial r} \end{align}
Now here's the part that I don't get. To me first three terms on the last line make perfect sense. But instead of stopping there, squaring the operator gives the last two terms, which I don't understand. My guess is that it has to do with the coefficients, but I would like to know exactly how this works.
To be more even specific, my question reduces to
\begin{align} \Big( \cos{\theta} \frac{\partial}{\partial r} \Big) \Big(-\frac{\sin{\theta}}{r} \frac{\partial}{\partial \theta} \Big) \end{align}
What does this equal and why? The more detailed the explanation, the better.
To provide some context, this was part of a step to show the two-dimensional Laplace operator in polar coordinates in a PDE textbook.
Thank you so much!!
These terms come from applying the product rule when multiplying out the operators: For example, the outer terms read as $$\left(\cos\theta\frac{\partial}{\partial r}\right)\left(-\frac{\sin\theta}{r}\frac{\partial}{\partial \theta}\right)=-\cos\theta\frac{\partial}{\partial r}\left(\frac{\sin\theta}{r}\frac{\partial}{\partial \theta}\right) $$ You must then apply the product rule to the $\frac{\partial}{\partial r}\left(\frac{\sin\theta}{r}\frac{\partial}{\partial \theta}\right)$ term since you are taking the $r$ derivative of the product $\frac{\sin\theta}{r}\frac{\partial}{\partial \theta}$, giving $$-\cos\theta\left[\frac{\partial}{\partial r}\left(\frac{\sin\theta}{r}\right)\frac{\partial}{\partial \theta}+\frac{\sin\theta}{r}\frac{\partial}{\partial r}\left(\frac{\partial}{\partial \theta}\right)\right] =-\cos\theta\left(-\frac{\sin\theta}{r^2}\frac{\partial}{\partial \theta}+\frac{\sin\theta}{r}\frac{\partial^2}{\partial r\partial\theta}\right)=\ ...$$
Hope that clarifies those extra terms.