The problem is these are not so well-defined and lack math rigor. So I am going to change it slightly.

What you should have written is,

Now, the function on the left is a composition function,

and,

Then,

Then the derivative of this is evaluated throw the can rule.

Since are differenciable we have,

Now,

----> 2nd Fundamental Theorem.

Thus,