# Getting different answers when integrating using different techniques

Question: Is it possible to get multiple correct results when evaluating an indefinite integral? If I use two different techniques to evaluate an integral, and I get two different answers, have I necessarily done something wrong?

Often, an indefinite integral can be evaluated using different techniques. For example, an integrand might be simplified via partial fractions or other algebraic techniques before integration, or it might be amenable to a clever substitution. These techniques give different results. For example, looking over a few other questions on MSE:

1. From this question: evaluate $$\int x(x^2+2)^4\,\mathrm{d}x.$$

• Via the substitution $$u = x^2+2$$, this becomes $$\int x(x^2+2)^4\,\mathrm{d}x = \frac{1}{10}x^{10} + x^8 + 4x^6 + 8x^4 + 8x^2 + \frac{32}{5} + C.$$

• However, multiplying out the polynomial and integrating using the power rule gives $$\int x(x^2+2)^4\,\mathrm{d}x = \frac{1}{10}x^{10} + x^8 + 4x^6 + 8x^4 + 8x^2 + C$$

2. From this question: evaluate $$\int \frac{1-x}{(x+1)^2} \,\mathrm{d}x.$$

• Simplifying the integrand using partial fractions then integrating gives $$\int \frac{1-x}{(x+1)^2} \,\mathrm{d}x = \frac{-2}{(x+1)} - \ln|x+1| + C.$$

• Via integration by parts, we get $$\int \frac{1-x}{(x+1)^2} \,\mathrm{d}x = \frac{x-1}{(x+1)} - \ln|x+1| + C.$$

3. From this question: evaluate $$\int \frac {\tan(\pi x)\sec^2(\pi x)}2\,\mathrm{d}x.$$

• Using the substitution $$u = \sec(\pi x)$$, this becomes $$\int \frac {\tan(\pi x)\sec^2(\pi x)}2\,\mathrm{d}x = \frac {\sec^2(\pi x)}{4\pi} + C.$$

• Using the substitution $$u = \tan(\pi x)$$, this becomes $$\int \frac {\tan(\pi x)\sec^2(\pi x)}2\,\mathrm{d}x = \frac {\tan^2(\pi x)}{4\pi} + C.$$

• Interesting SAQ. What motivated you to post this. – Don Thousand Nov 27 '19 at 18:52
• This question has been posted in order to provide an abstract duplicate target for questions involving problems where students have found multiple antiderivatives using multiple techniques. More often than not, the problem comes down to recognizing that there is a constant of integration running around. – Xander Henderson Nov 27 '19 at 18:56
• Ah, I see. Makes sense. – Don Thousand Nov 27 '19 at 18:56
• There are some relevant chat conversations: chat.stackexchange.com/transcript/message/52713109#52713109 and chat.stackexchange.com/transcript/message/52713523#52713523. – Xander Henderson Nov 27 '19 at 18:57
• ok, good, I still not familiar with that procedure! – dfnu Nov 27 '19 at 23:51

It is entirely possible to correctly evaluate an indefinite integral using different methods and arrive at functions which look different. However, once the constant of integration is taken into account, the functions will agree. The moral of the story is to be mindful of the constants of integration.

### Antiderivatives

When working with indefinite integrals, it is important to remember that the symbol $$\int f(x) \,\mathrm{d}x$$ does not represent a single function, but rather an entire family of antiderivatives of $$f$$. Phrasing things a little bit more formally:

Definition: Suppose that $$f$$ is integrable on the on interval $$(a,b)$$. An antiderivative of $$f$$ is a function $$F$$ such that $$F'(x) = f(x)$$ for all $$x \in (a,b)$$.

With respect to this definition, antiderivatives are not unique. For example, both $$F(x) = \frac{1}{2} x^2 \qquad\text{and}\qquad G(x) = \frac{1}{2} x^2 + 1$$ are antiderivatives of the function $$f(x) = x$$, since $$F'(x) = x = G'(x).$$ Thus any particular integrable function may have many, many distinct antiderivatives. However, it can be shown that if $$F$$ and $$G$$ are both antiderivatives of a function $$f$$ (in the sense defined above), then $$F$$ and $$G$$ differ by at most a constant.

