Integrate $\int_0^1 \ln(x)\ln(b-x)\,\mathrm{d}x$, for $b>1$? Let $b>1$. What's the analytical expression for the following integral?
$$\int_0^1 \ln(x)\ln(b-x)\,\mathrm{d}x$$
Mathematica returns the following answer:
$$2-\frac{\pi^{2}}{3}b+\left(b-1\right)\ln\left(b-1\right)-b\ln b+\mathrm{i}b\pi\ln b+\frac{1}{2}b\ln^{2}b+b\mathrm{Li}_{2}\left(b\right)$$
which contains the imaginary term $\mathrm{i}b\pi\ln b$. But the actual answer is real, so this term should cancel somehow with the dilogarithm function. But I don't know how to do this.
 A: The following is an evaluation in terms of $ \displaystyle \text{Li}_{2} \left(\frac{1}{b} \right)$, which is real-valued for  $b > 1$.
$$\begin{align}  \int_{0}^{1} \log(x) \log(b-x) \ dx &= \log(b) \int_{0}^{1} \log(x) +  \int_{0}^{1}\log(x) \log \left(1- \frac{x}{b} \right) \ dx \\ &= - \log(b) - \int_{0}^{1} \log(x) \sum_{n=1}^{\infty} \frac{1}{n} \left( \frac{x}{b}\right)^{n} \ dx \\ &= - \log(b) - \sum_{n=1}^{\infty} \frac{1}{nb^{n}} \int_{0}^{1} \log(x) x^{n} \ dx \\ &= - \log(b) + \sum_{n=1}^{\infty} \frac{1}{nb^{n}} \frac{1}{(n+1)^{2}} \\ &= - \log(b) - \sum_{n=1}^{\infty} \frac{1}{n+1} \frac{1}{b^{n}} - \sum_{n=1}^{\infty} \frac{1}{(n+1)^{2}} \frac{1}{b^{n}} + \sum_{n=1}^{\infty} \frac{1}{n} \frac{1}{b^{n}} \\ &= - \log(b) - \left(-\frac{\log(1-\frac{1}{b})}{\frac{1}{b}}-1\right) - \left(\frac{\text{Li}_{2}(\frac{1}{b})}{\frac{1}{b}} -1\right) - \log \left(1- \frac{1}{b} \right) \\ &= - \log(b) +2 + (b-1) \log \left(1-\frac{1}{b} \right) - b \ \text{Li}_{2} \left( \frac{1}{b}\right) \end{align}$$
EDIT:
The answer can be written in the form
$$-b \ \text{Li}_{2} \left( \frac{1}{b}\right) +2 + (b-1) \log(b-1) - b \log(b) $$
which is what Wolfram Alpha returns for specific integer values of $b$ greater than $1$.
For non-integer values of $b$ greater than $1$, it manipulates the answer a bit differently.
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{0}^{1}\ln\pars{x}\ln\pars{b - x}\,\dd x:\ {\large ?}\,,\qquad b > 1}$.

With $\ds{0 < \epsilon < 1}$:
  \begin{align}&\totald{}{b}
\color{#c00000}{\int_{\epsilon}^{1}\ln\pars{x}\ln\pars{b - x}\,\dd x}
=\int_{\epsilon}^{1}\ln\pars{x}\bracks{-\,\partiald{\ln\pars{b - x}}{x}}\,\dd x
\\[3mm]&=\ln\pars{\epsilon}\ln\pars{b - \epsilon}
+\int_{\epsilon}^{1}\ln\pars{b - x}\,{1 \over x}\,\dd x
\\[3mm]&=\ln\pars{\epsilon}\ln\pars{b - \epsilon}
+\int_{\epsilon/b}^{1/b}{\ln\pars{b} + \ln\pars{1 - x} \over x}\,\dd x
\\[3mm]&=\ln\pars{\epsilon}\ln\pars{b - \epsilon}
+\ln\pars{b}\bracks{\ln\pars{1 \over b} - \ln\pars{\epsilon \over b}}
-\int_{\epsilon/b}^{1/b}{\rm Li}_{1}\pars{x}\,\dd x
\\[3mm]&=\ln\pars{\epsilon}\bracks{\ln\pars{b - \epsilon} - \ln\pars{b}}
-\int_{\epsilon/b}^{1/b}\totald{{\rm Li}_{2}\pars{x}}{x}\,\dd x
\\[3mm]&=\
\overbrace{\ln\pars{\epsilon}\bracks{\ln\pars{b - \epsilon} - \ln\pars{b}}}
^{\ds{\to\ 0\quad\mbox{when}\quad\epsilon\ \to\ 0^{+}}}\ -\
{\rm Li}_{2}\pars{1 \over b} + {\rm Li}_{2}\pars{\epsilon \over b} 
\end{align}

$$
\totald{}{b}
\color{#c00000}{\int_{0}^{1}\ln\pars{x}\ln\pars{b - x}\,\dd x}
=
-{\rm Li}_{2}\pars{1 \over b}
$$

\begin{align}
\color{#c00000}{\int_{0}^{1}\ln\pars{x}\ln\pars{b - x}\,\dd x}
=\overbrace{\quad-\int_{0}^{1}\ln\pars{x}\ln\pars{1 - x}\,\dd x\quad}
^{\ds{-2 + {\pi^{2} \over 6}}}\
-\ \int_{1}^{b}{\rm Li}_{2}\pars{1 \over t}\,\dd t
\end{align}
  In the RHS, the first integral is easily evaluated by means of a Beta function or/and $\ds{\ln\pars{1 - x}}$ expansion. The second one is evaluated, in a rather cumbersome way, by using the serie definition of $\ds{{\rm Li}_{2}\pars{z}}$. I see other answers already did that.

A: Define
$$ I(a)=\int_0^1x^a\ln(b-x)dx. $$
It is easy to see that
$$ \int_0^1\ln x\ln(b-x)dx=\lim_{a\to 0^+}I'(a). $$
Now
\begin{eqnarray*}
I(a)&=&\frac{1}{a+1}\int_0^1\ln(b-x)d(x^{a+1})=\frac{1}{a+1}\left(x^{a+1}\ln(b-x)|_0^1+\int_0^1\frac{x^{a+1}}{b-x}dx\right)\\
&=&\frac{1}{a+1}\left(\ln(b-1)+\frac{1}{b}\sum_{n=0}^\infty\int_0^1\frac{1}{b^n}x^{a+1+n}dx\right)\\
&=&\frac{1}{a+1}\left(\ln(b-1)+\sum_{n=0}^\infty\frac{1}{b^{n+1}(a+2+n)}\right)\\
\end{eqnarray*}
and hence
\begin{eqnarray*}
I'(0)
&=&-\ln(b-1)-\sum_{n=0}^\infty\frac{1}{b^{n+1}(2+n)}-\sum_{n=0}^\infty\frac{1}{b^{n+1}(2+n)^2}\\
&=&-\ln(b-1)+2+b\ln\frac{b-1}{b}-b\text{Li}_2(1/b).
\end{eqnarray*}
