Final Answer
Step-by-step Solution
Problem to solve:
Specify the solving method
Find the integral
Divide $x^5-x^4+x^2-2$ by $x^2+1$
Resulting polynomial
Expand the integral $\int\left(x^{3}-x^{2}-x+2+\frac{x-4}{x^2+1}\right)dx$ into $5$ integrals using the sum rule for integrals, to then solve each integral separately
Apply the power rule for integration, $\displaystyle\int x^n dx=\frac{x^{n+1}}{n+1}$, where $n$ represents a number or constant function, such as $3$
The integral $\int x^{3}dx$ results in: $\frac{x^{4}}{4}$
The integral of a function times a constant ($-1$) is equal to the constant times the integral of the function
Apply the power rule for integration, $\displaystyle\int x^n dx=\frac{x^{n+1}}{n+1}$, where $n$ represents a number or constant function, such as $2$
The integral $\int-x^{2}dx$ results in: $\frac{-x^{3}}{3}$
The integral of a function times a constant ($-1$) is equal to the constant times the integral of the function
Applying the power rule for integration, $\displaystyle\int x^n dx=\frac{x^{n+1}}{n+1}$, where $n$ represents a number or constant function, in this case $n=1$
The integral $\int-xdx$ results in: $-\frac{1}{2}x^2$
The integral of a constant is equal to the constant times the integral's variable
The integral $\int2dx$ results in: $2x$
Expand the fraction $\frac{x-4}{x^2+1}$ into $2$ simpler fractions with common denominator $x^2+1$
Expand the integral $\int\left(\frac{x}{x^2+1}+\frac{-4}{x^2+1}\right)dx$ into $2$ integrals using the sum rule for integrals, to then solve each integral separately
The integral of a function times a constant ($-4$) is equal to the constant times the integral of the function
Solve the integral by applying the formula $\displaystyle\int\frac{x'}{x^2+a^2}dx=\frac{1}{a}\arctan\left(\frac{x}{a}\right)$
Simplify the expression inside the integral
We can solve the integral $\int\frac{x}{x^2+1}dx$ by applying integration method of trigonometric substitution using the substitution
Now, in order to rewrite $d\theta$ in terms of $dx$, we need to find the derivative of $x$. We need to calculate $dx$, we can do that by deriving the equation above
Substituting in the original integral, we get
Applying the trigonometric identity: $\tan(x)^2+1=\sec(x)^2$
Simplify the fraction $\frac{\tan\left(\theta \right)\sec\left(\theta \right)^2}{\sec\left(\theta \right)^2}$ by $\sec\left(\theta \right)^2$
The integral of the tangent function is given by the following formula, $\displaystyle\int\tan(x)dx=-\ln(\cos(x))$
Express the variable $\theta$ in terms of the original variable $x$
The integral $\int\frac{x-4}{x^2+1}dx$ results in: $\frac{1}{2}\ln\left(x^2+1\right)-4\arctan\left(x\right)$
Gather the results of all integrals
As the integral that we are solving is an indefinite integral, when we finish integrating we must add the constant of integration $C$