2

Evaluate $$\int\frac{1}{x^{2}+3|x|+2}dx$$

Recently I came across some questions from Integrals of Modulus Functions of some users in MSE and I want a clarity in this integral.

My Thoughts

Let's assume $I=\int\frac{1}{x^{2}+3|x|+2}dx$

$\implies I=\int\frac{1}{|x|^{2}+3|x|+2}dx$

$\implies I=\int\frac{1}{(|x|+2)(|x|+1)}dx$

$\implies I=\int\frac{(|x|+2)-(|x|+1)}{(|x|+2)(|x|+1)}dx$

$\implies I=\int\frac{1}{|x|+1}dx-\int\frac{1}{|x|+2}dx$

My Doubt

Can I integrate the last result separately for $x\geq 0$ and $x<0$ ? Finally there will be $2$ results of this integral. One result will be for $x\geq 0$ and the other one will be for $x<0$. Wolfram Alpha is giving the result in terms of signum function.

I am confused whether My Thoughts are correct or I have to follow the Wolfram Alpha's answer.

Please help me out.

Dev
  • 1,260
  • 3
    Why not split it into two integrals? One for $x \ge 0$ (meaning $|x| = x$) and one for $x < 0$ (meaning $|x| = -x$). – Dominique Feb 27 '25 at 14:14
  • 2
    Your function integrand is even, its antiderivative will be odd, so you just need to compute $\int_0^x$ for $x\ge0$. – hamam_Abdallah Feb 27 '25 at 14:22
  • See this and this for instance – Sine of the Time Feb 27 '25 at 14:28
  • 1
    @Dominique, Ok. Thank you for the clarification. Actually I already mentioned that I am confused that whether we can write the given integral in terms of $2$ integrals, one for $x\geq 0$ and the other one for $x<0$. Finally there will be $2$ results in end. – Dev Feb 27 '25 at 14:37
  • 2
    $$\int\frac{1}{x^{2}+3|x|+2}dx = \frac{|x|}x \ln \frac{|x|+1}{|x|+2} $$ – Quanto Feb 27 '25 at 15:26

3 Answers3

3

Your computations are correct, but you'll want the signum function or the equivalent to write an explicit antiderivative.

The integrand is even, so it suffices to compute an antiderivative for $x \geq 0$ on $[0, \infty)$ and extend it by symmetry. On that set, the integral is $$\int \frac{dx}{x^2 + 3 x + 2} = \int \left(\frac1{x + 1} - \frac1{x + 2}\right) \,dx = \log ( x + 1 ) - \log (x + 2) + C' .$$ Since the original integrand is even, its antiderivative $F$ on $\Bbb R$ satisfying $F(0) = 0$ is odd, so that antiderivative is $$\operatorname{sgn}(x)[\log(|x| + 1) - \log(|x| + 2) + \log 2],$$ and hence the general antiderivative is $$\int \frac{dx}{x^2 + 3 |x| + 2} = \operatorname{sgn}(x)[\log(|x| + 1) - \log(|x| + 2) + \log 2] + C.$$

Travis Willse
  • 108,056
1

$sgn(x)$ is defined as the sign of $x$. You should evaluate the integral for $x\ge0$ and $x\lt0$, look for some common terms which just differ by a sign and then use the signum function. Either way, it's the same thing.

1

Split it into two integrals. From where you left off and after splitting the integral, for $x\ge0$, the integral is $I_+=\int\frac{1}{x^{2}+3x+2}dx$ and for $x<0$, $I_-=\int\frac{1}{x^{2}-3x+2}dx$.

After using partial fractions to integrate, you get $$ I = \begin{cases} -\ln\left(\frac{x-1}{x-2}\right)+C_1, & x<0 \\ \ln\left(\frac{x+1}{x+2}\right)+C_2, & x\ge0 \end{cases}$$

Dylan Levine
  • 2,122
  • 2
    To get an antiderivative on all of $\Bbb R$, you'll want to make ensure that $I$ is continuous at $x = 0$, which in this case means using different constants $C$ in the two piecewise rules. – Travis Willse Feb 27 '25 at 14:44