Evaluate $\frac{\int_{0}^{\infty}(1+x^2)^{-2012}dx}{\int_{0}^{\infty}(1+x^2)^{-2011}dx}$ 
QUESTION: Evaluate $$\frac{\int_{0}^{\infty}(1+x^2)^{-2012}dx}{\int_{0}^{\infty}(1+x^2)^{-2011}dx}$$


MY ANSWER: I have got $2$ doubts on this; But let me write down my solution first..
First we solve for some general $\int_{0}^{\infty} (1+x^2)^{-n}dx$. Let $x=\tan \theta$.
$\implies \theta=\tan ^ {-1} x$
$\implies d\theta=\frac{1}{1+x^2}dx$
$\implies (1+x^2)d\theta=dx$
Putting this in the integration we get
$$\int_{0}^{\frac{\pi}2} (1 + \tan ^2 \theta )(1 + \tan ^2 \theta)^{-n}  d\theta$$
$$=\int_{0}^{\frac{\pi}{2}} (\sec^2x)^{1-n} dx$$
$$=\int_{0}^{\frac{\pi}2} (\cos x)^{2n-2}dx$$
Now, we can use the reduction formula of the integration of $\cos ^n x$ which can be easily derived by integrating by parts. I directly write the formula here.. $$\int \cos ^n x = \frac{1}n \sin x \cos ^{n-1} x + \frac{n-1}n \int \cos ^{n-2} x dx$$
$$\implies \int_{0}^{\frac{\pi}2} \cos ^n x = \underbrace {\frac{1}n \sin x \cos ^{n-1} x \mid_{0}^{\frac{\pi}2}}_{0} + \frac{n-1}n \int_{0}^{\frac{\pi}2} \cos ^{n-2} x dx$$
$$\therefore \int_{0}^{\frac{\pi}2} \cos ^n x =\frac{n-1}n \int_{0}^{\frac{\pi}2} \cos ^{n-2} x dx$$
Thus we get a recursive relation.. Now in place of $n$ we just put $ (2n-2)$ and solve it out..
$$\therefore \int_{0}^{\frac{\pi}2} \cos ^{(2n-2)} x =\frac{2n-2-1}{2n-2} \int_{0}^{\frac{\pi}2} \cos ^{(2n-2-2)} x dx$$
$$\implies \int_{0}^{\frac{\pi}2} \cos ^{(2n-2)} x =\frac{2n-3}{2n-2} \underbrace{\int_{0}^{\frac{\pi}2} \cos ^{(2n-4)} x dx}_{\text{again continue from here...}}$$
$$\vdots \text{    } \vdots \text{      }\vdots$$
$$\implies  \int_{0}^{\frac{\pi}2} \cos ^{(2n-2)} x = \frac{(2n-3).(2n-5).(2n-7) \cdots (1)}{(2n-2).(2n-4) \cdots 2} \int_{0}^{\frac{\pi}2} 1 dx$$
$$\implies \int_{0}^{\frac{\pi}2} \cos ^{(2n-2)} x= \frac{(2n-3)!}{[(2n-2).(2n-4)\cdots(2)]^2} \frac{\pi}2$$
$$\implies \int_{0}^{\frac{\pi}2} \cos ^{(2n-2)} x= \frac{(2n-3)!}{[2^{n-1}(k-1)!]^2} \frac{\pi}2$$
Well, now the question becomes easy..

First doubt, in the official solution, they have also followed the same path, but their end function is
$$\int_{0}^{\frac{\pi}2} \cos ^{(2n-2)} x=\frac{\pi}2 \frac{(2n-2)!}{2^{2n-2}(n-1)!(n-1)!}$$
Everything is fine except that they have got $(2n-2)!$ and I have got $(2n-3)!$.
Then where is the error in my solution?


Next question, why can't we just write $$\frac{\int f(x)dx}{\int g(x)dx}=\int \frac{f(x)}{g(x)}dx$$
This would have made the problem a child's play then.. :P


Any alternate solutions to this problem will be greatly acknowledged..
Thank You for your help in advance..
 A: Here is my approach which is to use Beta function:
$$I_n: = \int_{0}^{\infty} \frac{1}{\left(x^2+1\right)^n}~dx = \frac{1}{2}\cdot \int_{0}^{\infty} \frac{1}{\sqrt{t}\left(t+1\right)^n}~dt=\frac{1}{2}\cdot\mathrm{B} \left(\frac{1}{2}, n - \frac{1}{2}\right)$$$$= \frac{1}{2}\cdot\frac{\Gamma (1/2)\cdot \Gamma (n-1/2)}{\Gamma (n)}$$
Hence the ratio will become:
$$\frac{I_{2012}}{I_{2011}}=\frac{  \Gamma (2011)}{\Gamma (2012)}\cdot \frac{ \Gamma (2012-1/2)}{\Gamma (2011-1/2)}=\frac{1}{2011}\cdot \left(2011-\frac{1}{2}\right)=\frac{2021}{2022}$$
A: As you're not asked to compute the integrals, I think it can be done in a much more simple way, with an integration by parts:
Denote $$I_n=\smash[t]{\int_0^{+\infty}\mkern-12mu\frac{\mathrm d x}{(1+x^2)^n}}.$$
You have to compute the ratio $\:\frac{I_{2012}}{I_{2011}}$. For this, we'll establish a recurrence relation between $I_n$ and $I_{n+1}$ via the integration by parts of $I_n$.
For this, set $$u=\frac 1{(1+x^2)^n},\enspace\mathrm dv=\mathrm dx,\enspace\text{ whence }\quad \mathrm du=\frac{-2nx\,\mathrm dx}{(1+x^2)^{n+1}},\enspace v =x.$$
You obtain
$$I_n=\frac x{(1+x^2)^n}\Biggr\vert_0^\infty+2n\int_0^{+\infty}\mkern-12mu\frac{x^2\,\mathrm d x}{(1+x^2)^{n+1}}=2n(I_n-I_{n+1}).$$
Therefore, we have the relation
$$2nI_{n+1}=(2n-1)I_n.$$
