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,

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)$$
