how to take the derivative using chain rule with natural log and cosine