Put and . The interior piecewise-linear hat functions are
They are a basis of the continuous piecewise-affine functions vanishing at both endpoints. The support of a function for each hat only overlaps those of neighbouring hats, so the stiffness matrix is a tridiagonal matrix. Direct integration gives the derivative contribution on the diagonal and on adjacent diagonals.
For the potential contribution, symmetry about gives . On the overlap of and , their product is symmetric about , and its integral is . This is the affine-weighted hat mass matrix calculation. Consequently,
and all other entries vanish. The exact right-hand side is
Thus, with , the requested scalar equations are
At the endpoints the coefficient multiplying the zero boundary value is simply omitted. Since , its point values are not even well defined; replacing by would require an additional quadrature rule convention and regularity hypothesis, not present here. The exact Ritz method uses the displayed integrals. The finite element interpolation estimate and Céa lemma, using , give an energy norm error; the Aubin–Nitsche duality argument gives in the L2 norm on this interval.