Why the Grid Comes First
A numerical approximation to a definite integral begins by deciding where the interval will be divided. Those division points form a grid: they mark the endpoints of the smaller pieces and provide the locations at which a numerical rule may use function values. If the grid is not set up correctly, a later calculation can use the wrong spacing or omit an endpoint.
In this tutorial, we focus on the equally spaced grid for a finite interval \([a,b]\) with \(a<b\). The panel count determines the width of each piece, and that width determines every grid point. The resulting construction is used by composite quadrature rules, but the grid itself can be specified and checked before choosing any particular rule.
Panels, Nodes, and Subintervals
Let \(a<b\), and let \(n\) be a positive integer. A panel is one of the equal pieces into which the interval is divided. A node is a point on the grid, including the endpoints, that marks the boundary of a panel. The subintervals are the closed intervals between successive nodes.
The index \(i\) labels nodes starting at \(0\), not at \(1\). Thus \(x_0=a\), and the final node is \(x_n=b\). There are \(n\) subintervals, each with a left and right endpoint. Because adjacent subintervals share their boundary node, the total number of distinct nodes is \(n+1\), not \(2n\).
In a composite quadrature rule, the function may be evaluated at some or all of these nodes, and contributions from the panels are combined. The precise weights and calculation depend on the rule. Here, the important point is to identify the grid accurately without assuming any particular quadrature formula.
Why This Construction Works
The width \(h\) must satisfy two requirements: every panel has the same width, and all \(n\) panels together cover the full interval of length \(b-a\). If each has width \(h\), their total length is \(nh\). Equating that total with \(b-a\) gives \(nh=b-a\), so \(h=(b-a)/n\). Starting at \(a\) and moving \(h\) at a time then gives each node.
This also proves that the subintervals cover the original interval without gaps or overlaps in their interiors. The first one begins at \(x_0=a\); each one ends where the next begins; and the last ends at \(x_n=b\). Their individual lengths are all \(h\), so their combined length is \(nh=b-a\).
The same grid can be viewed as a rescaling of the standard interval \([0,1]\). The points \(i/n\) divide \([0,1]\) into \(n\) equal pieces. Sending \(t\) to \(a+(b-a)t\) maps those points to \(a+i(b-a)/n\), exactly the grid nodes above. This viewpoint emphasizes that the construction applies to any finite interval, whether its endpoints are integers, fractions, or decimals.
Worked Examples
Worked Example: Four Panels on \([0,2]\)
Construct the equally spaced grid for \([0,2]\) using \(n=4\) panels.
The interval length is \(b-a=2-0=2\). Therefore the common panel width is
Use \(x_i=a+ih=0+i(1/2)\) for \(i=0,1,2,3,4\). The nodes are
The four subintervals are \([0,1/2]\), \([1/2,1]\), \([1,3/2]\), and \([3/2,2]\). Check the grid: each successive difference is \(1/2\), and \(4(1/2)=2\), the full interval length. The first node is \(0\), and the last is \(2\), as required.
Worked Example: Six Panels on \([-1,2]\)
Construct the grid for \([-1,2]\) with \(n=6\) panels. First calculate the interval length, taking care to subtract the negative endpoint:
Hence
Now apply \(x_i=a+ih=-1+i/2\) for \(i=0,1,2,3,4,5,6\):
There are six subintervals, from \([x_0,x_1]\) through \([x_5,x_6]\). Checking, each consecutive pair differs by \(1/2\); the total length is \(6(1/2)=3\); and the endpoints are \(-1\) and \(2\). Thus the listed nodes give the requested grid.
Worked Example: Three Panels on \([1,5]\)
Construct the grid on \([1,5]\) with \(n=3\) panels. The interval length is \(5-1=4\), so
Using \(x_i=1+i(4/3)\) for \(i=0,1,2,3\), the nodes are
The subintervals are \([1,7/3]\), \([7/3,11/3]\), and \([11/3,5]\). The successive differences are \(7/3-1=4/3\), \(11/3-7/3=4/3\), and \(5-11/3=4/3\). Their total length is \(3(4/3)=4\), and the final node is the right endpoint \(5\). Fractions keep the equal spacing exact; rounding the nodes prematurely could hide that property.
A Reliable Construction Procedure
When an interval and panel count are given, use the following sequence. Keeping the width calculation separate from the node calculation helps prevent indexing and endpoint errors.
Write the interval as \([a,b]\), with \(a<b\), and identify the positive integer \(n\). The number \(n\) counts panels, not nodes.
Calculate \(b-a\). If \(a\) is negative, subtracting \(a\) means adding its positive magnitude.
Set \(h=(b-a)/n\). Since \(b-a>0\) and \(n>0\), the width is positive.
Use \(x_i=a+ih\) for every integer index \(i\) from \(0\) through \(n\), including both endpoints.
Verify \(x_0=a\), \(x_n=b\), and \(x_i-x_{i-1}=h\) for each panel. Confirm there are \(n\) subintervals and \(n+1\) nodes.
If the variable represents a measured quantity, the width has the same units as that variable. For instance, if the integration interval is measured in seconds, \(h\) is measured in seconds as well. Every node then has units of seconds. This is a useful check against accidentally using an interval length or panel count incorrectly.
Common Mistake: Confusing Panels with Nodes
A frequent error is to interpret \(n\) panels as \(n\) nodes. For example, on \([0,1]\), suppose \(n=4\). A mistaken calculation might say, “There are four nodes, so there are three gaps,” and then assign width \(1/3\). That constructs four nodes \(0,1/3,2/3,1\), which actually define three panels, not four.
The correction is to use \(n=4\) in the panel-width formula: \(h=(1-0)/4=1/4\). The five nodes are \(x_i=i/4\) for \(i=0,1,2,3,4\), namely \(0,1/4,1/2,3/4,1\). They define four subintervals, each of width \(1/4\). The check is \(4(1/4)=1\), the length of \([0,1]\).
Scope and Practical Checks
This equally spaced construction is for a finite interval with \(a<b\) and a positive integer number of panels. A definite integral whose interval includes a singular endpoint or is unbounded requires additional care; the ordinary finite grid described here does not by itself settle how to handle such an integral. For a regular finite interval, however, once the grid is built, a composite rule can refer to its nodes and subintervals consistently.
Before using a grid in a numerical calculation, check three things: the width has been computed from the full interval length, the index range includes both endpoint nodes, and the final node equals \(b\). If any of those checks fails, the grid is not the requested equal partition.
Check Your Understanding
For each question, use the node convention \(x_i=a+ih\) and check your result by verifying the endpoints and spacing.
- For \([2,8]\) divided into six panels, what is \(h\), and what are the nodes?
- How many nodes are required for a grid with \(n\) panels? Explain why the counts differ by one.
- For \([-2,1]\) with three panels, write all the subintervals and check their widths.
- A grid has nodes \(1, 1.5, 2, 2.5, 3\). State the panel width, panel count, and interval.
- On \([0,1]\), explain why four nodes do not make a four-panel grid.