Say for instance, we have a function $y = x^3$, the derivative of which is $\frac{\mathrm{d}y}{\mathrm{d}x} = 3x^2$. Now, say I want to do a logarithmic differentiation: $$ \ln(y) = \ln(x^3) \hspace{10pt}\implies\hspace{10pt} \ln(y) = 3\ln(x), $$ so by implicit differentiation with respect to $x$, $$ \frac{1}{y}\frac{\mathrm{d}y}{\mathrm{d}x} = 3\cdot\frac{1}{x} \implies \frac{\mathrm{d}y}{\mathrm{d}x} = y\cdot 3 \cdot \frac{1}{x} = x^3\cdot \frac{3}{x} = 3 x^2. $$
Why does this work, even though $\ln(x)$ function is not defined for negative values of $x$?
Or does doing differentiation using logarithms limit the result to positive values for $x$ only which in this case is yielding the correct result nonetheless?
For some reason, the authors of articles I found regarding the same, don't seem to be too concerned regarding this problem. Any help would be appreciated,
Thankyou.