Constant of integration change So, sometimes the constant of integration changes, and it confuses me a bit when and why it does. So for example, we have a simple antiderivative such as $$\int \frac{1}{x} dx $$ and we know that the result is $$\log|x| + C$$ and the domain is $$x\in\mathbb R \backslash \{0\} $$ If we want to show all the solutions, we need to do something like $$\begin{cases}
\log x+C_1 & x>0\\
\log(-x)+C_2 & x<0
\end{cases}$$
Do we need to do change the constant every time there is a gap in the domain or is it just when the expression changes? For example, $$ \int \frac {x^5} {x^2-1} dx$$ which is $$ \frac {1} {2} \log |x^2-1| + \frac {x^4} {4}  + \frac {x^2}{2} + C$$ and the domain is $$x \in \mathbb R \backslash \{-1,1\}$$ When we want to write all the solutions, is it something like $$ \begin{cases} \ \frac {1} {2} \log (x^2-1) + \frac {x^4} {4}  + \frac {x^2}{2} + C_1 & x>1\\ \frac {1} {2}\log (-x^2+1) + \frac {x^4} {4}  + \frac {x^2}{2} + C_2 & -1<x<1\\ \frac {1} {2} \log (x^2-1) + \frac {x^4} {4}  + \frac {x^2}{2} + C_3 & x<-1  \end{cases}$$ or is it that since the the first and last expression are the same they only have one constant associated? Meaning, the solutions are actually $$ \begin{cases} \ \frac {1} {2} \log (x^2-1) + \frac {x^4} {4}  + \frac {x^2}{2} + C_1 & x \in \mathbb R \backslash [-1, 1]\\ \frac {1} {2}\log (-x^2+1) + \frac {x^4} {4}  + \frac {x^2}{2} + C_2 & -1<x<1\\ \end{cases}$$

Here is a 1-line compactification of Βασίλης Μάρκος' answer $\ddot\smile$

It can be shown that on every sub-interval of the domain of the original function, any two anti-derivatives differ by an additive constant, but constants for different sub-intervals can very well be different.

