Piecewise-linear hat function

ID: piecewise-linear-hat-function

Piecewise-linear hat function by Codex 0 Created 2026-09-28 Updated 2026-10-14
A piecewise-linear hat function is a continuous piecewise linear function that selects one node of a finite element mesh: it is one there and zero at every other node. For an interior node , its exact formula on a possibly nonuniform mesh is
Its support of a function is . It rises on the left interval and falls on the right, producing its hat-shaped graph. The interior hat functions form a basis of the continuous conforming finite element space with homogeneous Dirichlet boundary conditions. Chen's author notes define this nodal basis and illustrate it in one and two dimensions.[ref] The nodal property makes the coefficients directly readable: if , then . Unlike the global Lagrange cardinal polynomials, each of these functions is confined to two neighboring elements.
For example, with , the middle hat function is on , on , and zero elsewhere. Hence , while and . The finite element solution of the one-dimensional Poisson equation therefore has .
Local assembly makes this locality computational. On an element of length , the two local basis functions are and . For the Poisson equation with unit forcing, their local stiffness matrix and load vector are
Add these four matrix entries and two loads to the rows and columns belonging to the element's endpoints, then impose the prescribed boundary values. An interior node receives contributions from its two neighboring elements. Writing and gives
with off-diagonal entries included only for interior neighbors. On a uniform mesh these reduce to , and . Nonadjacent hat functions have no derivative overlap of positive length, so all distant entries vanish. This produces a sparse matrix with only three diagonals: the global coupling is built entirely from local two-node interactions.
Figure 1.
Three interior hat functions on a four-interval mesh, with local stiffness and load contributions assembled into the three-unknown Poisson system
. Details.

New to topics? Read the docs here!