# Solution of a integral

$$\int e^x \, \left(1 + \frac{e^{-x}}{x} \right) \,dx$$ I got three different integrals from this one, which are integral of $e^x$, integral of $1/x$ and the third one is integral of $e^{-x}/x$ but I'm not sure how to solve the third one? Thanks in advnace.

-
How you got the third integral? – Voliar Apr 9 '14 at 18:44
@Voliar well, I made 1 to 1/x and the other part stays as it is, so I just splitted it to two integrals? Is it wrong? – user133022 Apr 9 '14 at 18:46
@user133022: You can't split over multiplication, just over sum (algebraic sum, which include subtraction as well). See my answer for more details. – rubik Apr 9 '14 at 18:56

Hint: After distributing multiplication, use the fact that: $$\displaystyle\int \left [ kf(x) + hg(x) \right ] dx = k\int f(x) dx + h\int g(x) dx$$

Complete spoiler (mouseover to reveal):

$$\displaystyle\int e^x \left ( 1 + \dfrac{e^{-x}}{x} \right ) dx = \int \left ( e^x + \dfrac{e^x \cdot e^{-x}}{x} \right ) dx = \int e^x dx + \int \dfrac{1}{x} dx = e^x + \ln |x| + C$$

-

It should come out as $\int (e^x + \frac{1}{x} ) \,dx$ since the powers cancel out.

-
Everybody is writing so beautifully, and my writing is so ugly. I should learn LaTeX or something... I am just viewing the source on different posts and copying it. – The very fluffy Panda Apr 9 '14 at 18:55
As far as I know, it always comes down to adding \displaystyle. It changes everything. Also use \left ( and \right ) for adapting parentheses (they automatically become big). – rubik Apr 9 '14 at 19:00
Thanks, the mouseover thing you did was awesome! – The very fluffy Panda Apr 9 '14 at 19:02
Oh thank you! Of course I learned it from some other guy here on Math.SE! – rubik Apr 9 '14 at 19:05
Use two dollar signs instead of one if you want it to be centered and large. – Mehrdad Apr 10 '14 at 7:41

$$\int e^x \bigg(1+ \frac{e^{-x}}{x} \bigg) dx = \int e^x + \frac{1}{x} dx = \int e^xdx + \int \frac{1}{x} dx$$

Can you take it from here?

-

Simplify first; integrate afterwards: $$e^x\left( 1+ \frac{e^{-x}}{x} \right) = e^x + \frac 1 x.$$

-

We have$$\int e^x\left(1+\frac{e^{-x}}{x}\right)dx=\int \left(e^x+\frac{e^{x}e^{-x}}{x}\right)dx=\int e^xdx +\int\frac{1}{x}dx$$

I suppose you can do the rest..

-
Why has this answer been downvoted? – rubik Apr 9 '14 at 19:22
@rubik Good question. I'm curious too - perhaps I shouldn't have given the answer straight. By the way, great answer, especially the mouseover. +1 – Alijah Ahmed Apr 9 '14 at 19:25
I downvoted for using $\ln|x|$ without mentioning that $0$ splits it into 2 primitive functions. But it's now removed, so I retract it. – user2345215 Apr 10 '14 at 21:42
@user2345215: Thanks for explaining the reason for your downvote. – Alijah Ahmed Apr 11 '14 at 5:25