# $\int \frac{-1}{x-1}\,dx$ vs $-\int \frac{1}{x-1}\,dx$

Consider the two integrals $$\int \frac{-1}{x-1}\,dx\text{ and }-\int \frac{1}{x-1}\,dx$$ I would expect the solution to be $$-\log|x-1|+C$$, but I might be missing a detail here. Mathematica gives, in $$\mathbb{R}$$, \begin{align} \int \frac{-1}{x-1}\,dx&=-\log(1-x)\\ -\int \frac{1}{x-1}\,dx&=-\log(x-1) \end{align} What is going on here? Is it simply because I am inverting the direction of integration when factoring the minus sign?

• Note that the difference is a constant, $i\pi$. Nov 14, 2023 at 14:09
• A good way to check it's the same thing is to take a derivative Nov 14, 2023 at 14:23
• @Vasili the derivatives are the same, but there is a difference between the real and complex logarithms here. The plots of $-\log(1-x)$ and $-\log(x-1)$ are different, for $x\in\mathbb{R}$. I am missing something. Nov 14, 2023 at 14:29
• Only your solution is correct: $\int\frac{dx}{x-1}=\ln|x-1|+C$ (on either $(-\infty,1)$ or $(1,+\infty)$), and $\int-f(x)dx=-\int f(x)dx.$ Nov 14, 2023 at 15:07

## Premise

To use Wolfram well you must know how to interpret the results it gives you: keep in mind that Wolfram works by default on the complex plane and when it does the derivatives it gives you the derivatives in the distributional sense and not in the classical sense.

Although the left functions have domain $$x>0$$ and the right functions have domain $$x<0$$ (so if you were to plot the graph on $$\mathbb{R}$$ you wouldn't even have a point in common).

Working by default on the complex plane for Wolfram two functions are equal if the real part and the imaginary part are equal (without considering the domain)

In your case it is considered

$$\ln(1-x)+C_1=\ln(x-1)+C_2$$

Being an integral it is considered equal to less than constants (real or complex).

In the sense of integrals, "constant" means a function with zero derivative, so $$C$$ could also be a piecewise constant $$C(x)$$ function
Example:
$$f(x)=\sin(x)+1\qquad g(x)=\cos(x)+\text{sgn}(x)$$ $$f'(x)=\cos(x)\qquad g(x)=\cos(x)$$ I know if you do it with Wolfram you'll get it $$g'(x)=\cos(x)+2\delta(x)$$
But $$\delta(x)$$ it is a distribution (in fact Wolfam does distributional derivatives) and not a function

In fact you have that: $$\Re[\ln(1-x)]=\Re[\ln(1-x)]=\ln(|1-x|)$$ As regards the imaginary part, however, the situation is slightly different $$\Im[\ln(1-x)]=\text{arg}(1-x)=\begin{cases}0&x<1\\\pi&x>1\end{cases}$$ $$\Im[\ln(x-1)]=\text{arg}(x-1)=\begin{cases}\pi&x<1\\0&x>1\end{cases}$$

These two are piecewise functions and in the sense of integrals they can be considered as constants, in fact you have:

$$\frac{\mathrm{d}}{\mathrm{d}x}\Im[\ln(1-x)]=\frac{\mathrm{d}}{\mathrm{d}x}\Im[\ln(x-1)]=0$$

Note that I did the classical derivative and not the distributional derivative, in the sense of distributions there would have been a Dirac delta for $$\pi$$ (the multiplicative constant in the sense of distributions indicates the height of the jump)

So you have:

• Equal real parts
• Imaginary parts equal up to (piecewise) constant (functions)

For Wolfram those functions therefore represent the integral of the same function

In general, however, remember: Wolfram considers all functions as complex functions by default and when you take the derivative it does the distributional derivative and not the classical one.

I don't know if you've ever done something called measure theory (concept of "almost everywhere", "set of measure zero" etc...) or distributions in general (Dirac delta, Heaviside, etc...) so maybe some steps might seem forced to you. Basically consider that two functions have the same integral if they differ by a finite number of points, in fact the integral over an interval as large as a point (=set of measure zero) is worth $$0$$, so when you go to do the integral you don't change the result. Dirac's delta is $$0$$ everywhere except in one point, so when you do the integral in the classical sense it doesn't influence the result (in the sense of distributions instead it creates a high jump when the multiplicative constant in front of it)