we differentiated with respect to xxx and so when faced with xxx’s in the function we differentiated as normal and when faced with yyy’s we differentiated as normal except we then added a y′y′y' onto that term because we were really doing a chain rule.
The outside tells you what you need to differentiate in respect to.