3

At a mathematical competition in my country the following problem was proposed:

Compute $\displaystyle I=\int \frac{x^2-x+1}{e^x \sqrt{x^2+1}}\,dx$ where $x\in \mathbb{R}$.

I came up with the following solution, and this is also the solution presented in my book:

\begin{align} I &= \int e^{-x}\sqrt{x^2+1}\,dx-\int e^{-x} \frac{x}{\sqrt{x^2+1}}\,dx\\ &= \int e^{-x}\sqrt{x^2+1}\,dx-\int e^{-x}\left(\sqrt{x^2+1}\right)'\,dx \\ &= \int e^{-x}\sqrt{x^2+1}\,dx-e^{-x}\sqrt{x^2+1}-\int e^{-x}\sqrt{x^2+1}\,dx \\ &=-e^{-x}{\sqrt{x^2+1}}+C. \end{align}

At a first glance, this seemed all right because $\left(-e^{-x}{\sqrt{x^2+1}}\right)'=e^{-x}\,\frac{x^2-x+1}{\sqrt{x^2+1}}$, $\forall x \in \mathbb{R}$.

But then I thought that maybe it is not, because I am basically subtracting two antiderivatives, and as my topic from here shows (A "proof" for $0=1$ by integrating $\int \frac{dx}{x\ln x}$ by parts), this is not allowed. I went on to plug in this indefinite integral into WolframAlpha and it said that no result could be found in terms of elementary functions.

Yet, $(-e^{-x}{\sqrt{x^2+1}})'=e^{-x}\,\frac{x^2-x+1}{\sqrt{x^2+1}}$, $\forall x \in \mathbb{R}$ is true, so my antiderivative should be correct.
So, what I am asking is if the solution I presented is somehow correct, and if it is, then why it works, since to the best of my knowledge it shouldn't.

Alexdanut
  • 2,807
  • 4
    The last and more sharp proof for this is to differentiate: the solution is thus correct. Now, the way can see extremely non-educational or even "magical", but if I differentiate the proposed solution and I get the function in the integral then we're done – DonAntonio Sep 07 '19 at 20:22
  • @DonAntonio thank you ! Any idea why WolframAlpha says that this cannot be expressed in terms of elementary functions? – Alexdanut Sep 07 '19 at 21:10
  • 2
    Don't worry too much for that: WA has plenty of little (and sometimes not so little) mistakes, typos and etc. You'll discover some of them with time. It still is an excellent tool to check stuff, though. – DonAntonio Sep 07 '19 at 21:17

3 Answers3

3

I propose to divide in two the function's numerator:

$$\int\frac{x^2-x+1}{e^x\sqrt{x^2+1}}dx=\int\frac{x^2+1}{e^x\sqrt{x^2+1}}dx-\int\frac x{e^x\sqrt{x^2+1}}dx=$$

$$=\int e^{-x}\sqrt{x^2+1}\,dx-\int e^{-x}\frac x{\sqrt{x^2+1}}dx\stackrel{\text{IBP of 1st integral}}=$$

$$=-e^{-x}\sqrt{x^2+1}+\int e^{-x}\frac x{\sqrt{x^2+1}}dx-\int e^{-x}\frac x{\sqrt{x^2+1}}dx=-e^{-x}\sqrt{x^2+1}+C$$

and now perhaps it does look slightly less misterious...

And subtracting/adding two antiderivatives that are equal up to an additive constant just changes at most the constant...so no problem as we're interested only in primitive "functions"

DonAntonio
  • 211,718
  • 17
  • 136
  • 287
1

Set $-x=y,$

$$I=-\int e^y\dfrac{y^2+y+1}{\sqrt{y^2+1}}dy$$

Now $\dfrac{d(e^yf(y))}{dy}=?$

Again $\dfrac{y^2+y+1}{\sqrt{y^2+1}}=\sqrt{y^2+1}+\dfrac y{\sqrt{y^2+1}}$

Observe that $f(y)=\sqrt{y^2+1}\implies \dfrac{df}{dy}=?$

1

The IBP example you mention doesn't ruin your strategy here because if you interpret an indefinite integral $\int f(x)dx$ as denoting the set of all antiderivatives of $f$ and adopt the defintion $c+S:=\{c+g|g\in S\}$, statements such as $\int\frac{dx}{x\ln x}=1+\int\frac{dx}{x\ln x}$ are true, so subtracting antiderivatives is allowed with that caveat.

If WA says it couldn't find an elementary result, it might just not be smart enough to find it.

J.G.
  • 115,835