The trapezoidal rule is used to approximate the area under a curve by dividing it into trapezoids. It takes the average of the function values at the beginning and end of each sub-interval. The area is calculated as the sum of the areas of each trapezoid multiplied by the width of the sub-interval. An example calculates the area under y=1+x^3 from 0 to 1 using n=4 sub-intervals, giving an approximate result of 1.26953125. The document also provides an example of using the trapezoidal rule with n=8 sub-intervals to estimate the area under the curve of the function y=x from 0 to 3.