The function is a straight line that crosses the x-axis at x=1 (y=0 when x=1).
It has gradient 1.
From -1 to 1 the line y = x - 1 is below the x-axis and from 1 to 3 it is above the x-axis.
As the function is a straight line the areas between the function and the x-axis form triangles.
Using the result that the area of a triangle is 1/2 base x height, the area below the x-axis is 1/2 times the distance along the x-axis (from -1 to 1) x the distance of the value of y at x=-1 (= -1 -1 = -2) to the x-axis (=2)
(1/2)(1- (-1)) x 2 = (1/2)(2)(2) = 2
Similarly, the area above the x-axis is
(1/2)(3-1) x 2 = 2
Therefore the total area between the function and the x-axis is 2+2 = 4