# Is long division must in integrating improper rational functions

I came across an integration question, which I tried to solved through substitution, but my answer is wrong. I entered the same question in Wolfram Alpha engine and saw the "Step-by-Step" solution which first used a long division.

I've got no problem with Wolfram Engine's approach but I want to know why my answer is wrong

So here is the question:

Evalute: $$\int \frac {x+7}{x+9} dx$$

My Solution:

Let $u=x+9$, therefore

$$du=dx$$

and,

$$x+7=u-2$$

So,

$$\int \frac{u-2}{u}du=\int \left(\frac uu-\frac2u\right)du= \int\left(1-\frac2u\right)du=u-2\ln{u}$$ $$u-2\ln{u}=(x+9)-2\ln{(x+9)}$$

Solution from Wolfram Alpha

By long division, we get:

$$\frac{x+7}{x+9}=1-\frac{2}{x+9}$$

So the Integral becomes:

$$\int \left(1-\frac{2}{x+9}\right)dx$$

Here another step was done: $u=x+9$, but it was trivial after coming this far...

$$\int \left(1-\frac{2}{x+9}\right)dx=x-2\ln{(x+9)}$$

The wolfram answer is wrong unless you add parenthesis to make it $x - 2\ln(x+9)$.
Your answer isn't wrong, the two expressions $(x+9) - 2\ln(u) = (x+9) - 2\ln(x+9)$ and $x-2\ln(x+9)$ seem to differ only by a constant. Remember that antiderivatives are only unique up to adding constant functions.