I need to derive a recursive formula for the integral $$ \int\frac{1}{(1+x^2)^k} dx\qquad(1)$$
I started from the assumption that $$x=tan(t) \qquad(2)$$ $$dx=sec^2(t) dt \qquad(3)$$ $$\frac{dx}{sec^2(t)}=dt$$
Subtitiution (2) into $1+x^2$:$$1+tan^2(t) = sec^2(t)\qquad(4)$$
Insert (3), (4) into (1)
$$I_k=\int\frac{1}{(1+x^2)^k} dx= \int\frac{1}{(sec^2(t))^k} \cdot sec^2(t) dt= \int (sec(t))^{-(2k-2)}dt = \int(cost)^{2k-2}dt$$
I know that I should apply integration by part to the element $$\int(cost)^{2k-2}dt$$but I don't know how to do it. I know the formula for this integration, but my tries bring crazy results. How to solve it?