# Solving the following integral (rational function, cubic over linear)

I'm trying to solve the following integral:

$$\int\frac{x^3}{(x+2)}\mathrm{d}x$$

It would seem to me to be a classic integration-by-parts problem, but trying to do that (with $u=x^3$ and $dv=1/(x+2)$ I find myself stuck with the integral:

$$\int 3x^2\ln(x+2)\mathrm{d}x$$ which I don't find a way to solve. How should I proceed? Or maybe I got it all wrong from the beginning?

• Do the division first. – David Mitra Aug 24 '14 at 11:22
• For a rational function, if the degree of the numerator is larger than the degree of the denominator, Polynomial Division is the way forward. – Ali Caglayan Aug 25 '14 at 11:24

$$\frac{x^3}{x+2}=x^2-2x+4-\frac8{x+2}$$ Thus... in some situations, integration by parts is not the solution. :-)

If you are trying to compute:

$$\int{\frac{x^3}{x+2}}dx,$$ then you can easily divide $x^3$ by $x + 2$, which yields $x^3 = (x + 2)(x^2 - 2x + 4) - 8$, that is,

$$\frac{x^3}{x+2} = x^2 - 2x + 4 - \frac{8}{x+2};$$

so:

$$\int\frac{x^3}{x+2}dx = \int{(x^2 - 2x + 4)}dx - \int{\frac{8}{x+2}}dx.$$

You solve these integrals and you obtain the solution.

• @mathlove You're right, sorry. Edited :) – Labba Aug 24 '14 at 11:39
• Thank you very much! But I guess I skipped something very basic... How did you do that division? – user159527 Aug 24 '14 at 11:44
• @user159527 I did it through the algorithm of polynomial long division: it's very similar to the algorithm used to divide numbers, that long division kids learn in school. It would be odd that you've never heard about that way of dividing polynomials, but anyway, you can check it on Wikipedia if you want :) – Labba Aug 24 '14 at 11:54

You can always use simple substitution i.e. $$u = x+2, du = dx$$ so $$\int \frac{x^3}{x+2} \, d x = \int \frac{(u-2)^3}{u} \, du = \int u^2 - 6 u + 12 - \frac{8}{u}$$

• A clean solution that you made look extra messy. This option would look a lot more inviting if you just wrote out the trinomial rather than using the sigma notation. – Mike Aug 24 '14 at 13:15
• @Mike fair point, I personally think the sigma notation is clean but I can see where you're (and the people who upvoted your comment) are coming from. – DanZimm Aug 24 '14 at 19:45

In general, an integral has three parts: a polynomial part, a rational part, and a logarithmic part. Depending on the integral, some of these parts may be zero (and hence omitted).

Taking rational functions as our example, consider:

$$\int \frac{x^3}{(x+2)^2} dx = \frac{1}{2} x^2 - 4 x + \frac{8}{x+2} + 12 \log (x+2) + C$$

The logarithmic part is $12 \log (x+2)$, the rational part is $\frac{8}{x+2}$, and the polynomial part is $\frac{1}{2} x^2 - 4x + C$.

In the specific case of rational functions:

• The polynomial part is nonzero if and only if the degree of the numerator is greater than or equal to the degree of the denominator. You can find it by doing the polynomial division. The quotient corresponds to the polynomial part and the remainder corresponds to the rest.
• The rational part is nonzero if and only if the denominator is not squarefree. You can determine if a polynomial $p(x)$ is squarefree by calculating $\gcd(p(x), p'(x))$. How to actually calculate this is beyond the scope of this answer; ask your favourite search engine about the Hermite reduction as one example.
• Anything left over is the logarithmic part, and it can be found by partial fraction expansion on the squarefree part of the denominator. (The Rothstein-Trager method is another option.)

Interestingly, it's not just rational functions that this applies to; integrals over fields which involve more interesting functions can be understood along the same lines, except that there's often a "nonelementary" part left over, where the nonelementary part is typically a standard integral or a simple function for which no elementary integral exists. For example, for some constants $\alpha_{p}$, $\alpha_{r}$, $\alpha_{l}$, $A$ and $B$:

$$\int \frac{\tan^4 x}{(\tan x + 2)^2} dx = \alpha_{p} \tan x + \alpha_{r} \frac{\tan x}{\tan x + 2} + \alpha_{l} \log (\tan x + 2) + \int A \tan x + B\,dx$$

(Don't believe me? Take the derivative of both sides and see for yourself. Use the fact that $\frac{d}{dx}\tan x = 1 + \tan^2 x$.)

If you understand this as a polynomial in $\tan x$ (as opposed to $x$ in the first example), there's a clear "polynomial part", "rational part", "logarithmic part" and "nonelementary part" here.

• "three parts: a polynomial part, a rational part, and a logarithmic part" Actually every polynomial is a rational function hence the tripartition you suggest needs qualifications. "rational polynomials" You probably mean rational fraction. – Did Aug 25 '14 at 10:14
• I just checked on MathWorld. My use of the term "rational polynomial" was semi-standard but apparently discouraged; I changed it to "rational function" as per Did's suggestion. – Pseudonym Aug 25 '14 at 17:38