# Is $e^{\int \frac {1}{x}dx}$ equal to $x$ or $|x|$?

I encountered this expression quite a lot of times as a part of the integrating factor while solving linear differential equations.

$$e^{\int \frac {1}{x}dx}$$

For sometime, I wrote it as $$x$$, and was satisfied as even the answer given in my textbook had $$x$$ instead of $$|x|$$. But after realising the possibility to be $$|x|$$, I am confused.

What should be the answer, and why?

Edit: (My reasoning)

$$\int \frac {1}{X} dx = log |x|$$ and $$e^{logt} = t$$ if I'm not wrong. So in this case, $$t = |x|$$ so the answer should be $$|x|$$.

What is wrong with this reasoning? And could you please provide a mathematical proof if the answer should be $$x$$?

Edit 2:

Wolfram Alpha evaluates e^(∫(1/x)dx) to $$x$$

• Where is $x$ (or, more precisely, the antiderivative in the integrand) defined? – anomaly Mar 15 at 0:58
• How do you define $\log$? – Brian Mar 15 at 0:59
• @anomaly There were questions of the type $\frac {dy}{dx} + \frac yx = 1$. So $x$ wasn't defined explicitly. – Eagle Mar 15 at 1:04
• Short answer: $1/x$ blows up at $0$, so $\int_a^b dx/x$ is undefined if $a < 0 < b$. Similarly, $1/x$ doesn't have antiderivative everywhere on $\mathbb{R}$; it has two on $(\infty, 0)$ and $(0, \infty)$, and they can't be patched together across $0$ to give a single continuous function. The function $f(x) = \log x$ does not satisfy $f'(x) = 1/x$ on $x < 0$; it's not even defined (as a real function) there. – anomaly Mar 15 at 1:16
• The correct expression as pointed out by everyone is indeed $\mid x\mid$. But since you're using it to evaluate linear differential equations, so to simplify things up you may use $\text{I.F.}=x$. – Paras Khosla Mar 15 at 8:55

The correct expression is $$|x|$$. The antiderivative of $$\frac1x$$ is $$\log |x|$$, which can be verified by computing the derivative of $$\log |x|$$ in the region $$x>0$$ and $$x<0$$ separately.

Neither is correct; the correct answer is $$C|x|$$, for some $$C>0$$, because you need to remember the constant! $$e^{\int \frac1x\,dx}=e^{\log|x|+K}=e^K|x|:= C|x|.$$

Actually, integrating $$\frac1x$$ requires two constants; one in the $$x>0$$ region, one in the $$x<0$$ region. You can verify that for any $$K_1,K_2$$, the following piecewise function is an antiderivative of $$1/x$$: $$f(x)=\begin{cases} \log|x|+K_1 & x>0\\ \log|x|+K_2 & x<0 \end{cases}$$ This is the full answer, because every antiderivative does have this form. Therefore, $$e^{\int\frac1x\,dx}=\begin{cases} C_1|x| & x>0\\ C_2|x| & x<0 \end{cases}$$ where $$C_1,C_2>0$$.
• Thank you for the answer. I understood it, but please look at my new edit because I don't know why but Wolfram Alpha gives the answer as $x$. – Eagle Mar 15 at 1:16
• @clathratus $\int f(x)\,dx$ is defined as the set of functions $F$ for which $F'=f$. When the domain of $f$ has two connected pieces, you can shift $F$ by any constant amount in each and still have $F'=f$. To get all $F$ for which $F'=f$, you therefore need two constants. – Mike Earnest Mar 15 at 1:23
• Oh okay. Thanks a lot! So I think my book also has the same error in giving the answer as $x$ instead of $|x|$. – Eagle Mar 15 at 1:43
But in the context of ODEs, where you're going to multiply both sides of the equation by the integrating factor, you can just multiply by $$x$$ instead of $$|x|$$, since if $$x<0$$ the only thing that would be different is a factor of $$-1$$ one both sides, which doesn't make any difference as far as the ODE is concernced. (And for the same reason, you don't gain any generality by multiplying by the most general antiderivative $$C_{1,2}|x|$$.)