If
then g(x) gives the signed area under f(x) over a given interval starting at 0.
In particular,
since the integral of any function over a single point is zero;
since the area under f(x) over the interval [0, 4] is a right triangle with length and height 4, hence area 1/2 • 4 • 4 = 8;
since the area over [4, 8] is the same as the area over [0, 4], but on the opposite side of the t-axis;
since the area over [8, 12] is the same as over [4, 8], but doesn't get canceled;
since the area over [12, 16] is the same as over [0, 4], and all together these four triangle areas cancel to zero;
since the area over [16, 20] is a trapezoid with "bases" 4 and 8, and "height" 4, hence area (4 + 8)/2 • 4 = 24;
since the area over [20, 24] is yet another trapezoid, but with bases 8 and 12, and height 4, hence area (8 + 12)/2 • 4 = 40, which we add to the previous area.