4

Suppose $$ F(x)=\int \frac{x^2}{x^2+x-2}\,dx. $$ When I use Desmos to plot this integral it will give me this:

Image 1

The integral $F(x)$ seems to only exist between the two asymptotes that $\frac{x^2}{x^2+x-2}$ has: one at $x=1$ and another at $x=-2$. Why is this?

My textbook and maple gives the answer as $x-\frac{4}{3}\ln(2+x)+\frac{1}{3}\ln(x-1)$ which seems to exist only in in the interval $(1,\infty)$. This function looks like the purple curve in the following image.

Image 2

This does coincide with the graph Desmos draws as the integral, but only if I make the lower bound of the integral be some value between the rightmost asymptote and $+\infty$. This is what it looks like when I do that: Image 3

My questions are as follows...

  1. Why does desmos only plot a small interval of the entire domain of the function?
  2. Why is my textbook's answer, $x-\frac{4}{3}\ln(2+x)+\frac{1}{3}\ln(x-1)$, not a function with a domain of interval $(-\infty,+\infty)$?
  3. Does a function exist whose domain is from $-\infty$ to $+\infty$ that is this integral? If not, why?
  4. When integrating rational functions is this a common occurrence?

I would appreciate an answer that I could understand as a Calculus 2 student. Thanks!

Here it is the link to Desmos graph I mention:

2 Answers2

11

First of all, as you correctly say, the integrand $f(x) =\frac{x^2}{x^2+x-2}$ has vertical asymptotes at $x=-2$ and at $x=1$. This means that its domain is not, as you seem to think, the entire number line, but rather the number line with $-2$ and $1$ removed, i.e. $(-\infty,-2)\cup(-2,1)\cup(1,\infty)$.

Then, you do not distinguish clearly enough between the indefinite integral

$$\int \frac{x^2}{x^2+x-2} dx$$

and a definite integral (with one fixed bound $a$ and one moving boundary $x$) of the form

$$F_a(x) = \int_a^x \frac{t^2}{t^2+t-2} dt$$


The indefinite integral

$$\int \frac{x^2}{x^2+x-2} dx$$

is a purely symbolic notation which asks for the most general form of all antiderivatives of $f(x) =\frac{x^2}{x^2+x-2}$ on its domain (it cannot have an antiderivative outside of its domain), which as said earlier is $(-\infty,-2)\cup(-2,1)\cup(1,\infty)$. The correct answer to that would actually be

$$\int \frac{x^2}{x^2+x-2} dx = \begin{cases} x-\frac{4}{3} \ln\lvert 2+x \rvert+\frac{1}{3}\ln\lvert x-1\rvert +C \text{ if } x \in (-\infty,-2) \\ x-\frac{4}{3} \ln\lvert 2+x \rvert+\frac{1}{3}\ln\lvert x-1\rvert +D \text{ if } x \in (-2,1) \\ x-\frac{4}{3} \ln\lvert 2+x \rvert+\frac{1}{3}\ln\lvert x-1\rvert +E \text{ if } x \in (1,\infty) \end{cases}$$

where $C, D, E$ can be any real numbers, independently of each other. Even good textbooks forget about this subtlety, that the constant can be chosen differently on each connected component of the domain, and would write as answer just

$$x-\frac{4}{3} \ln\lvert 2+x \rvert+\frac{1}{3}\ln\lvert x-1\rvert +C.$$

They should, however, always include the absolute values in the logarithms. Written without them, the whole thing only makes sense for $x > 1$ because otherwise $\ln(x-1)$ is not defined. By the way, the more precise version actually comes in handy if one does not like absolute values, as on each part of the domain the sign of each term is clear: $$\int \frac{x^2}{x^2+x-2} dx = \begin{cases} x-\frac{4}{3} \ln (-x-2) +\frac{1}{3}\ln (1-x) +C \text{ if } x \in (-\infty,-2) \\ x-\frac{4}{3} \ln (2+x)+\frac{1}{3}\ln (1-x)+D \text{ if } x \in (-2,1) \\ x-\frac{4}{3} \ln (2+x) +\frac{1}{3}\ln (x-1) +E \text{ if } x \in (1,\infty). \end{cases}$$


