When the integral of products is the product of integrals. I'm self-studying and was doing the following integral:
$$I = \int \frac{e^{\frac{1}{x}+\tan^{-1}x}}{x^2+x^4} dx $$
I solved it fine by letting $ u = \frac{1}{x} + \tan^{-1}x$. 
My question is about an alternative method I saw in which it seems the product rule was not applied:
$$ I = \int \left(\frac { e^{\frac{1}{x}}} {x^2}\right) \left( \frac{e^{\tan^{-1}x}}{x^2+1}\right) dx $$
$$ = \int \frac {e^{\frac{1}{x}}}{x^2} dx \cdot \int \frac{e^{\tan^{-1}x}}{x^2+1}dx$$
Completing the work following this step leads to the same solution as I originally found. 
It is this step that has confused me. I have checked using Wolfram and the two statements are equivalent but I do not understand why.
Why are we able to write the integral of products as the product of integrals here, and not apply the product rule?
Thanks in advance. 
 A: 
Why are we able to write the integral of products as the product of integrals here?

Assume you have two differentiable functions $f,g$ such that
$$
f'+g'=f'\cdot g' \tag1
$$ by multiplying by $\displaystyle e^{f+g}$ one gets
$$
(f'+g')\cdot e^{f+g}=\left(f'e^{f} \right)\cdot \left(g'e^{g} \right) \tag2
$$ then by integrating both sides
$$
e^{f+g}=\int\left(f'e^{f} \right)\cdot \left(g'e^{g} \right) \tag3
$$ since $\displaystyle e^f=\int\left(f'e^{f} \right) $ and $\displaystyle e^g=\int\left(g'e^{g} \right)$ we have

$$
\int\left(f'e^{f} \right)\cdot \int\left(g'e^{g} \right) =\int\left(f'e^{f} \right)\cdot \left(g'e^{g} \right). \tag4
$$

By taking, $f'=-\dfrac1{x^2}$ and $g'=\dfrac1{1+x^2}$ we have
$$
f'+g'=-\frac1{x^2}+\frac1{1+x^2}=-\frac1{x^2(1+x^2)}=f'g'
$$ which leads to $(4)$ with the given example.
A: Let $F(x)$, $G(x)$ and $H(x)$ be antiderivatives of $f(x)$, $g(x)$ and $f(x) g(x)$ respectively.  If $F(x) G(x) = H(x)$, then differentiating that equation
gives us
$$ f(x) G(x) + F(x) g(x) = f(x) g(x) $$
or
$$ f(x) + F(x) \frac{g(x)}{G(x) - g(x)} = 0 $$
(assuming $G(x) \ne g(x)$).  Given differentiable $G(x)$, with $g(x) = G'(x)$ and assuming $G(x) \ne g(x)$, you could get a suitable function $F(x)$ by solving the differential equation
$$ y'(x) + y(x) \frac{g(x)}{G(x) - g(x)} = 0$$
EDIT:
In the case at hand we may take $g(x) = e^{\arctan(x)}/(x^2+1)$ and $G(x) = e^{\arctan(x)}$.  The differential equation simplifies to 
$$ x^2 y'(x) + y(x) = 0 $$
which has the solutions
$$ y(x) = C e^{1/x}$$
and (for $C=1$) this is your $F(x)$.
