NDA Maths · Definite Integration

Absolute Value, Piecewise and Greatest-Integer Integrals

When the integrand changes formula across the interval — an absolute value, a piecewise rule, or a greatest-integer function — split the integral at every break-point and integrate each piece on its own.

Why this matters

17 PYQs built on one habit: never integrate across a break-point. For |f(x)| the break-points are where f changes sign; for greatest-integer functions they are where the integer part jumps. Split, integrate each piece, add. Get the break-points right and these are reliable marks.

Concept 1 of 2

Integrating absolute-value and piecewise functions

Intuition

An absolute value hides a sign change. To integrate f(x)|f(x)|, find where ff is zero, split the interval there, and on each piece replace f|f| by +f+f or f-f according to its sign. The same split-and-integrate idea handles any piecewise rule.

Definition

The method for abf(x)dx\int_a^b |f(x)|\,dx:

  • Find the zeros of ff inside [a,b][a,b] — these are the sign changes.
  • On each subinterval, f=f|f| = f where f0f\ge 0 and f=f|f| = -f where f<0f< 0.
  • Integrate each piece and add. Because f0|f|\ge 0, the answer is the total (unsigned) area, so abfdxabfdx\int_a^b|f|\,dx \ge \big|\int_a^b f\,dx\big|.
split here (f = 0)|f(x)|f < 0 here →folded up

Worked example

Evaluate 28x5dx\displaystyle\int_2^8 |x-5|\,dx.
  1. x5x-5 is zero at x=5x=5: negative on [2,5][2,5], positive on [5,8][5,8].
  2. 25(5x)dx+58(x5)dx\int_2^5 (5-x)\,dx + \int_5^8 (x-5)\,dx.
  3. Each is a triangle of base 3, height 3: 1233=92\tfrac12\cdot3\cdot3 = \tfrac92 each.
Answer:92+92=9\frac92+\frac92 = 9.
Practice this conceptself-check · 3 quick reps

Try it yourself

Evaluate 0π/2sinxcosxdx\displaystyle\int_0^{\pi/2} |\sin x - \cos x|\,dx.

Practice — Level 1 (3 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    Where do you split x21dx\int|x^2-1|\,dx?
  2. 2.
    21xxdx=?\int_{-2}^{-1}\frac{x}{|x|}\,dx = ?
  3. 3.
    If abf=p\int_a^b f = p and abf=q\int_a^b|f| = q, which is larger?

From the bank · past-year question

Example 1Definite IntegrationMODERATE
0π/2sinxcosxdx\displaystyle\int_0^{\pi/2}|\sin x-\cos x|\,dx is equal to

[Q82 · Apr · 2019]

Find the zeros first — don't drop the absolute value

11(1x2)dx\int_{-1}^{1}(1-x^2)\,dx (no bars) gives a SIGNED area, but 11x21dx\int_{-1}^{1}|x^2-1|\,dx needs the sign of x21x^2-1 on each piece. Forgetting the bars (or the split) gives the wrong, signed value.

Concept 2 of 2

Integrating greatest-integer (floor) functions

Intuition

The greatest-integer function ⌊x⌋ is constant between consecutive integers and jumps by 1 at each integer. To integrate it (or anything built from it), split the interval at every point where the integer part changes, replace ⌊·⌋ by its constant value on each piece, and add.

Definition

Working with ⌊·⌋ under an integral:

  • ⌊x⌋ is constant on [n,n+1)[n, n+1) with value nn; split at each integer.
  • For ⌊x²⌋ or ⌊√x⌋, split where the INSIDE crosses an integer (e.g. ⌊x²⌋ jumps at x=1,2,3,x=1,\sqrt2,\sqrt3,\dots).
  • Useful identity: x+x=1\lfloor x\rfloor + \lfloor -x\rfloor = -1 for non-integer xx, so ab(x+x)dx=ab\int_a^b(\lfloor x\rfloor+\lfloor -x\rfloor)\,dx = a-b.
  • The fractional part xxx-\lfloor x\rfloor has nn+1(xx)dx=12\int_n^{n+1}(x-\lfloor x\rfloor)\,dx = \tfrac12.
01122334y = ⌊x⌋ — split the integral at each integer

Worked example

Evaluate 01.5xdx\displaystyle\int_0^{1.5} \lfloor x\rfloor\,dx.
  1. On [0,1)[0,1): x=0\lfloor x\rfloor = 0. On [1,1.5][1,1.5]: x=1\lfloor x\rfloor = 1.
  2. 010dx+11.51dx=0+0.5\int_0^1 0\,dx + \int_1^{1.5} 1\,dx = 0 + 0.5.
Answer:0.50.5.
Practice this conceptself-check · 3 quick reps

Try it yourself

Evaluate 02x2dx\displaystyle\int_0^{\sqrt2} \lfloor x^2\rfloor\,dx.

Practice — Level 1 (3 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    Value of x\lfloor x\rfloor on [1,0)[-1,0)?
  2. 2.
    nn+1(xx)dx=?\int_n^{n+1}(x-\lfloor x\rfloor)\,dx = ?
  3. 3.
    x+x\lfloor x\rfloor + \lfloor -x\rfloor for non-integer x?

From the bank · past-year question

Example 2Definite IntegrationMODERATE
What is 02[x2]dx\int_{0}^{\sqrt{2}}[x^2]\,dx equal to (where [.] is greatest integer function)?

[Q82 · Apr · 2018]

⌊x⌋ on [−1, 0) is −1, not 0

The floor of a negative non-integer rounds DOWN: 0.3=1\lfloor -0.3\rfloor = -1. A common slip is using x=0\lfloor x\rfloor=0 on [1,0)[-1,0) — it is 1-1 there, which flips the sign of the contribution.

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Watch out for (2)

Mastery check — 5 interleaved questions

Try each one before clicking. Questions are interleaved across the concepts above, not grouped — interleaving sharpens transfer.

Example 1Definite IntegrationMODERATE
What is e1e2lnxxdx\int_{e^{-1}}^{e^2}\left|\dfrac{\ln x}{x}\right|\,dx equal to?

[Q100 · Apr · 2017]

Example 2Definite IntegrationMODERATE
Let f(x)=[x]f(x) = [\sqrt{x}], where [][\cdot] is the greatest integer function.
What is 23f(x)dx\int_{\sqrt{2}}^{\sqrt{3}} f(x)\,dx equal to?

[Q99 · Apr · 2025]

Example 3Definite IntegrationEASY
Let p=abf(x)dxp=\displaystyle\int_a^b f(x)\,dx and q=abf(x)dxq=\displaystyle\int_a^b|f(x)|\,dx. If f(x)=exf(x)=e^{-x}, then which one of the following is correct?

[Q77 · Apr · 2024]

Example 4Definite IntegrationMODERATE
What is ab[x]dx+ab[x]dx\int_a^b [x]\,dx + \int_a^b [-x]\,dx equal to, where [.][.] is the greatest integer function?

[Q81 · Sep · 2018]

Example 5Definite IntegrationEASY
Consider the following for the items that follow: Let I=abxxdxI=\int_{a}^{b}\dfrac{|x|}{x}\,dx, a<ba<b.
What is II equal to when a<b<0a<b<0?

[Q85 · Apr · 2023]

Drill every past-year question on this subtopic

17 questions from the bank — paginated, with cart and Word-export support.