Let us find the indefinite integral of the function \(f(x)=1/x\text{.}\) We know that the derivative of \(\ln x\) is \(1/x\text{,}\) so \(\int 1/x\
dx\) should be \(\ln x +C\text{.}\) However, care must be paid to the domains of these functions. When we say that \((\ln x)' = 1/x\text{,}\) we are making a statement about the function \(\ln x\) whose domain is \(x >0\text{.}\) However, when we talk about the indefinite integral of \(1/x\text{,}\) we are making a statement about \(1/x\) whose domain is \(x \neq 0\text{.}\) And \(\ln x\) is only ``half’’ of an anti-derivative of \(1/x\) (graph them and you will see). What is the other half then? By symmetry, it is easy to see that the derivative of \(\ln (-x)\) is \(1/x\) on \(x \lt 0\text{.}\) Indeed one checks that this is the case by differentiation. Thus, \(\ln |x|\) is an anti-derivative of \(1/x\text{.}\) Hence,
\begin{equation*}
\int \frac{1}{x}\ dx = \ln |x| +C. \quad (x \neq 0)
\end{equation*}
Note also that \(x \neq 0\) is the union of two disjoint open interval. So, \(C\) the class of locally constant functions on \(x
\neq 0\) is the class of functions of the form
\begin{equation*}
\begin{cases}
c_1 & x \gt 0 \\ c_2 & x \lt 0
\end{cases}
\end{equation*}
where \(c_1, c_2\) are constants but not necessarily the same. For example, the function
\begin{equation*}
F(x) =
\begin{cases}
\ln(x) + 2 & x \gt 0 \\ \ln(-x) -3 & x \lt 0
\end{cases}
\end{equation*}
is also an anti-derivative of \(1/x\text{.}\)