# Antiderivative of 1/x

1. Nov 4, 2015

### Cosmophile

We are going over antiderivatives in my calculus course and reached a question regarding $f(x) = \frac {1}{x}$.

My instructor went on to say that $\int \frac {1}{x}dx = \ln |x| + C$. This makes sense to me, but only to a certain point. For $f(x) = \frac {1}{x}$, $f$ is defined $\forall x \neq 0$. So we should have two interavls which we are looking at: $x < 0$ and $x > 0$. Because of this, we would then have:

$$\int \frac {1}{x}dx = \ln |x| + C_1 \qquad x > 0$$
$$\text {and}$$
$$\int \frac {1}{x}dx = \ln (-x) + C_2 = \ln |x| + C_2 \qquad x < 0$$

The second integral comes into being because $-x > 0$ when $x<0$. I brought this up to my teacher and he said that it made no sense and served no purpose to look at it this way. The argument I brought up was that the constants of integration could be different for the two intervals. I was hoping some of you may be able to help me explain why this is the case, or, if I am wrong, explain to me why I am.

Thanks!

2. Nov 4, 2015

### pwsnafu

You are correct. The "constant of integration" is constant over connected components of the domain. See also Wikipedia's article on antiderivative.

3. Nov 4, 2015

### fzero

It's an interesting idea, but the problem is that
$$\frac{d}{dx} \ln (-x) = - \frac{1}{x},$$
instead of $1/x$, so this isn't an antiderivative.

4. Nov 4, 2015

### pwsnafu

No $\frac{d}{dx} \ln(-x) = \frac{1}{x}$

5. Nov 4, 2015

### Cosmophile

If we are considering $x < 0$, $-x > 0$ so
$$\frac {d}{dx} \ln (-x) = \frac {1}{x}$$

Also, by the chain rule where $u = -x$, $\frac {du}{dx} = -1$, and

$$\frac {d}{dx} \ln(-x) = \frac {1}{-x}(-1) = \frac {1}{x}$$

6. Nov 4, 2015

### micromass

You are completely correct. There are two different constants of integration. Your teacher must not be very good if he doesn't know this.

7. Nov 4, 2015

### pwsnafu

Seconded. This
worries me. Mathematics is not concerned with with whether something "serves a purpose". There is plenty of mathematical research that serves no purpose other than itself.

8. Nov 4, 2015

### Cosmophile

I appreciate the replies thus far. I suppose I'm having a hard time developing an argument for my case to propose to him.

9. Nov 4, 2015

### PeroK

Essentially, you are correct. You can demonstrate this by taking:

$f(x) = ln|x| + 1 \ (x < 0)$ and $f(x) = ln|x| + 2 \ (x > 0)$ and checking that $f'(x) = \frac{1}{x} \ (x \ne 0)$

Usually, however, you are only dealing with one half of the function : $x < 0$ or $x > 0$. This is because an integral is defined for a function defined on an interval. For the function $\frac{1}{x}$, you can't integrate it from on, say, $[-1, 1]$ because it's not defined at $x = 0$.

So, strictly speaking, what the integration tables are saying is:

a) For the function $\frac{1}{x}$ defined on the interval $(0, +\infty)$, the antiderivative is $ln|x| + C$

b) For the function $\frac{1}{x}$ defined on the interval $(-\infty, 0)$, the antiderivative is $ln|x| + C$

In that sense, you don't need different constants of integration.

10. Nov 4, 2015

### micromass

I see no reason not to define the undefined integral on more general sets.

11. Nov 4, 2015

### Cosmophile

Why did you arbitrarily chose $C_1 = 1$ and $C_2 = 2$ in the first part of your response?

I understand that the antiderivative is defined only on intervals where the base function is defined, which means our integral is only defined on $(-\infty, 0) \cup (0, \infty)$. However, when I think of a constant added to a function, I simply think of a vertical shift. I understand that $f(x) = \frac {1}{x}$ has to have two independent antiderivatives as a consequence of the discontinuity, but I cannot see why it is necessary that the constants have to be different. Of course, a difference in constants is the only way that the two sides can be different, because we've already shown that, ignoring the added constant, the two sides have identical antiderivatives.

Am I making any sense? Sorry, and thanks again.

12. Nov 4, 2015

### PeroK

Why not?

A couple of technical points:

1)"The" antiderivative is actually an equivalence class of functions. "An" antiderivative is one of the functions from that class. For example:

$sin(x) + C$ (where $C$ is an arbitrary constant) is the antiderivative of $cos(x)$; and $sin(x) + 6$ is an antiderivative (one particular function from the antiderivative class).

2) There is no such thing as "the" function $1/x$, as a function depends on its domain. $1/x$ defined on $(0, \infty)$, $1/x$ defined on $(-\infty, 0)$ and $1/x$ defined on $(0, \infty) \cup (-\infty, 0)$ are three different functions.

The antiderivative of $1/x$ defined on $(0, \infty) \cup (-\infty, 0)$ is $ln|x| + C_1 \ (x < 0)$; $ln|x| + C_2 \ (x > 0)$. Where $C_1$ and $C_2$ are arbitrary constants. This is the full class of functions which, when differentiated, give $1/x$.

The two separate functions $1/x$ defined on $(0, \infty)$, and $(-\infty, 0)$ both have the antiderivate $ln|x| + C$, where $C$ is an arbitrary constant, defined on the appropriate interval.

There is, therefore, a subtle difference.

13. Nov 4, 2015

### HallsofIvy

Look at f(x)= ln(|x|)+ 9 for x> 0 and ln(|x|)+ 4 for x< 0. That function is differentiable for all non-zero x and its derivative is 1/x.

14. Nov 4, 2015

### Cosmophile

Your second point was very well said, and is certainly something I'll carry with me. So unless a particular domain is specified, such as $(0, \infty)$, I have to include the $\ln|x| +C_1 \quad (x < 0); \quad \ln |x| + C_2 \quad (x > 0)$.

I suppose my issue is coming from the fact that, when I see $f(x) = \frac {1}{x}$, I imagine the standard hyperbola $f(x) = \frac {1}{x}$ defined on $(- \infty, 0) \cup (0, \infty)$. Now, when I imagine the function $f(x) = \ln x$, I think automatically of this graph:

http://www.wolframalpha.com/share/img?i=d41d8cd98f00b204e9800998ecf8427eq1tuvuvmvh&f=HBQTQYZYGY4TMNJQMQ2WEZTBGUYDCNJQMQ3DAODGGAZTAMBQGI4Qaaaa But I've also seen this graph:

Which should I be thinking of for this problem?

Last edited: Nov 5, 2015
15. Nov 4, 2015

### Staff: Mentor

The second graph looks like it is probably f(x) = ln|x|.

16. Nov 5, 2015

### Cosmophile

You're right. I wonder why Wolfram interprets it that way, but only uses the right-hand side of the graph when I set it to show real values.

17. Nov 5, 2015

### Staff: Mentor

What was the equation you graphed? If you entered the integral in post #1 of this thread, the antiderivative is ln|x| (plus the constant).

18. Nov 5, 2015

### Cosmophile

I graphed $f(x) = \frac {1}{x}$ and got the funky results. Graphing ln|x| gave me what I needed. But if I'm given $f(x) = \frac {1}{x}$, with no specification of the domain, I end up with $F(x) = \ln |x| + C_1, \quad (x < 0); \ln|x| + C_2, \quad (x > 0).$

What's weird is that when I look at the graph of ln|x|, the two halfs seem connected (obviously, they aren't - there's a discontinuity at $x=0$), so it's hard for me to imagine why the two sides need different constants of integration. That would mean the two bits move around independently, and I can't at all think of an example of that if $f(x) = \frac {1}{x}$ with nothing else added.

I hope that makes some sense. I'd love to get some graphical insights - I think that would help me out a bit. Sorry for asking so much on what seems to be a fairly simple topic!

(Also, thanks for chiming in, Mark44. I can always count on you and Micromass to respond).

19. Nov 5, 2015

### PeroK

I suggest that you are getting yourself a bit confused over this. And, I guess this is why your maths instructor is saying it's not useful. There is nothing special about $1/x$. Any function $1/x^n$ has the same issue. Wolfram Alpha, for example, doesn't get into this subtlety of having different constants of integration. The same with tan(x) - you could have a different constant of integration on each interval upon which it's defined.

The key point is this. Suppose I have a differential equation:

$f'(x) = x^2$ and $f(1) = 0$ $(-\infty < x < \infty)$

This specifies a unique function: $f(x) = \frac{1}{3}(x^3 - 1)$

But, if we have:

$f'(x) = 1/x$ and $f(1) = 0$ $(x \ne 0)$

This does not specify a unique function. We also need a value for some $x < 0$. For example:

$f'(x) = 1/x$, $f(1) = 0$ $f(-1) = 1$ $(x \ne 0)$

The differential equation, therefore, splits into two:

For $x > 0$ we have $f(x) = ln|x| + C$, $f(1) = C = 0$, hence $f(x) = ln|x| (x > 0)$

For $x < 0$ we have $f(x) = ln|x| + C$, $f(-1) = C = 1$, hence $f(x) = ln|x| + 1 (x < 0)$

Now, of course, you could use $C_1$ and $C_2$ instead of reusing the symbol $C$ as I have done. But, it hardly matters. The important point is that the integration and differentiation for a function like $1/x$ must be done separately on each contiguous interval on which it's defined.

One final point. You can have the same situation with any function. Suppose we have:

$f'(x) = x \ (-2 < x < -1$ and $1 < x < 2)$

Then we are specifying a differential equation across two discontiguous intervals, hence we need two initial values, as there is a different constant of integration on each interval.

20. Nov 5, 2015

### micromass

About the wolfram issue. Wolfram alpha is a very good software but not infallible. In particular, here it is (strictly speaking) wrong.

When asked how to integrate $1/x$, wofram alpha somehow involves complex numbers. Furthermore, it will only show one particular primitive.
So when you ask for the primitive of $1/x$, wolfram accurately calculates the following primitive: $f(x) = \text{ln}(x)$ for $x>0$ and $f(x) = \text{ln}(x) + \pi i$ for $x<0$. (The explanation for why $\pi i$ is involved requires complex analysis). Anyway, this is a correct primitive as you can differentiate it to get $1/x$. Wolfram alpha is wrong however to say that any other primitive is of the form $f(x) + C$. Rather, it is of the form $f(x) + C_1$ for $x>0$ and $f(x) + C_2$ for $x<0$. In particular, we can choose $C_1 = 0$ and $C_2 = -\pi i$, to get $\text{ln}|x|$.
So if you want only the real values, then wolframalpha works with the same primitive $f$ that has already been computed. But this primitive is complex for $x<0$ and thus wolfram ignores it. So that is why it only shows $f(x)$ for $x>0$. There is a primitive that takes only real values (namely $\text{ln}|x|$), but wolfram does not compute it and erroneously states that the real primitive only exists for $x>0$.