4

I've encountered an obstacle while trying to solve the following integral: $$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}$$ First thing we shall do is see that under the square root is actually $(x+1)^2$. When I cancelled the square root I got the following integral: $$\int{\frac{|x+1|}{x}\,\mathrm dx}$$ After that I've separated the problem into two cases:
$1.$ Case: $$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}=-x-\ln|x|+C,\space x<-1$$ $2.$ Case: $$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}=x+\ln|x|+C,\space x>-1, x\neq{0}$$

But this apparently isn't the correct solution and the only solution is: $$\int{\frac{\sqrt{x^2+2x+1}}{x}dx}=x+\ln|x|+C,\space x\neq{0}$$ Is this really the case, and if yes, then why?

bb_823
  • 2,144
  • 2
  • 3
  • 21
  • 1
    The most general solution is $-x-\ln(-x)+A$ for $x<-1$, $x+\ln(-x)+B$ for $-1<x<0$, $,x+\ln x+C$ for $x>0$. See also here. – J.G. Mar 11 '23 at 19:36
  • @J.G. That was what I was writing in my answer ;-; I got this from Dr. Trefor Bazett though so we have different sources ;) – Kamal Saleh Mar 11 '23 at 19:37
  • @J.G. so there are in fact three cases? Though for school purposes (seems like we were thaught wrong), my solution would be correct, the one with two cases, right? – bb_823 Mar 11 '23 at 19:38
  • It's one solution with three parameters. @KamalSaleh I'd be interested to see Bazett's discussion if it's online. – J.G. Mar 11 '23 at 19:40
  • @J.G sorry for late edit, but can you reply to my question? – bb_823 Mar 11 '23 at 19:48

2 Answers2

7

\begin{align} \int{\frac{\sqrt{x^2+2x+1}}{x}\,\mathrm dx}={}&\int\frac{|x+1|}{x}\,\mathrm dx\\ ={}&\int\operatorname{sgn}(x+1)\left(1+\frac1x\right)\,\mathrm dx\\ ={}&\begin{cases} -x-\ln(-x)-2+C_1, &x<-1;\\ x+\ln(-x)+C_1, &-1\le x<0;\\ x+\ln(x)+C_2, &x>0 \end{cases} \end{align}

  1. This integrand is disconnected at just $0,$ so its indefinite integral requires exactly two independent parameters to capture its complete set of antiderivatives.
  2. The -2 adjustment in the first case (alternatively: a +2 adjustment in the second case) is necessary! Without it, the left piece of each antiderivative (i.e., for each $(C_1,C_2)$ couple) is discontinuous, and therefore not differentiable, at $-1$ (a non-differentiable antiderivative is of course a contradiction). It is easy to neglect this adjustment and write \begin{align} \int_{-2}^{-0.5}\frac{|x+1|}{x}\,\mathrm dx ={}&\int_{-2}^{-0.5}\operatorname{sgn}(x+1)\left(1+\frac1x\right)\,\mathrm dx\\ \color{red}={}&\Big[\operatorname{sgn}(x+1)\left(x+\ln(-x)\right)\Big]_{-2}^{-0.5}\quad\quad\Large\color{red}✗\\ ={}&-2.5,\end{align} which is incorrect, because in fact $$\int_{-2}^{-0.5}\frac{|x+1|}{x}\,\mathrm dx=-0.5.$$

A visual proof:

enter image description here

When computing the integral on $[a,b]$ of a continuous piecewise function, using the FTC piece-wise is equivalent to determining its indefinite integral then using the FTC once (at $a$ and $b$).

ryang
  • 38,879
  • 14
  • 81
  • 179
  • 1
    Since the red curve is continuous in $-1$ (bounded suffice though) there should exists a value of $C_1$ for which the anti-derivative in continuous in $-1$, this is not the case for your result, but $-x-\ln(-x)-C_1$ for $C_1=1$ works. – zwim Mar 11 '23 at 21:49
  • @zwim I don't understand your suggestion (the part after "but"), but I've just edited the answer to incorporate your fantastic observation (the part before "but"). Thanks so much for pointing out the subtlety! – ryang Mar 12 '23 at 11:09
  • I think the more obvious way to see that $\operatorname{sgn}(x+1)(x+\ln|x|)+C$ is incorrect is to note it gives $$\lim_{\epsilon \to 0^+} \int_{-1-\epsilon}^{-1+\epsilon} \frac{|x+1|}{x} \mathrm{d}x = -2$$ but with the integrand bounded on $x \in [-2,-1/2]$, this limit must be $0$. – aschepler Mar 12 '23 at 11:55
  • In fact $\displaystyle\sigma(x)\int f(t)dt$ is ultimately $\displaystyle\sigma(x)\int_{x_0}^x f(t)dt=\sigma(x)\Big(F(x)+C\Big)$ with $C=-F(x_0)$ and the $C$ is affected by the sign function $\sigma$. But you put it outside. – zwim Mar 12 '23 at 13:02
  • @zwim Thanks for your 2nd comment (reminding that when making the abovementioned edit, I'd neglected to bring that $\sgn$ function in Line 2 back into the indefinite integral); I've just made the correction. – ryang Mar 12 '23 at 14:20
2

The piece-wise integrations may be combined as follows \begin{align} &\int{\frac{\sqrt{x^2+2x+1}}{x}\,dx}\\ =&\ \frac{|x+1|}{x+1} \int{\frac{x+1}{x}\,dx}= \frac{|x+1|}{x+1}(x+\ln |x|)+C\\ \end{align} where the domain-dependence of the constant is understood.

Quanto
  • 97,352
  • 2
    Neat trick (+1) – Sine of the Time Mar 12 '23 at 01:00
  • 1
    @ryang - Already pointed out in the answer is its piece-wise representation; you incorrectly applied it to $(-2,-0.5)$ – Quanto Mar 12 '23 at 11:42
  • 2
    "domain-dependence of the constant" doesn't describe exactly how it changes, though, in particular the difference of $2$ near $x=-1$. – aschepler Mar 12 '23 at 11:48
  • 2
    @ryang - As already pointed out, one should apply the result piece-wise, e.g. $\int_{-2}^{-1} + \int_{-1}^{-0.5}$. Doing so does not rely on any tacitness – Quanto Mar 12 '23 at 12:28
  • @Quanto Okay, that's fair. declutters away the above. $\quad$ A nitpick: while $-1$ lies in the integrand's domain, none of your solution antiderivatives are defined at this point. – ryang Mar 12 '23 at 20:45