# How can I calculate $\int\frac{x-2}{-x^2+2x-5}dx$?

I'm completely stuck on solving this indefinite integral: $$\int\frac{x-2}{-x^2+2x-5}dx$$

By completing the square in the denominator and separating the original into two integrals, I get:

$$-\int\frac{x}{x^2-2x+5}dx -\int\frac{2}{(x-1)^2 + 4}dx$$

The second one is trivial, but the first one has me stuck. Whatever substitution I apply or form I put it in, I just can't figure it out. They're meant to be solved without partial integration, by the way.

• Hint: look at the derivative of $\ln (x^2-2x+5)$ to see how it helps. – J.G. Jan 13 at 22:17
• Let $u$ be the denominator and notice how $du$ nicely falls out. – John Douma Jan 13 at 22:17
• @JohnDouma That's what I tried, but if $u$ is the denominator, aren't I left with $\int\frac{xdu}{(2x-2)u}$? – Arcturus Jan 13 at 22:27
• You could refer to an online integral calculator. integral-calculator.com It has a complete solution. It is a rather long solution, so I feel kind of lazy to type them out. – Larry Jan 13 at 22:30

The numerator of the integrand almost looks like the derivative of the denominator, which indicates that the solution might involve a logarithm. Let's follow our nose and see if we can arrive at such an expression (you have the right idea of splitting the integral!):

\begin{align}\int\frac{x-2}{-x^2+2x-5}dx &= - \int \frac{x-2}{x^2 - 2x + 5}dx \\&= -\frac 12 \int \frac{2x-4}{x^2 - 2x + 5}dx. \end{align} The numerator of the integrand is looking more like the derivative of the denominator, but not quite. Further manipulation yields

\begin{align} \int\frac{x-2}{-x^2+2x-5}dx = -\frac 12 \left(\int \frac{2x-2}{x^2-2x+5}dx - \int \frac{2}{x^2-2x+5}dx\right). \end{align}

The second integral you can solve, can you solve the first?

• Thank you for a concise and very easy to understand answer. It's an ultimately simple trick of manipulating the expression to your favor, but the hard part is thinking of it. Well, hard at this late hour for me, at least :D Cheers mate. This will make any following similar problems that much easier to solve. – Arcturus Jan 13 at 22:58

Another plan that may be useful: once we see that form with the completed square, we make a simple substitution - not the whole thing, but just the part inside the square. \begin{align*}I &= -\int \frac{x-2}{(x-1)^2+4}\,dx\\ &\phantom{|}^{u=x-1}_{du=dx}\\ &= \int -\frac{u-1}{u^2+4}\,du = \int\frac{-u}{u^2+4}\,du+\int\frac{1}{u^2+4}\,du\end{align*} The substance of this is exactly the same as @E-mu's argument - the difference is how we arrive at the way to split the integrand. Instead of looking for the derivative of the denominator, we make an affine substitution so that the split becomes obvious.

Since $$x^2-2x+5=(x-1)^2+2^2$$, the substitution to do is $$2u=x-1$$, so the integral becomes $$\int\frac{2-x}{x^2-2x+5}\,dx= \int\frac{1-2u}{4u^2+4}2\,du=\frac{1}{2}\int\frac{1-2u}{u^2+1}\,du$$ No need to guess, now.