Chain rule for derivatives