Yeah, integrals are like that sometimes, I think. Derivatives are more straightforward, usually, and so verifying an answer is often easier than coming up with it. Which makes the solutions come off as a post-produced trick, like a movie where shards of ceramic jump off the floor and make a vase.sum yun gai wrote:The solution she was given for the problem below i still think seems like kind of cheating to get a favorable integral, but maybe it's because of the exponential function...

∫ (e^x) / (1 + e^{2x}) dx

Anyway, my approach was to see that you've got (e^x dx) in there, which is d(e^x). And e^{2x} is (e^x)^2, So replace e^x with u and get

∫ du / (1 + u^2)

which you immediately recognize as being the derivative of the arctangent (1+x^2 in the denominator usually signals some kind of trigonometric nonsense)... that's the magic trick, since just plugging in u = tan v will work, but feels like cheating. If I were to plow through this without knowing about arctangent, I would do this:

∫ du / (1 + iu)(1-iu) ☜ factor the denominator into its (complex!) roots

½ ∫ [ 1/(1+iu) + 1/(1-iu) ] du ☜ partial fraction expansion

½ ln(1+iu) / i + ½ ln(1-iu) / -i ☜ integral of 1/(ax+b) is a natural logarithm

½i [ ln(1-iu) - ln(1+iu) ] ☜ factor out the i

½i ln [(1-iu)/(1+iu)] = v ☜ push the logarithms together and set the answer to v to manipulate it further

ln √[(1+iu)/(1-iu)] = iv ☜ push the ½ into the logarithm and multiply both sides by i

√[(1+iu)/(1-iu)] = e^{iv} ☜ take the exponential of both sides

√[(1+iu)^2/(1+u^2)] = cos v + i sin v ☜ multiply the top and bottom of the fraction by 1+iu on the left, complex exponential on the right

1+iu / √(1+u^2) = cos v + i sin v ☜ take the square root of a square on the left

1/√(1+u^2) = cos v, u/√(1+u^2) = sin v ☜ assume u is real, break into Real and Imaginary parts

u = tan v ☜ divide the right equation by the left equation

v = tan⁻¹ u ☜ whew!

So basically either you cheat or you plow through complex logarithms, exponentials, and a bunch of manipulation, much of which feels like cheating itself. So that means just cheat.

Anyway, the answer is

tan⁻¹ u

and u was just e^x so it's

tan⁻¹ e^x.

Was the solution something like that (without all the complex exponentials)?