Integral of $$$\frac{x^{2} + 1}{x^{2} - 1}$$$
Related calculator: Definite and Improper Integral Calculator
Your Input
Find $$$\int \frac{x^{2} + 1}{x^{2} - 1}\, dx$$$.
Solution
Since the degree of the numerator is not less than the degree of the denominator, perform polynomial long division (steps can be seen »):
$${\color{red}{\int{\frac{x^{2} + 1}{x^{2} - 1} d x}}} = {\color{red}{\int{\left(1 + \frac{2}{x^{2} - 1}\right)d x}}}$$
Integrate term by term:
$${\color{red}{\int{\left(1 + \frac{2}{x^{2} - 1}\right)d x}}} = {\color{red}{\left(\int{1 d x} + \int{\frac{2}{x^{2} - 1} d x}\right)}}$$
Apply the constant rule $$$\int c\, dx = c x$$$ with $$$c=1$$$:
$$\int{\frac{2}{x^{2} - 1} d x} + {\color{red}{\int{1 d x}}} = \int{\frac{2}{x^{2} - 1} d x} + {\color{red}{x}}$$
Apply the constant multiple rule $$$\int c f{\left(x \right)}\, dx = c \int f{\left(x \right)}\, dx$$$ with $$$c=2$$$ and $$$f{\left(x \right)} = \frac{1}{x^{2} - 1}$$$:
$$x + {\color{red}{\int{\frac{2}{x^{2} - 1} d x}}} = x + {\color{red}{\left(2 \int{\frac{1}{x^{2} - 1} d x}\right)}}$$
Perform partial fraction decomposition (steps can be seen »):
$$x + 2 {\color{red}{\int{\frac{1}{x^{2} - 1} d x}}} = x + 2 {\color{red}{\int{\left(- \frac{1}{2 \left(x + 1\right)} + \frac{1}{2 \left(x - 1\right)}\right)d x}}}$$
Integrate term by term:
$$x + 2 {\color{red}{\int{\left(- \frac{1}{2 \left(x + 1\right)} + \frac{1}{2 \left(x - 1\right)}\right)d x}}} = x + 2 {\color{red}{\left(\int{\frac{1}{2 \left(x - 1\right)} d x} - \int{\frac{1}{2 \left(x + 1\right)} d x}\right)}}$$
Apply the constant multiple rule $$$\int c f{\left(x \right)}\, dx = c \int f{\left(x \right)}\, dx$$$ with $$$c=\frac{1}{2}$$$ and $$$f{\left(x \right)} = \frac{1}{x - 1}$$$:
$$x - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} + 2 {\color{red}{\int{\frac{1}{2 \left(x - 1\right)} d x}}} = x - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} + 2 {\color{red}{\left(\frac{\int{\frac{1}{x - 1} d x}}{2}\right)}}$$
Let $$$u=x - 1$$$.
Then $$$du=\left(x - 1\right)^{\prime }dx = 1 dx$$$ (steps can be seen »), and we have that $$$dx = du$$$.
The integral can be rewritten as
$$x - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} + {\color{red}{\int{\frac{1}{x - 1} d x}}} = x - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} + {\color{red}{\int{\frac{1}{u} d u}}}$$
The integral of $$$\frac{1}{u}$$$ is $$$\int{\frac{1}{u} d u} = \ln{\left(\left|{u}\right| \right)}$$$:
$$x - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} + {\color{red}{\int{\frac{1}{u} d u}}} = x - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} + {\color{red}{\ln{\left(\left|{u}\right| \right)}}}$$
Recall that $$$u=x - 1$$$:
$$x + \ln{\left(\left|{{\color{red}{u}}}\right| \right)} - 2 \int{\frac{1}{2 \left(x + 1\right)} d x} = x + \ln{\left(\left|{{\color{red}{\left(x - 1\right)}}}\right| \right)} - 2 \int{\frac{1}{2 \left(x + 1\right)} d x}$$
Apply the constant multiple rule $$$\int c f{\left(x \right)}\, dx = c \int f{\left(x \right)}\, dx$$$ with $$$c=\frac{1}{2}$$$ and $$$f{\left(x \right)} = \frac{1}{x + 1}$$$:
$$x + \ln{\left(\left|{x - 1}\right| \right)} - 2 {\color{red}{\int{\frac{1}{2 \left(x + 1\right)} d x}}} = x + \ln{\left(\left|{x - 1}\right| \right)} - 2 {\color{red}{\left(\frac{\int{\frac{1}{x + 1} d x}}{2}\right)}}$$
Let $$$u=x + 1$$$.
Then $$$du=\left(x + 1\right)^{\prime }dx = 1 dx$$$ (steps can be seen »), and we have that $$$dx = du$$$.
Therefore,
$$x + \ln{\left(\left|{x - 1}\right| \right)} - {\color{red}{\int{\frac{1}{x + 1} d x}}} = x + \ln{\left(\left|{x - 1}\right| \right)} - {\color{red}{\int{\frac{1}{u} d u}}}$$
The integral of $$$\frac{1}{u}$$$ is $$$\int{\frac{1}{u} d u} = \ln{\left(\left|{u}\right| \right)}$$$:
$$x + \ln{\left(\left|{x - 1}\right| \right)} - {\color{red}{\int{\frac{1}{u} d u}}} = x + \ln{\left(\left|{x - 1}\right| \right)} - {\color{red}{\ln{\left(\left|{u}\right| \right)}}}$$
Recall that $$$u=x + 1$$$:
$$x + \ln{\left(\left|{x - 1}\right| \right)} - \ln{\left(\left|{{\color{red}{u}}}\right| \right)} = x + \ln{\left(\left|{x - 1}\right| \right)} - \ln{\left(\left|{{\color{red}{\left(x + 1\right)}}}\right| \right)}$$
Therefore,
$$\int{\frac{x^{2} + 1}{x^{2} - 1} d x} = x + \ln{\left(\left|{x - 1}\right| \right)} - \ln{\left(\left|{x + 1}\right| \right)}$$
Add the constant of integration:
$$\int{\frac{x^{2} + 1}{x^{2} - 1} d x} = x + \ln{\left(\left|{x - 1}\right| \right)} - \ln{\left(\left|{x + 1}\right| \right)}+C$$
Answer
$$$\int \frac{x^{2} + 1}{x^{2} - 1}\, dx = \left(x + \ln\left(\left|{x - 1}\right|\right) - \ln\left(\left|{x + 1}\right|\right)\right) + C$$$A