Maths WorkshopMaths problems with full solutions
Exercise 46Calculus › Single-variable calculus › Integration › Riemann integralHigh schoolAdded 5 Nov 2026

A step function built from the floor

#step function#floor function#integral

Statement

Let ⌊x⌋\lfloor x\rfloor denote the integer part (floor) of xx, and define f:[0,4]→Rf:[0,4]\to\mathbb{R} by
f(x)=(−1)⌊x⌋ ⌊x⌋.f(x)=(-1)^{\lfloor x\rfloor}\,\lfloor x\rfloor.
Show that ff is a step function on [0,4][0,4] and compute
∫04f(x) dx.\int_0^4 f(x)\,dx.

Hint

Identify the subdivision points 0,1,2,3,40,1,2,3,4 and the constant value of ff on each open interval ]k,k+1[]k,k+1[; then sum ck⋅1c_k\cdot 1.

Show solutionHide solution

Solution

Step function. On each open interval ]k,k+1[]k,k+1[ with k∈{0,1,2,3}k\in\{0,1,2,3\}, the integer part equals kk, so ff is constant there with value
ck=(−1)k k.c_k=(-1)^k\,k.
Hence ff is a step function associated with the subdivision {0,1,2,3,4}\{0,1,2,3,4\}. The values at the subdivision points do not affect the integral.

Values on each subinterval.
- ]0,1[]0,1[: c0=(−1)0⋅0=0c_0=(-1)^0\cdot 0=0,
- ]1,2[]1,2[: c1=(−1)1⋅1=−1c_1=(-1)^1\cdot 1=-1,
- ]2,3[]2,3[: c2=(−1)2⋅2=2c_2=(-1)^2\cdot 2=2,
- ]3,4[]3,4[: c3=(−1)3⋅3=−3c_3=(-1)^3\cdot 3=-3.

Integral.
∫04f=∑k=03ck⋅1=0+(−1)+2+(−3)=−2.\int_0^4 f=\sum_{k=0}^{3}c_k\cdot 1=0+(-1)+2+(-3)=-2.

Conclusion. ff is a step function on [0,4][0,4] and
∫04(−1)⌊x⌋ ⌊x⌋ dx=−2.\int_0^4(-1)^{\lfloor x\rfloor}\,\lfloor x\rfloor\,dx=-2.