Finding the derivative of a function with a Natural Log. I am trying to differentiate the function:
$${\rm ln} \left(\frac{3x \ {\rm tan}(x)}{x^2 + 2}\right)$$
I think step one is to use the quotient rule of natural log expanding the expression. 
However doing this would still leave $\ln(3x \tan(x)) - \ln(x^2+2) $. Therefore, I'm confused if I should expand this expression again giving me.....
$$ \ln(3x) + \ln(\tan(x)) - \ln(x^2+2)$$
Now, I would assume I should take the derivative of each term and apply the differentiation rule of natural log which is $u'/u$. However, if I do this I end up with a long answer of fractions that I cannot reduce much. 
Where am I going wrong here. The fact that there are two terms in the numerator, "$3x$" and "$\tan(x)$", is confusing me on what to do. I'm lost as to what procedures I should take in approaching problems like these. Can someone help me out or at the very least push me in the right direction? 
 A: Hints:


*

*Yes, this can get messy.

*You have the derivative of $\ln(u)$.

*You have a quotient $\displaystyle \frac{u}{v}$

*You have a product rule $u v$.
When you take all of those into account, you should arrive at:
$$\frac{d}{dx} ln\left(\frac{3x \tan x}{x^2+2}\right) = \frac{-x^2+(x^2+2) x \csc(x) \sec(x) + 2}{x(x^2+2)}$$
You can simplify the trig terms a bit, but that is not helpful.
A: The key trick to simplify matters is to use the fact $\ln(ab) = \ln(a) + \ln(b)$
Then we have
$$ \frac{d}{dx} \ln \left(\dfrac{3x \tan x}{x^2 + 2}\right) = \frac{d}{dx} \left(\ln 3x + \ln \tan x - \ln (x^2 + 2) \right) $$
For each of these, use the formula that $$\frac{d}{dx} \ln f(x) = \dfrac{f'(x)}{f(x)} $$
A: There are two possible approaches. One of them is to write your function $y$ as $\ln u$, where $u=\frac{3x\tan x}{x^2+2}$. 
Then $\frac{dy}{dx}=\frac{dy}{du}\frac{du}{dx}$. We have $\frac{dy}{du}=\frac{1}{u}$.
For $\frac{du}{dx}$, use the Quotient Rule. It is still moderately messy, since for the derivative of the top we will have to use the Product Rule. But not too bad.
Let us instead chase down your approach. We will deliberately make a little "mistake."
We have $y=\ln(3x)+\ln(\tan x)-\ln(x^2+2)$. Using the derivative of $\ln$, and the Chain Rule, we get
$$\frac{dy}{dx}=\frac{3}{3x}+\frac{\sec^2 x}{\tan x}+\frac{2x}{x^2+2}.\tag{$1$}$$
This is a correct answer, at least when our function is defined. (Note that the function is not defined when $3x\tan x\le 0$.)
However, the derivation of $(1)$ is not completely correct, unless we take a detour through the complex numbers. For if $x$ is negative and $\tan x$ is negative, then $\ln(3x)$ and $\ln(\tan x)$ are not defined. 
We can get around the problem by, in that case, rewriting $3x\tan x$ as $(-3x)(-\tan x)$. Then $y=\ln(-3x)+\ln(-\tan x)+\ln(x^2+2)$. When we differentiate, we get $\frac{-3}{-3x}+\frac{-\sec^2 x}{-\tan x}+\frac{2x}{x^2+2}$, which simplifies to exactly the same thing as $(1)$. 
So the calculation that led to $(1)$, though slightly questionable when $x$ and \tan x$ are negative, actually always gives the correct answer. 
