The logarithm is defined as: $$ \ln x = \int_1^x \frac1{t} dt $$ Hence I am often told that for indefinite integrals, since $\frac1{x}$ is defined over $\mathbb{R} \setminus \{0\}$ (various sources seem to disagree about this), one should write: $$ \int \frac1{x}dx = \ln |x|+C $$ How is this justified?
(PS I think I might be duplicating someone else, if I am please link)
One writes $\displaystyle \int \frac1x dx=\ln|x|$, because you should take into account cases where $x<0$.
In the definition $\displaystyle \ln x = \int_1^x \frac1{t} dt$, only the values for $x>0$ are taken into account.