Q$)$ Evaluate : $\int \tan^{-1}(\frac{(1+x^{n})-(x)}{1+x(1+x^{n})})dx$ for $n\geq 2$
Ans$)$ My Approach :
I Know how to integrate $\tan^{-1}(\frac{1}{1+x+x^{2}})dx$ .
Let me show how we integrate $I=\int \tan^{-1}(\frac{1}{1+x+x^{2}})dx$
$\implies I=\int \tan^{-1}(\frac{1}{1+x(1+x)})dx$
Now we can write $1=(1+x)-(x)$
$\implies I=\int \tan^{-1}(\frac{(1+x)-(x)}{1+x(1+x)})dx$
Now this is of the form of $\tan^{-1}(\frac{a-b}{1+ab})$
$\implies I =\int \tan^{-1}(1+x)dx-\int \tan^{-1}(x)dx$
Now after this step it is very easy to integrate $I$.
Similarly in this way I also tried to integrate $ I_1=\int \tan^{-1}(\frac{(1+x^{2})-(x)}{1+x(1+x^{2})})dx$
$\implies I_1=\int \tan^{-1}(1+x^{2})dx-\int \tan^{-1}(x)dx$
Now I am facing problem in integrating $\tan^{-1}(1+x^{2})dx$
Similarly in the same way I am also facing problem in integrating $\tan^{-1}(1+x^{n})dx$ for $n\geq 3$
Please help me out with this integral.
You've already observed that $$\tan^{-1} \frac{(1+x^n)-x}{1-x(1+x^n)} = \tan^{-1} (1+x^n) - \tan^{-1} x. \tag{1}$$ The second term is easily addressed. For the first term, we apply integration by parts with the choice $$u = \tan^{-1} (1+x^n), \quad dv = dx, \\ du = \frac{nx^{n-1}}{1 + (1+x^n)^2} \, dx, \quad v = x, \tag{2}$$ hence $$I_n = \int \tan^{-1} \frac{(1+x^n)-x}{1-x(1+x^n)} \, dx = x \tan^{-1} (1+x^n) - \frac{1}{1+x^2} - n \int \frac{x^n}{1+(1+x^n)^2} \, dx. \tag{3}$$ Let $P_n(x) = 1 + (1+x^n)^2$ be a monic polynomial of degree $2n$. Then $P_n(x) = 0$ implies $$x^n = -1 \pm i = \sqrt{2} e^{\pm 3\pi i/4}, \tag{4}$$ hence $P_n$ has roots $$r_{k,n} = 2^{1/(2n)} e^{3\pi i k/(4n)}, \quad s_{k,n} = 2^{1/(2n)} e^{-3\pi i k/(4n)}, \quad k \in \{1, \ldots, n\}\tag{5}$$ which are of course complex conjugates for the same $k$. It follows that $P_n$ admits a factorization into a product of irreducible quadratics: $$\begin{align} P_n(x) &= \prod_{k=1}^n (x - r_{k,n})(x - s_{k,n}) \\ &= \prod_{k=1}^n \left(x^2 - (r_{k,n} + s_{k,n}) x + r_{k,n} s_{k,n}\right) \\ &= \prod_{k=1}^n \left(x^2 - 2^{1+1/(2n)} \left(\cos \tfrac{3\pi k}{4n}\right) x + 2^{1/n} \right). \tag{6} \end{align}$$ Denote a representative quadratic factor of $P_n$ by $q_k(x) = x^2 - a_k x + b_k$ with $a_k = 2^{1+1/(2n)} \left(\cos \tfrac{3\pi k}{4n}\right)$ and $b_k = 2^{1/n}$. We seek a partial fraction decomposition of the form $$\frac{x^n}{P_n(x)} = \sum_{k=1}^n \frac{A_k x + B_k}{q_k(x)} \tag{7}$$ for suitable constants $A_k, B_k$. To this end, it is easier to work with the linear factors of $P_n$ in $\mathbb C$ and then multiply the conjugates: we require $$x^n = P_n(x) \sum_{k=1}^n \frac{C_k}{x - r_{k,n}} + \frac{D_k}{x - s_{k,n}} = P_n(x) \sum_{k=1}^n \frac{(C_k + D_k)x - (C_k s_{k,n} + D_k r_{k,n})}{q_k(x)}, \tag{8}$$ hence $A_k = C_k + D_k$ and $B_k = -(C_k s_{k,n} + D_k r_{k,n})$. Choosing $x = r_{k,n}$ in $(8)$ yields $$r_{k,n}^n = C_k \prod_{j \ne k} (r_{k,n} - r_{j,n}) \prod_{j=1}^n (r_{k,n} - s_{j,n}) = C_k (r_{k,n} - s_{k,n}) \prod_{j \ne k} q_j(r_{k,n}). \tag{9}$$ Consequently, $$C_k = \frac{r_{k,n}^n}{(r_{k,n} - s_{k,n}) \prod_{j \ne k} q_j(r_{k,n})}, \tag{10}$$ and similarly, $$D_k = \frac{s_{k,n}^n}{(s_{k,n} - r_{k,n}) \prod_{j \ne k} q_j(s_{k,n})}. \tag{11}$$ Therefore, $$\begin{align} J_n &= \int \frac{x^n}{P_n(x)} \, dx \\ &= \sum_{k=1}^n \int \frac{A_k x + B_k}{q_k(x)} \, dx \\ &= \sum_{k=1}^n \frac{A_k}{2} \int \frac{2x + 2B_k/A_k}{x^2 - a_k x + b_k} \, dx \\ &= \sum_{k=1}^n \frac{A_k}{2} \int \frac{2x - a_k}{x^2 - a_k x + b_k} + \frac{a_k + 2B_k/A_k}{x^2 - a_k x + b_k} \, dx \\ &= \sum_{k=1}^n \frac{A_k}{2} \left( \log|x^2 - a_k x + b_k| + \left(a_k + \tfrac{2B_k}{A_k}\right) \int \frac{dx}{(x-a_k/2)^2 + (b_k - a_k^2/4)} \right) \\ &= \sum_{k=1}^n \frac{A_k}{2} \left( \log|x^2 - a_k x + b_k| + \frac{A_k a_k + 2B_k}{A_k \sqrt{b_k - a_k^2/4}} \tan^{-1} \frac{x-a_k}{\sqrt{b_k - a_k^2/4}} \right) + C \\ &= \sum_{k=1}^n \frac{A_k}{2} \log|x^2 - a_k x + b_k| + \frac{A_k a_k + 2B_k}{\sqrt{4b_k - a_k^2}} \tan^{-1} \frac{2(x - a_k)}{\sqrt{4b_k - a_k^2}} + C \tag{12} \end{align}$$ where we have defined $a_k, b_k, A_k, B_k$ as above. This, combined with $I_n$ as described in $(3)$, yields the desired antiderivative. Hopefully I didn't make any typographical errors; I have not checked this result for specific $n$.