On this page
It is easy to answer "ln x + C" when asked for the integral of 1/x. The NCERT textbook writes something slightly different. In its list of standard integrals, formula (xii) is ∫(1/x) dx = log|x| + C (NCERT Class 12 Mathematics Part II, Chapter 7: Integrals, p. 229). Those two vertical bars matter. Here is why they are there, where they change answers, and when you can leave them out.
Why is the integral of 1/x ln|x| and not ln x?
1/x is defined for every x except 0, so its graph has two separate pieces: x > 0 and x < 0. But ln x exists only for x > 0 (see why the logarithm of a negative number is undefined). So ln x covers only the right-hand piece and says nothing about the left.
For x < 0, try ln(−x). Since −x is positive there, it is defined. By the chain rule, d/dx ln(−x) = 1/(−x) × (−1) = 1/x. So ln(−x) is the antiderivative of 1/x on the negative side.
|x| equals x when x > 0 and −x when x < 0, so ln|x| is ln x on the right and ln(−x) on the left: one formula for both pieces. NCERT makes exactly this argument in Example 1(iii), combining the two derivatives into d/dx(log|x|) = 1/x for x ≠ 0 (NCERT, p. 232). OpenStax Calculus Volume 1 gives the same rule as ∫x⁻¹ dx = ln|x| + C (OpenStax Calculus Volume 1, Rule 5.22).
Where does the modulus change a definite integral?
It matters whenever the interval lies to the left of zero. Worked example: find ∫ from −3 to −1 of dx/x.
Antiderivative: ln|x|.
Upper limit: ln|−1| = ln 1 = 0.
Lower limit: ln|−3| = ln 3.
Answer: 0 − ln 3 = −ln 3, about −1.0986.
Without the bars, step 2 becomes ln(−1), which does not exist, and quietly dropping minus signs to carry on is how sign errors happen. Check instead: on [−3, −1], 1/x is negative, so the integral must be negative. −ln 3 passes.
The same thing happens in disguise: find ∫ from 0 to 2 of dx/(x − 3). As x runs from 0 to 2, x − 3 runs from −3 to −1, so it is negative the whole way. Using ln|x − 3| gives ln|−1| − ln|−3| = −ln 3. Write ln(x − 3) instead and both limits give the log of a negative number.
What if the interval crosses x = 0?
Then neither version works. 1/x shoots off to infinity at 0, so ∫ from −1 to 2 of dx/x is an improper integral, and it diverges. Plugging in the limits gives ln 2 − ln 1 = ln 2: confident, and wrong. It is the same trap as integrating 1/x² from −1 to 1.
Because the pieces are separate, the general antiderivative can even use a different constant on each side: ln|x| + A for x > 0 and ln|x| + B for x < 0 (Wikipedia, Lists of integrals). A single "+ C" hides the fact that the two sides are not joined. NCERT puts it this way: "In practice, we normally do not mention the interval over which the various functions are defined. However, in any specific problem one has to keep it in mind." (NCERT, p. 229)
When can you drop the modulus in ln|x|?
Drop the bars only when you can show that what is inside is positive on the whole interval. Safe cases:
Expressions that are always positive: x² + 1, eˣ + 1 or 2 + sin x. So ∫2x/(x² + 1) dx = ln(x² + 1) + C.
An interval entirely to the right of zero, such as ∫ from 1 to e of dx/x = ln e − ln 1 = 1.
Physical quantities that cannot be negative, such as volume, absolute temperature or distance from a centre.
Differential equations where the sign of y is folded into the constant. Our post on why we write the constant of integration as ln C shows how.
Keep the bars whenever the inside can be negative (x − 3, cos x, x² − 4) or when the interval is not given.
A useful habit: write the bars first, decide the sign of what is inside from the limits, and only then remove them. Then check the sign of your answer against the sign of the integrand.
If this kind of slip keeps costing you marks, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. To rebuild logarithms and antiderivatives, the Fermi Concept Library gives every concept in mathematics its own lesson.



