Need clarifying on basic derivatives of natural log/e So here's the question:

Find the derivative: $ y= e^{\cos(x)}$

Hint: This is a combination of the chain rule and the natural log. The derivative is $(\ln a)(a^{f(x)}) * f'(x)$


So normally without using the hint I would use the chain rule and solve it like this:
$e^{\cos(x)} * -\sin(x)$
simplified....
$-\sin x(e^{\cos(x)})$
Apparently though, according to the hint provided, there should be an $ln (e)$ which cancels out, so it should look like this:
$e^{\cos(x)} * -\sin(x)* \ln e$,
where the $\ln e$ simplifies to $1$ and has no affect on the final answer.
So when I did it, I only used the chain rule. The answer ended up the same, but I was wondering if this was a coincidence or if it is always like that. If I continue doing it my way will I be fine?
Sorry if this is a dumb question. It's been a while since I took Calculus 1 and I'm starting Calculus 2 now so I'm a bit rusty.

It is not a coincidence as you predicted but a special case for $e^{f(x)}$ since $ln(e) = 1$. For example: if the question were $y = a^{cos(x)}$, your answer would be $\frac{dy}{dx} = (ln(a))(a^{cos(x)})(-sin(x))$.
