You should use chain rule for composite differentials, you can't pull out that d/dx term like that in the first post.The best way is, write out all the terms of the end result. Simplify and try to collect to get the first expression.Its pretty straightforward.You know chain rule right...