Now what about a function of the form

$$F_a(x) = \int_a^x \frac{t^2}{t^2+t-2} dt$$

that you asked Desmos to plot there? Well the Fundamental Theorem says that this is one specific antiderivative of $f$ for $x\in [a,b]$ (or $[b,a]$) as long as $f$ is continuous on all of $[a,b]$ (or $[b,a]$). But as you say yourself, $f$ does have two rather bad discontinuities, at $-1$ and at $2$. As soon as either of them lies between $a$ and $x$, the integral defining $F_a(x)$ simply does not exist. What that means is that

For $a <-1$, the function $F_a(x) = \int_a^x \frac{t^2}{t^2+t-2} dt$ has domain $(-\infty, -1)$, and on that interval is an antiderivative of $f$.

For $-1<a<2$, the function $F_a(x) = \int_a^x \frac{t^2}{t^2+t-2} dt$ has domain $(-1, 2)$, and on that interval is an antiderivative of $f$.

For $2<a$, the function $F_a(x) = \int_a^x \frac{t^2}{t^2+t-2} dt$ has domain $(2, \infty)$, and on that interval is an antiderivative of $f$.

In either case, the function (on the corresponding interval and only there) must again be of the form $F_a(x)=x-\frac{4}{3} \ln\lvert 2+x \rvert+\frac{1}{3}\ln\lvert x-1\rvert +C$, but for a specific $C$ depending on $a$: where $C$ is to be computed easily from $F_a(a)=0$. And if you look closely, that is what Desmos plots for you in each case.


Added in response to the added question, "When integrating rational functions is this a common occurrence": Of course, analogous results hold for any function whose domain is all of $\mathbb R$ except for a discrete (e.g. finite) set of points, and which is continuous on said domain. That includes every rational function $\dfrac{p(x)}{q(x)}$, where that set is the finite set of solutions to $q(x)=0$ -- as soon as $q$ has any zeroes, the function has discontinuities. But similar things hold e.g. for $\tan(x) = \dfrac{\sin(x)}{\cos(x)}$ etc. The basic case $\displaystyle \int \dfrac{1}{x} dx$ is addressed e.g. in this question or in this video.

1

$\int \frac{x^2}{x^2+x-2}dx$

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

$\frac{2-x}{x^2+x-2}=\frac{A}{x-1}+\frac{B}{x+2}$

$2-x=A(x+2)+B(x-1)$

$A+B=-1$

$2A-B=2$

$3A=1\implies A=1/3, B=-4/3$

$\int 1+\frac{1}{3(x-1)}-\frac{4}{3(x+2)}dx = x +(1/3)\ln|x-1|-(4/3)\ln|x+2|+C$

The argument of natural log has to be positive so often absolute values are used instead of parentheses.

So the domain of the integral is $x>1$.

Desmos does weird stuff with vertical asymptotes.

I don't think Desmos is graphing the integral there. It's graph of the integral looks like the reciprocal of a polynomial function. The integrand is finite and positive for $x>1$. The integrand is also not continuous on the entire real line, so I'd expect bizarre behavior.

TurlocTheRed
  • 5,683
  • 1
    What do you mean by "the domain of the integral is $x>1$"? The integral is not a function but a set of functions having the integrand as derivative. – dfnu Jan 27 '24 at 06:59
  • IF $x<1$ the argument of the natural log becomes negative. You can't take the natural log of a negative number in calculus 2. – TurlocTheRed Jan 27 '24 at 07:00
  • Not correct. Consider the integral of $1/x$. The function $\log(-x)$ is a valid primitive. That's precisely the reason why there appears absolute values in your expression! – dfnu Jan 27 '24 at 07:02
  • 1
    I suggest you have a look at the other answer to better understand the situation, and then to review your answer. – dfnu Jan 27 '24 at 07:14