He has given you the solution, but not much of an explanation. Let's look just at
This is a product rule so we need to use
This is a chain rule using the fact that the derivative of
For think about as a function of . In other words, if we take a hypothetical , the derivative would be . This is precisely