Since antiderivatives differ from each other by at most a constant, it is common to adopt a notation for "the" antiderivative of a function which captures this typically inessential distinction. Thus $$\int f(x)\,\mathrm{d}x$$ represents the entire collection antiderivatives. Moreover, as antiderivatives differ by at most a constant, we also often write $$\int f(x) \,\mathrm{d}x = F(x) + C,$$ where $$F$$ is any particular antiderivative, and $$C$$ is a "constant of integration."

### Error Detection

As noted above, it is entirely possible to tackle a single indefinite integral in multiple ways and get entirely different looking results. However, the primary motivation for doing a problem in more than one way is to detect mistakes. Hence the fact that antiderivates are not unique may be troublesome. Therefore, from a pedagogical or learning point of view, detecting antiderivatives which differ by a constant might be helpful.

In general, one wants to show that if $$F$$ and $$G$$ are both purported antiderivatives of a given function, then $$F - G$$ is a constant function. Showing that $$F-G$$ is constant might not be trivial, but there are a couple of strategies which come to mind:

1. Inspection: Sometimes, it is obvious that two functions differ by only a constant. For example, in example (1), above, the two polynomials differ by $$\frac{32}{5}$$. This can be seen without doing too much work. Thus if either function is an antiderivative of the given function, then both are.

2. A Little Algebra: Other times, it is not immediately obvious that two functions differ by a constant. In example (2), above, it might require a little work: \begin{align} &\left[\frac{-2}{(x+1)} - \ln|x+1|\right] - \left[\frac{x-1}{(x+1)} - \ln|x+1| \right] \\ &\qquad\qquad= \frac{-2}{x+1} - \frac{x-1}{x+1} \\ &\qquad\qquad= \frac{-2 - x + 1}{x+1} \\ &\qquad\qquad= \frac{-(x+1)}{x+1} \\ &\qquad\qquad= -1, \end{align} which is a constant.

3. Differentiate: One possibility is to simply differentiate the two results and see if they are the same. However, one might be able to save a little work: if two functions differ by a constant, then their difference will have derivative $$0$$. In example (3), above: \begin{align} &\frac{\mathrm{d}}{\mathrm{d}x} \left[ \frac {\sec^2(\pi x)}{4\pi} - \frac {\tan^2(\pi x)}{4\pi} \right] \\ &\qquad\qquad= \frac{1}{4\pi} \left( 2\sec(\pi x)\cdot \sec(\pi x)\tan(\pi x)\cdot \pi - 2\tan(\pi x) \cdot \sec(\pi x)^2 \cdot \pi \right) \\ &\qquad\qquad= 0. \end{align} As the derivative of the difference is zero, the original functions differ by (at most) a constant.

Of course, in this example, one could also use trig identities (as suggested in one of the linked answers), but then I wouldn't get to discuss this alternative. ;)

More generally, it is helpful to keep various identities in mind. In particular, if two different procedures give seemingly different results, think about the kinds of functions which are involved, and search out relevant identities. For example, $$\cos(x)^2 + \sin(x)^2 = 1 \qquad\text{and}\qquad \tan(x)^2 = 1 - \sec(x)^2$$ for real $$x$$ such that the functions involved are defined, and $$\log(xy) = \log(x) + \log(y),$$ for all positive $$x$$ and $$y$$. Different substitutions or integration by parts steps may lead

• I quibble a bit with #3 as a check to see that the answers are essentially the same. You're just checking each antidifferation by differentiating. That's something you could or should have done with either one separately. – Ethan Bolker Nov 27 '19 at 19:03
• @EthanBolker I did note at the beginning of that entry that one can simply differentiate both antiderivatives and see that they give the same thing. However, it is often easier to check that the difference has zero derivative---in this case, there are no extra terms which cancel out, so differentiating the difference is no easier or harder than differentiating each function independently. However, there is a principle that I wanted to demonstrate---if you have a better example, please add it. – Xander Henderson Nov 27 '19 at 19:07