Piecewise Functions, GIF, FPF, Modulus, and Max/Min Regions
In all our earlier problems, each boundary curve had a single formula all the way across the region. But very often, a curve changes its formula depending on where x lies—either because it is defined piecewise by cases (as we saw in Chapter 11, Piecewise Defined Functions), or because it contains special functions like:
the Greatest Integer Function (GIF), [x] (also written ⌊x⌋),
the Fractional Part Function (FPF), {x}=x−[x],
Modulus expressions, ∣f(x)∣, or
Maximum and Minimum functions, max(f(x),g(x)) and min(f(x),g(x)).
Once you learn how to split the x-axis cleanly at every point where a formula switches, these intimidating curves break down into ordinary polynomials, lines, and simple rectangles and triangles!
To find the area bounded by a piecewise curve over [a,b]:
Mark every breakpointc1,c2,…,ck inside (a,b) where the formula changes (either top curve, bottom curve, or both).
Split the integral at every breakpoint—even if there is a jump discontinuity! (Remember from Chapter 24 that a single vertical jump line has zero width and contributes zero area.)
Integrate each sub-interval separately using the formula valid on that sub-interval, and add the positive areas:
Recall that [x] (the Greatest Integer Function) denotes the largest integer less than or equal to x.
For 0≤x<1, [x]=0.
For 1≤x<2, [x]=1.
Watch out for negative numbers! For −1≤x<0, [x]=−1 (NOT 0!), and for −2≤x<−1, [x]=−2.
Geometrically, on every interval [n,n+1) between consecutive integers, [x] is a flat horizontal step of constant height n. That means finding area under [x] requires zero integration—you are just adding areas of rectangles!
How to Handle [g(x)] (GIF Inside Another Function)§
What if [x] is replaced by [x2], [x], [2x], or [2sinx]?
If g(x) is strictly increasing or strictly decreasing on [a,b], finding its range [g(a),g(b)] immediately tells you every integer k that g(x) crosses, and each equation g(x)=k has at most one root.
Whenever g(x) has turns (local maxima or minima), finding just the endpoint values can miss intermediate peaks or valleys and hit the same integer level multiple times. Always use the graphical horizontal-line method instead:
Draw the graph of y=g(x) carefully over the interval [a,b].
Draw horizontal lines at every integer value on the y-axis (y=…,−1,0,1,2,3,…) spanning the height of the curve. Think of each pair of consecutive lines y=k and y=k+1 as the floor (y=k) and ceiling (y=k+1) of one storey of a building.
Drop vertical lines down to the x-axis from every point where y=g(x) intersects a floor or ceiling line. These x-values (x1,x2,…) split [a,b] into sub-intervals.
Drop every portion of the curve onto its floor: any piece of y=g(x) lying inside the band between floor k and ceiling k+1 (meaning k≤g(x)<k+1) loses its extra fractional height above k and falls straight down onto floor k, turning into a flat horizontal step at y=k! Notice that floor always means the lower integer line—so for negative values too, a portion lying between floor −2 and ceiling −1 (−2≤g(x)<−1) drops down onto floor −2, never up to −1.
Look closely at how this floor-and-ceiling idea reads directly off the figure above:
On [x1,x2], the upper arch of y=g(x) lies between floor 2 and ceiling 3 (2≤g(x)<3), so that entire curved bump falls onto floor 2 ([g(x)]=2), forming the green rectangle of height 2.
On [a,x1), (x2,x3], and [x4,b], the curve lies between floor 1 and ceiling 2 (1≤g(x)<2), so every one of those pieces falls onto floor 1 ([g(x)]=1).
On (x3,x4), the valley dips between floor 0 and ceiling 1 (0≤g(x)<1), so it drops all the way onto floor 0 ([g(x)]=0), contributing zero height.
For a strictly increasing curve like y=[x2] on [0,2] below, x2 rises monotonically from 0 to 4, crossing the horizontal lines y=1,2,3,4 once each at x=1,2,3,2. So the area under y=[x2] on [0,2] is immediately the sum of four rectangles:
By definition, the Fractional Part Function is the leftover decimal part after removing the integer part:
{x}=x−[x]
Look carefully at what {x} looks like on each unit interval [n,n+1) (where n∈Z):
Since [x]=n on [n,n+1), we have {x}=x−n—a straight line segment of slope 1, starting at (n,0) and climbing to an open circle at (n+1,1)!
On negative intervals too, it keeps the exact same pattern: for x∈[−1,0), [x]=−1, so {x}=x−(−1)=x+1, which climbs from (−1,0) up to (0,1)!
Because {x+1}={x}, the fractional part function is periodic with period 1, and satisfies 0≤{x}<1 everywhere.
Notice the huge geometric shortcut: over any single unit interval [n,n+1], the area under y={x} is just a right triangle of base 1 and height 1, with area 21!
What if a function like x2, 2x, or 2sinx sits inside the fractional part braces—for example, y={x2} or y={2sinx}?
Instead of trying to guess the shape of {f(x)} directly, just convert it to GIF! Since 0≤{f(x)}<1 everywhere, {f(x)} never goes below the x-axis, so writing {f(x)}=f(x)−[f(x)] immediately gives the area on [a,b] as:
A=∫ab{f(x)}dx=∫abf(x)dx−∫ab[f(x)]dx
Notice why this solves almost every FPF area problem cleanly:
No sign-flipping is needed for {f(x)} itself, because 0≤{f(x)}<1 stays non-negative everywhere.
One smooth integral plus one floor problem:∫abf(x)dx is an ordinary integral over [a,b] with no breakpoints at all, while ∫ab[f(x)]dx is handled by the horizontal floor-and-ceiling method from Section 2.
(Geometric picture) Subtracting [f(x)] simply lowers every piece of y=f(x) sitting between floor k and ceiling k+1 down by k units, stacking all the leftover pieces neatly inside the horizontal strip 0≤y<1.
For example, we already found in Section 2 that ∫02[x2]dx=5−2−3. So the area under y={x2} on [0,2] takes one line—without ever sketching {x2}:
Rather than solving messy inequalities by hand, draw y=f(x) first and label the two kinds of branches right on the picture:
Mark the x-intercepts where f(x)=0.
Keep every portion on or above the x-axis (f(x)≥0) untouched—that branch has equation y=f(x).
Reflect every portion below the x-axis (f(x)<0) straight upward across the x-axis—that flipped branch has equation y=−f(x).
Quick Example: Find the area bounded by y=∣x2−1∣, the x-axis, and the lines x=−2 and x=2.
Look at y=f(x)=x2−1 plotted above: it crosses the x-axis at x=−1 and x=1, dipping below the axis between −1 and 1. Reading the labeled branches directly from the graph (and using y-axis symmetry on [0,2]):
On [0,1], the arch is the reflected portion: y=−f(x)=1−x2.
On [1,2], the outer arm lies above the axis: y=f(x)=x2−1.
Trying to figure out max(f,g) or min(f,g) by solving inequalities like f(x)≥g(x) algebraically is slow and unnecessary—especially with trig or multiple intersecting curves. By sketching the graphs first, you can read the exact answer with your eyes:
Draw both graphs y=f(x) and y=g(x) on the same axes.
Solve f(x)=g(x) to find and mark every intersection point where the curves switch places.
Read the top and bottom curves straight off the picture: between any two consecutive intersections, simply look at the sketch to see which curve sits higher and which sits lower—no inequality solving needed:
Trace the upper curve everywhere for max(f,g).
Trace the lower curve everywhere for min(f,g).
(Handy identity: Notice that max(f,g)−min(f,g)=∣f(x)−g(x)∣, while max(f,g)+min(f,g)=f(x)+g(x)! So if you need the area betweenmax(f,g) and min(f,g) on [a,b], it is simply ∫ab∣f(x)−g(x)∣dx!)
Example 2: Piecewise Curve Using GIF — Area Under y = [sqrt(x)]
Find the area bounded by y=[x], the x-axis, and the lines x=0 and x=9.
Solution:
As x goes from 0 to 9, x climbs from 0 to 3. It hits integers at:
x=0⟹x=0
x=1⟹x=1
x=2⟹x=4
x=3⟹x=9
On each interval between these breakpoints, [x] is constant:
x∈[0,1)⟹[x]=0 (width 1, height 0).
x∈[1,4)⟹[x]=1 (width 3, height 1).
x∈[4,9)⟹[x]=2 (width 5, height 2).
Adding the three rectangular step areas gives:
A=0(1)+1(4−1)+2(9−4)=0+3+10=13 sq. units.
Example 3: Non-Monotonic Curve Inside GIF — Area Under y = [2 sin x]
Find the area bounded by y=[2sinx], the x-axis, and the lines x=0 and x=π.
Solution:
Notice what happens if you only look at the endpoints: 2sin(0)=0 and 2sin(π)=0, even though the curve rises well above 0 in between! Because g(x)=2sinx has a turn (a maximum) inside [0,π], we sketch y=2sinx first and draw horizontal integer lines at y=0,1,2:
y=0 meets the curve at x=0 and x=π.
y=1 cuts 2sinx=1⟹sinx=21 at two points: x=6π and x=65π.
y=2 just touches the peak at the single point x=2π.
Dropping vertical lines from these intersections and dropping each piece onto its floor splits [0,π] as follows:
x∈[0,6π): lies between floor 0 and ceiling 1 (0≤2sinx<1), so it falls to floor 0⟹[2sinx]=0 (height 0).
x∈[6π,65π] with x=2π: lies between floor 1 and ceiling 2 (1≤2sinx<2), so it falls to floor 1⟹[2sinx]=1 (height 1).
x=2π: just touches floor 2, so [2sinx]=2, which is a single point of zero width and contributes 0 to the area.
x∈(65π,π]: lies between floor 0 and ceiling 1 (0≤2sinx<1), so it falls to floor 0⟹[2sinx]=0 (height 0).
So the entire non-zero region is a single rectangle of height 1 over [6π,65π]:
A=1×(65π−6π)=32π sq. units.
Example 4: Area Under a Fractional Part Transformation y = {2x}
Find the area bounded by y={2x}, the x-axis, and the lines x=0 and x=3.
Solution:
First look at the period of {2x}. Replacing x by x+21 turns {2(x+21)}={2x+1}={2x}. So {2x} repeats every 21 unit!
Over each half-unit interval [0,21),[21,1),…,[25,3), the graph is a straight triangle starting at height 0 and rising up to height 1, with base 21 and height 1. Across [0,3] there are 3÷21=6 identical triangles:
A=6×(21×21×1)=46=23 sq. units.
(Or directly by scaling: since {u} has area 23 on [0,3]—or 3 on [0,6]—horizontally compressing {x} by 2 gives ∫03{2x}dx=21∫06{u}du=21(6×21)=23!)
Example 5: Region Bounded by an Inequality With GIF — [x] + [y]
Find the area of the region R={(x,y):1≤[x]+[y]≤2,0≤x≤2,0≤y≤2}.
Solution:
Because 0≤x≤2 and 0≤y≤2, the integers [x] and [y] divide the [0,2]×[0,2] square into unit 1×1 squares: [x]∈{0,1,2} and [y]∈{0,1,2} (note x=2 and y=2 are just boundary lines of zero area).
Check which interior 1×1 squares satisfy 1≤[x]+[y]≤2:
[x]=0,[y]=0 (the square [0,1)×[0,1)): [x]+[y]=0 (excluded).
[x]=1,[y]=0 (the square [1,2)×[0,1)): [x]+[y]=1 (included).
[x]=0,[y]=1 (the square [0,1)×[1,2)): [x]+[y]=1 (included).
[x]=1,[y]=1 (the square [1,2)×[1,2)): [x]+[y]=2 (included).
Exactly 3 unit squares satisfy the condition, so:
A=3×(1×1)=3 sq. units.
Example 6: Multi-Modulus Bucket Function
Find the area bounded by the curve y=∣x−1∣+∣x−2∣+∣x−3∣ and the line y=4.
Solution:
The critical points where the modulus terms vanish are x=1,2,3. Write the piecewise formula interval by interval:
For x<1:−(x−1)−(x−2)−(x−3)=6−3x.
For 1≤x<2:(x−1)−(x−2)−(x−3)=4−x.
For 2≤x<3:(x−1)+(x−2)−(x−3)=x.
For x≥3:(x−1)+(x−2)+(x−3)=3x−6.
Check the corner values: (1,3), (2,2), (3,3), all lying below y=4. Now find where the outer wings meet y=4:
Left wing (x<1): 6−3x=4⟹x=32.
Right wing (x≥3): 3x−6=4⟹x=310.
Using symmetry about the vertical line x=2 (integrate from x=2 to 310 and double it!):
Example 7: Mixed Modulus, GIF, and FPF — y = |[x]| + {x}
Find the area bounded by the curve y=∣[x]∣+{x}, the horizontal line y=2, and the vertical lines x=−1 and x=2.
Solution:
Split [−1,2) at every integer breakpoint (−1,0,1,2) and evaluate [x], ∣[x]∣, and {x}=x−[x] carefully on each piece—especially on the negative interval [−1,0)!
On [−1,0):[x]=−1⟹∣[x]∣=1, and {x}=x−(−1)=x+1.
Therefore, y=1+(x+1)=x+2 (rising from 1 at x=−1 up to 2 at x=0).
On [0,1):[x]=0⟹∣[x]∣=0, and {x}=x.
Therefore, y=x (rising from 0 to 1).
On [1,2):[x]=1⟹∣[x]∣=1, and {x}=x−1.
Therefore, y=1+(x−1)=x (continuing smoothly from 1 up to 2!).
Look at the figure: the entire curve stays at or below y=2, forming two simple triangles below y=2!
Left triangle A1 on [−1,0]: base 1, height 2−1=1⟹A1=21(1)(1)=21.
Right triangle A2 on [0,2]: base 2, height 2−0=2⟹A2=21(2)(2)=2.
Total area:
A=21+2=25 sq. units.
Example 8: Mixed GIF and Modulus — y = [x] + |x - 1|
Find the area bounded by y=[x]+∣x−1∣, the x-axis, and the lines x=0 and x=2.
Solution:
The integer breakpoints are 0,1,2 (and x=1 is also where ∣x−1∣ switches sign!).
Example 11: Minimum of Absolute Value and Downward Parabola
Find the area bounded by the curve y=min(∣x∣,2−x2) and the x-axis.
Solution:
First check symmetry: replacing x by −x keeps both ∣x∣ and 2−x2 unchanged, so the graph is even (y-axis symmetric). Let us analyze x≥0, where ∣x∣=x.
Find where y=x intersects y=2−x2:
x=2−x2⟹x2+x−2=0⟹(x+2)(x−1)=0⟹x=1(x≥0)
Also y=2−x2 hits the x-axis at x=2 (and stays negative for x>2, so the bounded region above y=0 stops at x=2). Looking directly at the graph on [0,2]:
From x=0 to 1, the straight line y=x lies below the parabola y=2−x2, so min(∣x∣,2−x2)=x.
From x=1 to 2, the parabola plunges below the line down to the x-axis, so min(∣x∣,2−x2)=2−x2.
Example 12: Area Between max(sin x, cos x) and min(sin x, cos x)
Find the area bounded by y=max(sinx,cosx) and y=min(sinx,cosx) between x=0 and x=π.
Solution:
Instead of trying to compare sinx and cosx with inequalities, simply draw both y=sinx and y=cosx on [0,π] and find their intersection point:
sinx=cosx⟹tanx=1⟹x=4πin [0,π]
Now just look at the graph—your eyes instantly tell you which curve is max (on top) and which is min (on bottom), without solving a single inequality:
From 0 to 4π: cosx rides on top (max) while sinx stays on the bottom (min), so the vertical height between them is cosx−sinx.
From 4π to π: after crossing at (4π,21), sinx stays on top (max) while cosx drops to the bottom (min), so the vertical height between them is sinx−cosx.
Example 13: Bounded Region Using max(x^2, 1 - x^2) and a Horizontal Line
Find the area bounded by the curve y=max(x2,1−x2) and the line y=2.
Solution:
Sketch both standard parabolas on the same axes—y=x2 opening upward from (0,0) and y=1−x2 opening downward from (0,1)—together with the horizontal line y=2. Both curves are symmetric about the y-axis.
Find the intersection points:
Where the two parabolas cross each other:
x2=1−x2⟹2x2=1⟹x=±21(at y=21)
Where the outer rising branches meet y=2:
x2=2⟹x=±2
Look at how clear the picture makes it—no inequality checking is needed at all! Just trace the higher (upper) curve of the two parabolas on the right half x≥0:
From x=0 to 21, the downward arch y=1−x2 visibly sits abovey=x2, forming the middle hump of max(x2,1−x2).
From x=21 to 2, the upward parabola y=x2 rises abovey=1−x2, forming the outer wall up to y=2.
Using y-axis symmetry, the enclosed area below y=2 and above max(x2,1−x2) is: