Find the integral

∫(x^2-6x+1)/(x^2+1) dx

∫(x^2-6x+1)/(x^2+1) dx

=∫(x^2+1)dx/( x^2+1)-6∫xdx/( x^2+1)

= ∫dx - 6∫xdx/( x^2+1)

x - 6∫xdx/( x^2+1)

let z = x^2+1
dz = 2 x dx
so x dx = (1/2)dz
then
x - 6∫(1/2)dz/z

x - 3 ln z

x - 3 ln(x^2+1)

To find the integral ∫(x^2-6x+1)/(x^2+1) dx, we can use the method of partial fractions. Here's how you can do it:

1. Start by factoring the denominator. In this case, x^2+1 cannot be factored any further because it is the sum of squares.

2. Write the given expression as a sum of two fractions:

(x^2-6x+1)/(x^2+1) = A/(x^2+1) + Bx+C/(x^2+1)

Notice that the degrees of the numerators (x^2-6x+1 and Bx+C) are smaller than the degree of the denominator (x^2+1).

3. Multiply both sides of the equation by (x^2+1) to clear the denominators:

x^2-6x+1 = A + (Bx+C)

4. Expanding and matching the coefficients of like terms, we get:

x^2-6x+1 = (A+B)x + (A+C)

Equating the coefficients:
A+B = 0 (for the terms with x)
A+C = 1 (for the constant terms)

5. Solve the system of equations to find the values of A, B, and C. From equation (1), B = -A, and substituting it in equation (2), we get A + (-A) + C = 1. This simplifies to C = 1.

So, C = 1.

Substituting this value back into equation (2), we get A + 1 = 1, which implies A = 0.

Finally, B = -A = 0.

Therefore, A = 0, B = 0, and C = 1.

6. Rewrite the given expression using the values of A, B, and C:

(x^2-6x+1)/(x^2+1) = 0 + 0x + 1/(x^2+1)

7. Now, we can integrate each term separately:

∫0 dx = 0x + C1, where C1 is the constant of integration.

∫1/(x^2+1) dx = arctan(x) + C2, where C2 is the constant of integration.

8. Finally, adding the results of the integrals together, the solution is:

∫(x^2-6x+1)/(x^2+1) dx = 0x + arctan(x) + C1 + C2

Therefore, the integral of (x^2-6x+1)/(x^2+1) is:

∫(x^2-6x+1)/(x^2+1) dx = x - 6arctan(x) + C, where C = C1 + C2.