# What to do when integration by parts doesn't work

I'm trying a physics problem for fun and I ran into this integral:

$$\int dv = \int \ln{\left(\frac{x}{x_0}\right)} \frac{1}{x-x_0} dx$$

Unfortunately I can almost do a u substitution, but not quite. So I did integration by parts:

$$= \ln{\left(\frac{x}{x_0}\right)} \ln{(x-x_0)} - \int \ln{(x-x_0)} \frac1x dx$$

Unfortunately again the integral isn't solvable so I tried integration by parts yet again...

$$= \ln{\left(\frac{x}{x_0}\right)} \ln{(x-x_0)} - \left[ \ln (x -x_0) \ln x - \int \ln x \frac{1}{x-x_0} dx \right]$$

Yet another integral I don't know how to solve so I tried one more futile attempt at integration by parts...

$$= \ln{\left(\frac{x}{x_0}\right)} \ln{(x-x_0)} - \ln (x -x_0) \ln x + \left[ \ln x \ln (x-x_0) - \int \ln (x-x_0)\frac1x dx \right]$$

I suppose it wasn't completely useless to try and integrate it one last time because I recognized a pattern- that I'm seeing repeats of integrals and each time I integrate, it seems to produce new terms that cancels out previous terms. I plotted the numerical integral and it has a logarithmic shape.

Is there any solution to this integral? If so, can you walk me through it? Keep in mind I'm in Calc 2 as a reference for what I will be able to comprehend.

The solution of your integral is $$\int \ln{(\frac{x}{x_0})} \frac{1}{x-x_0} dx=Li_2(\frac{x}{x_0})+\log(1-\frac{x}{x_0})\log(\frac{x}{x_0}),$$ where $Li_2$ is the Spence's function, defined by $$Li_2(x)=-\int_0^x\frac{ln(1-t)}{t}dt.$$ Spence's Function is commonly encountered in particle physics while calculating radiative corrections.
With that said, you were on the right path, you just did not know that the solution is to be expressed in terms of $Li_2$. Looking at your calculation, you are close to doing so.
As a general tip. Sometimes when performing integration by parts several times the right hand side includes the original integral, in these cases you can call the integral $I$ and rearrange the equation to solve for $I$.