Why does logarithmic differentiation work even if logs are not defined for negative numbers? 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.
 A: Logarithms are defined for all numbers except 0.
If you haven’t learned about Euler’s identity, it states that $$e^{{\pi}{i}}=-1$$
This is a very famous identity, which is learnt typically during the early stages of complex numbers.
Anyway, this formula basically shows that we can take a log of a negative number, we’ll just get a complex result.
$$\log(e^{{\pi}{i}})=\log(-1)$$
Hence,
$${\pi}{i}{log(e)}=log(-1)$$
and
$$log(-1)={\pi}{i}$$
Using the logarithmic identities like the addition one we can then determine the logarithm for any real number except for 0 (you can find out why with some pen and paper).
Since the calculus works for complex numbers as well, albeit differently, you can, in fact, differentiate it.
A: It makes sense to consider the quantity ${f'(x)\over f(x)}$ even without knowing about logarithms. Assume we have a function $x\mapsto y=f(x)$, and consider a "working point" $(x_0,y_0)$. When studying increments $\Delta x$, $\Delta y$ measured from this point the "absolute" change of $y$  is approximated by
$$\Delta y\approx f'(x_0)\>\Delta x\qquad\bigl(|\Delta x|\ll1\bigr)\ ,$$
and the "relative" change of $y$ is approximated by
$${\Delta y\over y_0}={f'(x_0)\over f(x_0)}\>\Delta x\qquad\bigl(|\Delta x|\ll1\bigr)\ .$$
A: Either using the chain rule and $\frac{\mathrm{d}}{\mathrm{d}x}|x|=\frac{x}{|x|}$, or working cases for $x\gt0$ and $x\lt0$, we get
$$
\frac{\mathrm{d}}{\mathrm{d}x}\log(|x|)=\frac1x
$$
Thus, we get
$$
\frac{f'(x)}{f(x)}=\frac{\mathrm{d}}{\mathrm{d}x}\log(|f(x)|)
$$
