# Domain of $y=\ln x$ vs $y' = 1/x$

If the domain of $y = \ln x$ is $(0, \infty)$, how come the derivative $y'=1/x$ has a domain that is restricted to $(0, \infty)$? Because $y = 1/x$ has the domain $(-\infty, \infty)\backslash{0}$.

• Some special functions such as “lim,” “sin,” “max,” “ln,” and so on are normally set in roman font instead of italic font. Use \lim, \sin, etc. to make these: \sin x $\sin x$, not sin x $sin x$. Use subscripts to attach a notation to \lim: \lim_{x\to 0} $$\lim_{x\to 0}$$ – let's have a breakdown Nov 20 '17 at 19:35
• Btw, the solution of $y'=1/x$ is $y =\ln(\color{red}{|} x \color{red}{|})$ +c. – Math Lover Nov 20 '17 at 19:37

The derivative is restricted to that domain precisely because the original function is. How would you evaluate the derivative of $\ln x$ at negative $x$? You can't, and therefore the derivative is only defined for positive $x$.
The derivative of $\ln x$ does have a very natural extension to the negative numbers. However, that extension has little to do with the original function.
We have $$(\ln|x|)'=\frac{1}{x}.$$ Because if $x>0$ we obtain: $$(\ln|x|)'=(\ln{x})'=\frac{1}{x}$$ and for $x<0$ we obtain: $$(\ln|x|)'=(\ln(-x))'=-\frac{1}{-x}=\frac{1}{x}.$$