Just in case a picture helps...

The chain rule in general...

... in which straight continuous lines differentiate downwards with respect to x, and the dashed continuous line with respect to the dashed balloon expression, so that the triangular network on the right satisfies the chain rule.

Then in particular we have, for 2...

... and then differentiating again with the product rule as well ...

Don't integrate - balloontegrate!

Balloon Calculus: worked examples from past papers