Can I compute $\frac{dy}{dx}$ of $y=x\sqrt{3x+1}\sqrt{x+1}$ by taking $ln$ on both sides My teacher has suggested that to compute $\frac{dy}{dx}$ of $y=x\sqrt{3x+1}\sqrt{x+1}$, it's better to take $ln$ on both sides of the equation $y=x\sqrt{3x+1}\sqrt{x+1}$, and try taking derivative of logarithms on both sides, and then solve for $\frac{dy}{dx}$. But I am confused because when you consider the function $y=x\sqrt{3x+1}\sqrt{x+1}$,  $y \lt 0$ for $-1/3 \lt x \lt 0$, so $ln(y)$ is not defined for $-1/3 \lt x \lt 0$, i.e. we cannot take logarithm for entire domain in which $y=x\sqrt{3x+1}\sqrt{x+1}$ is defined for. In this case, can we still compute $\frac{dy}{dx}$ by taking $ln$ on both sides, like my teacher is suggesting?
Thank you,
 A: Multiply both sides of the equation by $-1$,
$$-y=-x\sqrt{3x+1}\sqrt{x+1}$$
Now that both sides are positive you can take the logarithm:
$$\ln(-y)=\ln(-x)+\frac{1}{2}\ln(3x+1)+\frac{1}{2}\ln(x+1)$$
Then take the derivative with respect to $x$ (note that $\ln(-x)'=\frac{-1}{-x}=\frac{1}{x}$)
$$\frac{y'}{y}=\frac{1}{x}+\frac{3}{2(3x+1)}+\frac{1}{2(x+1)}$$
$$y'=x\sqrt{3x+1}\sqrt{x+1}\left(\frac{1}{x}+\frac{3}{2(3x+1)}+\frac{1}{2(x+1)}\right)$$
A: Your teacher just wanted to make things simpler because you have $\ln´ (f(x))=\dfrac {f´(x)}{f(x)}$ and right-hand side evaluates to a sum of three functions under the workings of the logarithm.
But you should not take the logarithm of points where it is not defined, if you ask me, unless you can transform everything to become strictly positive.
I think that even better approach here would be to square both sides, then at the left side you get $2y(x)y`(x)$ and on the right hand side you then take the derivative of a polynomial and you get as a bonus no problems with domain.
A: Pedestrian approach:
1) $x\gt 0$: $\log$ of the function is defined.
2) $x=0:$ $\log$ is not defined
3)$ -1/3 \lt x\lt 0$ : $\log$ is not defined.
Consider:
$Y:= -y =$
$ -x(3x+1)^{1/2}(x+1)^{1/2}$ for 3).
$Y\gt 0$ for $x$ in 3): 
Take logs of $Y$ ,
carry  through, and at the end  revert to  
$y' = -Y'$, the desired derivative.
Note: $x=0$ is excluded in the above manipulations.
