My understanding is that functions of the form $f(g(x))$ can be differentiated using the "chain rule", where $$\frac{d}{dx}f(g(x)) = f'g(x) \cdot g'(x)$$
I was trying to apply that logic to the following equation: $$\frac{d}{dx}3sin(x)$$
To solve this, I tried parsing the problem in terms of 2 functions applied to an input: $$f(x) = 3x$$ $$g(x) = sin(x)$$ $$f(g(x)) = 3sin(x)$$ which led me to this solution: $$\frac{d}{dx}3(sin(x)) = 3sin(x) \cdot cos(x)$$
I've since learned that the answer is simply $3cos(x)$. It seems like I am missing a fundamental concept. Is there an error in those function substitutions I tried? Or am I messing something up in the differentiation itself?
$f'(y)=3$ for all $y$. So $f'(g(x))=3$ and $f'(g(x))g'(x) =3 \cos x$.