Integrate:$\int({1+x-\frac{1}{x}})e^{x+\frac{1}{x}}dx$ How to find
$$\int({1+x-\frac{1}{x}})e^{x+\frac{1}{x}}dx$$
I am thinking about breaking it into the form $$\int{e^x (f(x)+f'(x))}dx=e^x f(x)+C$$ Don't know how to split it. Please help.
 A: $$I=\int \left(1+x-\frac{1}{x}\right)\exp\left({x+\frac{1}{x}}\right)\,dx\\ \implies I= \int\left\{\exp\left({x+\frac{1}{x}}\right)+\left(x-\frac{1}{x}\right)\exp\left({x+\frac{1}{x}}\right)\right\}\,dx\\ \implies I= \int\left\{\exp\left({x+\frac{1}{x}}\right)+x\left(1-\frac{1}{x^2}\right)\exp\left({x+\frac{1}{x}}\right)\right\}\,dx$$
Now, if you consider $g(x)=\exp\left(x+\frac{1}{x}\right)$, the integral is of the following form:
$$I=\int\left\{g(x)+xg'(x)\right\}=\int \frac{d}{dx}\left(xg(x)\right)\,dx\\ \implies I=xg(x)+C~,~\textrm{where }C\textrm{ is the constant of integration}$$
So, we have,
$$I=x\exp\left(x+\frac{1}{x}\right)+C$$
Note: $\exp(x)=e^x$ is the exponential function.
A: The form of answer you want to try is $g(x) = f(x)e^{x + 1/x}$. Thus $$g'(x) = \left( f'(x) + (1 - 1/x^2)f(x)\right) e^{x + 1/x}$$ That is
$$f'(x) + (1 - 1/x^2)f(x) = 1 + x - 1/x$$
Try now $f(x) = A + Bx + C/x$. You'll find that $f(x) = x$.
Hence
$$\int \left( 1 + x - 1/x\right)e^{x + 1/x} \ dx = x e^{x + 1/x} + C$$
A: Hint: Observe that $$1+x-\frac{1}{x}\overset{1=(x)'}=(x)'+x\left(1-\frac{1}{x^2}\right)=(x)'+x\left(x+\frac{1}{x}\right)'$$ Thus $$\begin{align*}\left(1+x-\frac{1}{x}\right)e^{x+\frac{1}{x}}&=\left((x)'+x\left(x+\frac{1}{x^2}\right)'\right)e^{x+\frac{1}{x}}\\&=(x)'e^{x+\frac{1}{x}}+x\left(x+\frac{1}{x^2}\right)'e^{x+\frac{1}{x}}\\&=(x)'e^{x+\frac{1}{x}}+x\left(e^{x+\frac{1}{x}}\right)'=\left(xe^{x+\frac{1}{x}}\right)'\end{align*}$$
A: $\bf{My\; Solution::}$ Given $$\displaystyle \int \left(1+x-\frac{1}{x}\right)\cdot e^{x+\frac{1}{x}}dx\;,$$ Now put $$x=e^{i\phi} = \cos \phi+i\sin \phi.$$
Then $$\displaystyle x^{-1}=e^{-i\phi} = \cos \phi-i\sin \phi.$$ So we get $$\displaystyle \left(x+\frac{1}{x}\right)=2\cos \phi.$$ 
and $$\displaystyle \left(x-\frac{1}{x}\right)=2i\sin \phi.$$ and $dx = ie^{i\phi}d\phi.$
So Integral convert into $$\displaystyle \int \left(1+2i\sin \phi\right)\cdot e^{2\cos \phi} \cdot ie^{i\phi}d\phi = \int (i-2\sin \phi)\cdot e^{i\phi+2\cos \phi}d\phi.$$
Now Let $$\displaystyle (i\phi+2\cos \phi)=t\;,$$ Then $(i-2\sin \phi)d\phi = dt.$
So we get $$\displaystyle \int e^{t}dt = e^{t}+\mathcal{C} = e^{i\phi+2\cos \phi}+\mathcal{C} = e^{i\phi}\cdot e^{2\cos \phi}+\mathcal{C} = x\cdot e^{x+\frac{1}{x}}+\mathcal{C}$$.
So $$\displaystyle \int \left(1+x-\frac{1}{x}\right)\cdot e^{x+\frac{1}{x}}dx = x\cdot e^{x+\frac{1}{x}}+\mathcal{C}.$$
A: $\bf{Another\; Solution::}$ Let $$\displaystyle I = \int \left(1+x-\frac{1}{x}\right)\cdot e^{x+\frac{1}{x}} = \int \left(\frac{1}{x}+1-\frac{1}{x^2}\right)\cdot x \cdot e^{x+\frac{1}{x}}dx$$
Now We can Write $x = e^{\ln(x)}$.
So Integral $$\displaystyle I = \int e^{\ln(x)+x+\frac{1}{x}}\cdot \left(\frac{1}{x}+1-\frac{1}{x^2}\right)dx\;,$$
Now Let $$\displaystyle \ln(x)+x+\frac{1}{x} = t\;,$$
Then $$\displaystyle \left(\frac{1}{x}+1-\frac{1}{x^2}\right)dx = dt$$
So Integral $$\displaystyle I = \int e^{t}dt = e^{t}+\mathcal{C} = e^{\ln x+x+\frac{1}{x}}+C = e^{\ln x}\cdot e^{\left(x+\frac{1}{x}\right)}+\mathcal{C} = x\cdot e^{x+\frac{1}{x}}+\mathcal{C}$$
