Also, just in case a picture helps convey the logic that Roam (possibly) and - Wolfram|Alpha (definitely) are using...
... where
... is the chain rule for two inner functions, i.e...
As with...
... the ordinary chain rule, straight continuous lines differentiate downwards (integrate up) with respect to x, and the straight dashed line similarly but with respect to the (corresponding) dashed balloon expression which is (one of) the inner function(s) of the composite expression.
_____________________________________
Don't integrate - balloontegrate!
Balloon Calculus Forum
Balloon Calculus Drawing with LaTeX and Asymptote!