How many different constants is it right to use in these cases of integration?

$1) \int \frac{1}{x} dx= \begin{cases} \log(x)+c_1, x>0\\\log(-x)+c_2 x<0 \end{cases}$

Since the domain it's not an interval, so the constants can be different, right?

$2)\int \mid x \mid dx=\begin{cases} \frac{x^2}{2}+c_1, x\geq0 \\ -\frac{x^2}{2}+c_2 x<0 \end{cases}=\begin{cases} \frac{x^2}{2}+c_1, x\geq0 \\ -\frac{x^2}{2}+c_1 x<0 \end{cases}$

In this case I must impose $c_1=c_2$ right? Otherwise the function is not even continuous in $0$.

Are these correct?

Thanks for your help

  • 2
    $\begingroup$ I believe you could have up to one constant per integral per interval $\endgroup$ Jan 5, 2016 at 16:58

1 Answer 1


This is a good question.

  1. If \begin{align}g_1(x)&:= \begin{cases} \log|x|+C_1, &x<0;\\ \log|x|+C_2, &x>0\end{cases}\\ g_2(x)&:= \log|x|+C\quad(x\ne0),\end{align} then $$g_1'(x)\equiv\dfrac1x\equiv g_2'(x),$$ but strictly speaking, $$g_1(x)=\int \frac{1}{x} \,\mathrm dx\ne g_2(x).$$ $\int \frac{1}{x} \,\mathrm dx\ne g_2(x)$ because the integrand's domain is not a single interval and thus the indefinite integral has independent integration constants.
  2. On the other hand, if \begin{align}h_1(x)&:= \begin{cases} \frac12x|x|+C_1, &x<0;\\ \frac12x|x|+C_2, &x\geq0 \end{cases}\\ h_2(x)&:= \frac12x|x|+C,\end{align} then $$h_1'(x)\not\equiv|x|\equiv h_2'(x),$$ and $$h_1(x)\ne\int |x| \,\mathrm dx = h_2(x).$$ $h_1'(x)\not\equiv|x|$ because $h_1$ is not generally even continuous at $0.$

Here is another indefinite integral; this time, the integration constant in case 1 depends on that in case 2 but is independent of that in case 3: $$\int\frac{|x+1|}{x}\,\mathrm dx =\begin{cases} -x-\ln(-x)\color{red}{-2+C_1}, &x<-1;\\ x+\ln(-x)\color{red}{+C_1}, &-1\le x<0;\\ x+\ln(x)\color{red}{+C_2}, &x>0. \end{cases}$$

  • $\begingroup$ This is indeed correct. Good answer. +1 $\endgroup$
    – Angel
    Mar 28, 2022 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .