Why the Absolute Value Appears
The reciprocal function \(1/x\) is defined for every real number except zero. Its antiderivative must therefore account for both positive and negative inputs. The familiar logarithm \(\ln x\), however, is a real-valued function only when \(x>0\). Writing \(\ln x\) alone cannot give a real antiderivative of \(1/x\) on a negative interval.
The absolute value resolves this mismatch. For \(x>0\), \(|x|=x\); for \(x<0\), \(|x|=-x\), which is positive. Thus \(\ln|x|\) is defined for every \(x\ne0\). The key fact is that its derivative equals \(1/x\) on both sides of zero, even though its formula inside the logarithm behaves differently on each side.
Deriving the Formula on Each Interval
Zero separates the real domain of \(1/x\) into two intervals: \((-\infty,0)\) and \((0,\infty)\). To justify the formula, check the derivative separately on each interval. This is important because the absolute value has different expressions on the two sides.
If \(x>0\), then \(|x|=x\), so \(\ln|x|=\ln x\). The derivative rule for the natural logarithm gives \(\frac{d}{dx}\ln|x|=\frac{d}{dx}\ln x=\frac{1}{x}\).
If \(x<0\), then \(|x|=-x\), so \(\ln|x|=\ln(-x)\). By the chain rule, \(\frac{d}{dx}\ln(-x)=\frac{1}{-x}\cdot(-1)=\frac{1}{x}\).
Both calculations are valid on their stated intervals: the logarithm’s input is positive, and neither interval includes the point where the reciprocal function is undefined. Together they prove the formula on the entire domain of \(1/x\), understood one interval at a time.
This proof explains why simply using \(\ln(-x)\) is not the general answer either: that expression is appropriate on the negative interval, but it is not a real-valued logarithm when \(x>0\). The absolute-value notation packages the two valid expressions into one formula.
What the Antiderivative Statement Means
An antiderivative of a function \(f\) on an interval \(I\) is a differentiable function \(F\) such that \(F'(x)=f(x)\) for every \(x\in I\). The interval matters. The formula \(1/x\) is not defined at zero, so no claim that it has an antiderivative on an interval containing zero can apply.
On either interval \((-\infty,0)\) or \((0,\infty)\), every antiderivative of \(1/x\) has the form \(\ln|x|+C\), where \(C\) is constant on that interval. This uses the standard fact that two antiderivatives of the same function on an interval differ by a constant.
The notation is commonly written as one formula, but there is a small domain detail. The set of all nonzero real numbers is not one interval: it has a negative component and a positive component. A function can have one additive constant on the negative interval and a different additive constant on the positive interval. Thus, if describing every antiderivative on the full disconnected domain \(\mathbb{R}\setminus\{0\}\), the most precise form is
where \(C_-\) and \(C_+\) are independent constants. In routine indefinite-integral notation, \(\ln|x|+C\) is the standard answer; when a single interval of integration is specified, \(C\) is the constant for that interval.
Worked Examples
Worked Example: Find an Antiderivative on a Negative Interval
Find an antiderivative of \(1/x\) for \(x<0\), and verify it.
Because \(x<0\), \(|x|=-x\). Therefore a candidate is
Differentiate using the chain rule. The derivative of \(\ln u\) is \(u'/u\), with \(u=-x\) and \(u'=-1\):
For a numerical check, at \(x=-2\), \(F'(-2)=1/(-2)=-1/2\), which agrees with the integrand \(1/x\) at that input. The antiderivative is valid throughout the negative interval, not just at this check point.
Worked Example: Include a Constant Multiple
Find an antiderivative of \(-4/x\) on an interval that does not contain zero, and check it.
Multiplying the basic candidate by \(-4\) gives
For \(x\ne0\), differentiate each factor:
This is the original integrand, so the candidate is verified. For instance, at \(x=2\), the derivative is \(-4/2=-2\), and the integrand is also \(-4/2=-2\). The same derivative calculation holds for negative \(x\); the absolute value keeps the logarithm real there.
Worked Example: Use Different Constants on the Two Intervals
Consider the function defined by
Check whether it is an antiderivative of \(1/x\) on \(\mathbb{R}\setminus\{0\}\). On the negative interval, the constant \(3\) has derivative zero, and the logarithm has derivative \(1/x\):
On the positive interval, the constant \(-2\) also has derivative zero:
So \(F\) is an antiderivative at every point in its domain. The two constants need not match because zero is excluded: the domain does not connect the negative interval to the positive interval through a point where the derivative condition must hold.
A Common Mistake: Forgetting the Domain
A tempting but incomplete calculation is to write \(\int 1/x\,dx=\ln x+C\) and then use it for negative \(x\). The derivative formula \(\frac{d}{dx}\ln x=1/x\) only applies to the real-valued function \(\ln x\) where \(x>0\). For example, substituting \(x=-2\) into \(\ln x\) does not give a real number, so it cannot define a real antiderivative there.
The correction is to use \(\ln|x|\). At \(x=-2\), its value is \(\ln|-2|=\ln 2\), and its derivative on the negative interval is still \(1/x\). The absolute value does not mean the derivative is \(1/|x|\): on negative inputs the derivative of the inner expression \(-x\) contributes a factor of \(-1\), producing \(1/x\), including its negative sign.
Why Zero Cannot Be Included
The absolute value makes the logarithm’s input positive at every nonzero \(x\), but at zero the input is \(|0|=0\). The real natural logarithm is not defined at zero. Independently, \(1/x\) is also undefined at zero. Thus the formula is not an antiderivative at zero, and it cannot be applied across an interval containing zero as though the reciprocal function were defined throughout.
When using the formula, first identify the interval on which the integrand is defined. If that interval lies wholly to one side of zero, \(\ln|x|+C\) gives the antiderivatives there. If a problem describes both sides, keep in mind that the constants can be chosen separately on the two components.
Check Your Understanding
Use the derivative and domain checks from this tutorial to answer the following.
- For \(x<0\), rewrite \(\ln|x|\) without absolute-value bars and differentiate the result.
- Why is \(\ln x+C\) not a real antiderivative formula for \(1/x\) on a negative interval?
- Differentiate \(\ln|x|\) for \(x>0\), and state the interval on which your calculation applies.
- Can one antiderivative on \(\mathbb{R}\setminus\{0\}\) use different additive constants on the negative and positive intervals? Explain why.
- What prevents the formula \(\ln|x|+C\) from giving an antiderivative at \(x=0\)?