Absolute values and integration
Integral of Absolute Value: Split at Zeros and Check the Sign
An integral of absolute value keeps contributions above and below the x-axis nonnegative when the lower bound is smaller than the upper bound. It differs from taking the absolute value of an ordinary signed integral. Start with the function inside the bars. A zero may change its sign, but need not do so; check each open interval rather than flipping signs mechanically. Discontinuities and undefined points require their own integrability checks.

Direct answer
Use real inputs. A complete sign analysis requires every relevant zero and domain boundary; a few sampled values do not prove a global sign pattern.
Split at zeros before integrating
For |x|, the sign changes at zero. On x<0 the integrand is −x, so an antiderivative is −x²/2+C. On x>0 it is x, giving x²/2+C. Choosing the same constant makes the values meet at zero. The compact expression x|x|/2+C includes both branches and is differentiable at zero with derivative zero.
For ∫ from 0 to 1 of |2x−1| dx, solve 2x−1=0 to obtain x=1/2. On [0,1/2] integrate 1−2x; on [1/2,1] integrate 2x−1. Each part contributes 1/4, so the answer is 1/2. The linear absolute-value primitive (2x−1)|2x−1|/4 gives the same result.
Without the absolute value, ∫ from 0 to 1 of (2x−1) dx equals zero: the two signed contributions cancel. Taking |0| afterward still gives zero, not the required 1/2. Geometrically, total area must be formed before adding the contributions, not after they have canceled.
For ∫ from −1 to 1 of √(x²) dx, use the principal nonnegative square root: √(x²)=|x|. The two triangular areas are each 1/2, giving 1. Replacing √(x²) by x would incorrectly give zero on this interval.
To verify a proposed primitive, differentiate each open sign branch and also check that the branch constants produce a continuous function at the joins. Branch derivatives alone do not rule out a jump in the primitive. Numerical quadrature provides a separate check for specified finite bounds, but floating-point agreement is not a symbolic proof for arbitrary functions.
The calculator supports particular absolute-value and square-root patterns, including numeric affine expressions and certain trigonometric forms. It does not locate every zero of an arbitrary nonlinear function. A limitation response preserves the original problem; specify finite bounds if a numerical answer is the actual task, subject to domain and precision checks.
Worked examples
Keep one global constant and check the join at zero.
Split at x=1/2. Each part contributes 1/4.
The square root is |x|, not x on the whole interval.
Common mistakes
- • Replacing √(g²) by g without checking that g is nonnegative.
- • Taking the absolute value only after calculating a signed integral; cancellation has already removed area.
- • Finding one zero and assuming there are no others, or using independent branch constants that leave a jump in an alleged global primitive.
Try another sign boundary
Find the zero before computing. Use a reversed interval as a separate check of orientation.
Check before solving
Split at 1 and add nonnegative areas.
Reveal the reference answer
Reference answer
Check before solving
Reversing bounds changes the sign, even for a nonnegative integrand.
Reveal the reference answer
Reference answer
Try the worked examples in the calculator
Each link opens the matching calculator with the expression, variable and required conditions already filled in.
Each link preserves the expression and any finite bounds. Opening a link only fills the workbench. The first example asks for a primitive; the other two ask for numbers, so their lower and upper bounds are part of the problem.
Open the calculator without a preset: IntegralsReferences
Frequently asked questions
Is √(x²) always x?+
For real x it is |x|. It equals x when x≥0 and −x when x<0.
Can I take the absolute value after integrating?+
Generally no. For 2x−1 on [0,1], the signed integral is 0 but the integral of the absolute value is 1/2.
Can an integral of an absolute value be negative?+
With increasing bounds and an integrable real function it is nonnegative. Reversing the bounds negates the result; the reversed example here equals −1/2.
Conclusion
For an integral of absolute value, preserve the bars, split at the relevant zeros and check each sign interval. For a primitive, check the joins as well as the derivatives; for a definite integral, preserve the order of the bounds.
Compare usage plans