$$(\cos \phi \frac \partial {\partial \rho} - \frac {\sin \phi} \rho \frac \partial {\partial \phi})(\cos \phi \frac {\partial g} {\partial \rho} - \frac {\sin \phi} \rho \frac {\partial g} {\partial \phi}) $$ $$=\cos ^2 \phi \frac {\partial ^2 g} {\partial \rho ^2} + \frac {2 \cos \phi \sin \phi} {\rho ^2} \frac {\partial g} {\partial \phi} - \frac {2 \cos \phi \sin \phi} \rho \frac {\partial ^2 g} {\partial \phi \partial \rho} + \frac {\sin ^2 \phi} \rho \frac {\partial g} {\partial \rho} + \frac {\sin ^2 \phi} {\rho ^2} \frac {\partial ^2 g} {\partial \phi ^2}$$ photo of the formula
I can't wrap my head around how this is the result yielded by the expansion. I understand where the first and last terms come from, but not the others. Apologies if the answer is trivial, I might not be seeing something here.
The broader context of this questions entails relating Cartesian coordinates to polar coordinates via a partial derivate.