I know the answer, but I'm not getting at it, can someone point out my error? It's probably something stupid, b/c I've been doing math all day and my brain is fried.

Correct answer should be $\displaystyle x-ln(e^x+1)+C$

I'm not so interested in the best way to get this answer as I am in what I did incorrect. I did it 3 times now, and got the same answer (granted I used the same method, but this implies I also made the same mistake)

================================================

$\displaystyle \int \frac 1{1+e^x} ~dx$

--------------

Substitute

$\displaystyle a = 1+e^x$

$\displaystyle =\frac 1{a-1} ~da = dx$

--------------

$\displaystyle =\int \frac 1{a-1}*\frac 1a ~da$

$\displaystyle =\int \frac 1{(a-1/2)^2+1/4}\ ~da$

--------------

Substitute

$\displaystyle \frac 12tan(b) = a-\frac 12$

$\displaystyle \frac 12sec^2b ~db = da$

--------------

$\displaystyle =\frac 12\int sec^2b*\frac 1{\frac 14(tan^2b+1)}~db$

$\displaystyle =2 \int~db$

$\displaystyle =2b+c$

$\displaystyle =2 ~arctan(2a-1)+c$

$\displaystyle =2 ~arctan(2e^x+1)+c$