# What substitution can be helpful here in this given integral problem

I am a beginner in integral calculus and I came across an integral problem which stated as follows. EDIT :

$$\int a^x {\left(\ln(x) + \ln(a) \ln \left(\frac{x} {e}\right)\right) } dx$$ I tried out substituting $$u = a^x$$ because I have terms like $\ln a, a^x$ which appears in $$du = a^x \ln(a) dx.$$

But then I worked out with using integration by parts and finally got stuck.

$$=\int a^x {\left(\ln(x) + \ln(a) (\ln(x) - 1)\right)}dx$$

$$=\int a^x \ln(x) dx + \ln(a) \int a^x (\ln(x) - 1) dx$$ $$=\int \frac{1} {\ln(a)} \ln \left(\frac{\ln(u)} {\ln(a)} \right)du + \int \left(\ln \left(\frac{\ln(u)} {\ln(a)} \right) - 1 \right) du$$ Now I am stuck.

I couldn't figure out where I went wrong in the process. Can someone please help me out. If possible can anybody give me more efficient way of solving this problem. Thanks for the help

You could do an integration by part earlier considering the function $x\mapsto \ln\left(x\right)+\ln\left(a\right)\left(\ln\left(x\right)-1\right)$as the function to derivate and $x\mapsto a^x$ as the function to integrate thus you get : $$\int a^x {\left(\ln(x) + \ln(a) \ln \left(\frac{x} {e}\right)\right) } dx=\dfrac{a^x\left(\ln\left(x\right)+\ln\left(a\right)\left(\ln\left(x\right)-1\right)\right)}{\ln\left(a\right)}-{\displaystyle\int}\dfrac{\left(\frac{\ln\left(a\right)}{x}+\frac{1}{x}\right)a^x}{\ln\left(a\right)}\,\mathrm{d}x\\=\dfrac{a^x\left(\ln\left(x\right)+\ln\left(a\right)\left(\ln\left(x\right)-1\right)\right)}{\ln\left(a\right)}-\class{steps-node}{\cssId{steps-node-1}{\dfrac{\ln\left(a\right)+1}{\ln\left(a\right)}}}{\displaystyle\int}\dfrac{a^x}{x}\,\mathrm{d}x$$ But you can't get the last integral in term of elementary functions, but you can use this special function, the Exponential integral you get : $${\displaystyle\int}\dfrac{a^x}{x}\,\mathrm{d}x=\operatorname{E_i}\left(\ln\left(a\right)x\right)$$