# Integral of (x-1)/(x^2-4x+5)

1. Mar 24, 2015

### Potatochip911

1. The problem statement, all variables and given/known data
Find the integral of (x-1)/(x^2-4x+5)

2. Relevant equations

3. The attempt at a solution

After completing the square I get
∫(x-1)/((x-2)^2+1)*dx
Using substitutions x-2=tanθ; x-1=tanθ+1; dx=sec^2θ*dθ
∫[(tanθ+1)*(sec^2θ*dθ)]/(tan^2θ+1)
After cancelling
∫(tanθ+1)*dθ
integrating this I get
-ln(cosθ)+θ+C
ln(secθ)+θ+C
After substituting x back in
ln(x^2-4x+5)+arctan(x-2)+C
My answer key has a 1/2 infront of the natural log and I'm at a loss as to how they get it.

2. Mar 24, 2015

### phyzguy

I think if you do the substitution properly, you will see that x^2-4x+5 = sec^2(θ), not sec(θ).

3. Mar 24, 2015

### Potatochip911

I'm confused because with my substitution x^2-4x+5 turns into sec^2(θ) after using the identity tan^2(θ)+1=sec^2(θ)

4. Mar 24, 2015

### Staff: Mentor

I think you misunderstood what phyzguy was saying. Here's what you wrote.
Your substitution in the 3rd line above is wrong. sec(θ) = $\sqrt{x^2-4x+5}$, not the $x^2-4x+5$ that you have. The 1/2 that you should be seeing comes from this square root.

Also, I would have done a substitution with u = x - 2 before doing the trig substitution. Doing that makes life simpler, IMO.

5. Mar 24, 2015

### Potatochip911

Whoops, yea I completely misunderstood and I will definitely try doing these with a u substitution for the x-a portion. Thanks!

6. Mar 25, 2015

### PeroK

Another approach is to split the integral up:

$\frac{x-1}{x^2-4x+5} = \frac{1}{2}\cdot \frac{2x - 4}{x^2-4x+5} + \frac{1}{x^2-4x+5}$

Then $\frac{1}{2}ln(x^2-4x+5)$ comes easily out of the first term as you have an exact derivative in the numerator.

7. Mar 25, 2015

### Potatochip911

Yea this is how wolfram alpha solved it but I figured it would be a good idea to understand both methods incase it's useful later on

8. Mar 25, 2015

### HallsofIvy

Staff Emeritus
Equivalently, completing the square, $$x^2- 4x+ 5= x^2- 4x+ 4+ 1= (x- 2)^2+ 1$$. Let y= x- 2 so that dy= dx and y+ 1= x- 1.
So $$\int \frac{x- 1}{x^2- 4x+ 5} dx= \int \frac{y+ 1}{y^2+ 1} dy= \int \frac{y}{y^2+ 1} dy+ \int\frac{1}{y^2+ 1} dy$$

9. Mar 26, 2015

### Potatochip911

Is it unusual that this integral can be solved in so many different ways?

10. Mar 26, 2015

### Staff: Mentor

No, it happens fairly often. It's always true, though, that when you have two or more ways to evaluate an indefinite integral, the answers will differ by at most a constant. An example is $\int sin(x)cos(x)dx$. One person can use a substitution u = sin(x), du = cos(x)dx. Another person can use a different substitution, u = cos(x), du = -sin(x)dx. When they integrate, they get what appear to be different answers, namely (1/2) sin2(x) + C and (-1/2)cos2(x) + C. However, since sin2(x) = 1 - cos2(x), it turns out that the two answers are different only by a constant.

11. Mar 26, 2015

### Potatochip911

Okay thanks that makes sense.