I haven't taken calculus in a while so please bear with me if this is an elementary question. For the function,
$$ f(x) = 1/x $$
its antiderivative can be written as the piece-wise function,
$$ F(x) = \begin{cases} \ln x + C_1, & \text{if } x > 0 \\ \ln (-x) + C_2, & \text{if } x < 0 \end{cases} $$
Why are the constants defined as $C_1$ and $C_2$ instead of just $C$? That implies to me that they can differ, but I don't understand how they could be unequal. Can someone provide an example of $f(x)$ and $F(x)$ where $C_1 \ne C_2$?
Here is an example:
Let $$F(x) = \begin{cases} \ln x + C_1, & \text{if } x > 0 \\ \ln (-x) + C_2, & \text{if } x < 0 \end{cases}$$
Then derivating, you get $f(x)=\frac{1}{x}$ for $x\neq 0$.
The point of this is that we use the following theorem:
Theorem If $F_1'(x)=F_2'(x)$ on some interval $I$ then, there exists some constant $C$ such that $F_1=F_2+C$.
The theorem is true only over intervals. Since $\frac{1}{x}$ is defined on $(-\infty,0) \cup (0,\infty)$ you have to apply twice the theorem over each of the intervals, getting one (potentially different) constant for each of the two intervals.