# A question about the absolute value in integrals

I do really understand why we put the absolute value when integrating functions leading to $\log$ function for example: $$\int{\dfrac{\mathrm dx}x}=\log\lvert x\rvert + C$$ , it is very common in books to see them ignoring the absolute value (this is possible of course under some assumptions), but sometimes I do not see any assumptions. for example the following integral : $$\int \dfrac{du}{1-u}= \int dt$$ the expected result is: $$\log\lvert 1-u\rvert = -t + C$$ but Maple gives the result without the absolute value (I did not used the assume function)

EDIT 1 I want really to know in general case if the absolute value is required or it does not matter even if there are no assumptions

I am so confused, any ideas please?

• $logx$ is not defined for $x<0$, where $x$ is real. – Mathlover Jun 27 '16 at 16:58
• @mathlover: what? I do know that, everyone knows that. – Syntax_ErrorX00 Jun 27 '16 at 17:01
• Maple probably assumes $x$ to be complex, and then typically $\log x=\ln |x|+i\arg x$ is antiderivative of $1/x$ (where one has to be cautious about the domain of $x$). – mickep Jun 27 '16 at 17:02
• @mickep: That was only one example, but it very common to see this, is it mathematically true? – Syntax_ErrorX00 Jun 27 '16 at 17:03
• In this case it is mathematically true. I don't know what other examples you have in mind. – mickep Jun 27 '16 at 17:04

In calculus courses one deals with the function $\ln\colon(0,+\infty)\to\mathbb R$. For $x>0$ it holds that $$\frac{d}{dx}\ln x=\frac{1}{x}.$$ Note that the function $x\mapsto 1/x$ is defined for $x\in\mathbb R$ with $x\neq 0$. Integrating, one has $$\int \frac{1}{x}\,dx= \begin{cases} \ln x+C_1 & x>0\\ \ln (-x)+C_2 & x<0. \end{cases} \tag{*}$$ This is sometimes written $$\int\frac{1}{x}\,dx=\ln |x|+C$$ but in applications one consider either $x>0$ or $x<0$.

In complex analysis one also deals with a logarithm, taking complex numbers as arguments (I will not dig into the subject of branches here). One common definition is $$\log z=\ln |z|+i\arg z.$$ Here $\ln$ is the logarithm defined in calculus. $\arg$ is the argument function. As it happens, also $$\frac{d}{dz}\log z=\frac{1}{z}.$$ Here $\frac{d}{dz}$ is the complex derivative. Thus, in the complex setting $$\int\frac{1}{z}\,dz=\log z+C,$$ i.e. the logarithm is still an antiderivative of $1/z$. Here, again, one should be more careful with domains, but since I understand it as OP is not into complex analysis yet (correct me if wrong), I do not dwell about that.

Finally, maple has no reason to expect the $x$ in $1/x$ to be real, so when you hit

 int(1/x,x);


maple makes no assumption on $x$, but return

$\log x$.

Note that, if $x$ happens to be real and positive, and one assumes $\arg x=0$ (which is natural), then $$\log x=\ln|x|+i\arg x=\ln x$$ so the different logarithms really coincide.

What should you do?

I suggest that you, every time you must integrate something that will return a logarithm, pause and think if you know anything about the variable. If you know that $x$ is positive, then $\int 1/x\,dx=\ln x+C$. If you know that $x$ is negative, then $\int 1/x\,dx=\ln(-x)+C=\ln|x|+C$ and if you do not know, then use $(*)$ above.