How is $\,\int(1/x)\,dx = \ln|x|\,$ true? Why does the integral of $\frac 1x dx$ equal the natural log of the absolute value of $x$?
$$\int \frac 1x\,dx = \ln|x| + C$$
 A: The derivative
$$
\frac{d}{dx} \ln x = \frac{1}{x};
$$
however also 
$$
\frac{d}{dx}\ln(-x) = \frac{1}{-x}\frac{d(-x)}{dx} = \frac{1}{-x}(-1)=\frac{1}{x}.
$$
Hence, fiding a primitive of $1/x$ amounts to taking both cases into account, which in orderly fashion is written as $\ln |x|.$
A: In some cases (such as complex analysis) the formula is simply wrong.
$$
\int \frac{dz}{z} = \ln(z)+C
$$
is analytic, but $\ln|x|$ is not analytic.
......
But in the real case, it abbreviates two formulas:
$$
\int\frac{dx}{x} = \ln(x)+C\qquad\text{on } x>0,
\\
\int\frac{dx}{x} = \ln(-x)+C\qquad\text{on } x<0,
$$
A: When you write $$\int\frac1x\,dx$$ you are writing the symbols that represent the most general class of antiderivatives for $\frac1x$ with respect to $x$.
Since $\frac{1}{x}$ is defined for all nonzero $x$, and is continuous for all nonzero $x$, then you are seeking a class of functions that are defined for all nonzero $x$, and all have their derivatives equal to $\frac{1}{x}$.
The two-dimensional class of functions given by $\ln|x|+C_1\frac{x}{|x|}+C_2$ satisfy these needs, as we can show below. Also, since $\frac{1}{x}$ has exactly one discontinuity and it is at $0$, any two antiderivatives have to differ by $C_1\frac{x}{|x|}+C_2$ for some choice of constants $C_1$ and $C_2$. So this class of functions gives all antiderivatives for $\frac{1}{x}$.
Now why is $\frac{d}{dx}\left(\ln|x|+C_1\frac{x}{|x|}+C_2\right)$ equal to $\frac{1}{x}$? We have that 
$$\begin{aligned}
\frac{d}{dx}\left(\ln|x|+C_1\frac{x}{|x|}+C_2\right)
&=\frac{d}{dx}\left(\ln|x|\right)\\
&=\left.\frac{d}{dx}\left(\ln(x)\right)\right|_{x\to|x|}\cdot\frac{d}{dx}|x|\\
&=\left.\frac{d}{dx}\left(\ln(x)\right)\right|_{x\to|x|}\cdot\frac{x}{|x|}\\
\end{aligned}$$
So we need to know what $\frac{d}{dx}\left(\ln(x)\right)$ is. At this point, it all depends on what your definition of $\ln$ is. Any of the standard definitions (which can all be shown to be equivalent) all tell us that $\frac{d}{dx}\left(\ln(x)\right)=\frac{1}{x}$. We can discuss that more later, but for now, we continue:
$$\begin{aligned}
\frac{d}{dx}\left(\ln|x|+C_1\frac{x}{|x|}+C_2\right)
&=\left.\frac{d}{dx}\left(\ln(x)\right)\right|_{x\to|x|}\cdot\frac{x}{|x|}\\
&=\frac{1}{|x|}\cdot\frac{x}{|x|}\\
&=\frac{1}{|x|}\cdot\frac{|x|}{x}\\
&=\frac{1}{x}
\end{aligned}$$
And this would prove the claim.
So how do you define $\ln(x)$?


*

*As the inverse of $e^x$? Then establish that $\frac{d}{dx}e^x=e^x$, and apply the chain rule to the identity $e^{\ln(x)}=x$, and the fact that $\frac{d}{dx}\left(\ln(x)\right)=\frac{1}{x}$ will arise.

*As $\int_1^x\frac{1}{t}\,dt$? Then establish the Fundamental Theorem of Calculus, and the fact that $\frac{d}{dx}\left(\ln(x)\right)=\frac{1}{x}$ is immediate.

*Other ways? Prove they are equivalent definitions to one of the above, and go form there.
A: You can think of integration as anti-derivative. The derivative of $ln(x)$ is $\frac{1}{x}$ (Check http://math2.org/math/derivatives/more/ln.htm), hence the result follows.
A: When $x>0$, $(\ln |x|)'=(\ln x)'=\frac{1}{x}$.
When $x<0$, $(\ln |x|)'=(\ln (-x))'=\frac{-1}{-x}=\frac{1}{x}$.
