Variational methods and finite elements
Turn a coercive weak problem into a finite-dimensional approximation and inspect exactly what the discrete system enforces.
On this page
The question for today
What you’ll understand
- Derive a weak Poisson problem from a quadratic energy.
- Assemble the simplest conforming piecewise-linear finite element equation.
- Explain coercivity, Galerkin orthogonality, and the limits of an approximation guarantee.
A finite element approximation is more than joining samples with straight lines. It selects a finite-dimensional function space, asks the PDE's weak balance to hold against every test in that space, and solves the resulting algebraic problem. For a coercive elliptic equation, this construction also minimizes an energy. The connection explains both why a stiffness matrix has its sign structure and why a computed graph can be useful without satisfying the differential equation at every point.
Stationarity gives the weak equation
For −Δu=f with zero Dirichlet data, consider J(v)=one half the integral of |∇v|² minus the integral of fv over a suitable bounded domain. Perturb v by εw with w in H1_0 and differentiate at ε=0. Stationarity gives ∫∇u·∇w=∫fw, exactly the weak problem. For this symmetric coercive case the stationary point is the unique minimum, not an arbitrary saddle. Nonlinear energies, nonconvex coefficients, or different boundary conditions need their own analysis rather than inheriting that conclusion automatically.
The abstract setting is a bounded bilinear form a on a Hilbert space V and a bounded linear functional ℓ. If a(v,v) is at least α times the V norm squared for some α>0, Lax–Milgram gives a unique solution of a(u,v)=ℓ(v) for all tests. For the zero-Dirichlet Poisson problem, Poincaré's inequality connects the gradient norm to the full H1 norm. On a pure Neumann space constants destroy coercivity unless one passes to mean-zero functions or a quotient. Boundary choices therefore influence both the theorem and the matrix nullspace.
Choose a space before assembling a matrix
Let V_h be a conforming subspace of H1_0 made of continuous piecewise-linear functions on a mesh. Choose basis functions φ_j and write u_h=ΣU_jφ_j. Testing against each basis function produces K_ij=∫∇φ_j·∇φ_i and F_i=∫fφ_i, giving KU=F. The coefficients U are nodal values for the usual linear nodal basis, but that is a property of this basis rather than a universal definition of a finite element coefficient. Mesh geometry, element order, boundary treatment, and quadrature all affect the assembled system.
The discrete solution satisfies the weak equation only for tests in V_h. Subtracting the continuous and discrete equations gives Galerkin orthogonality a(u−u_h,v_h)=0. In the symmetric positive case this makes u_h the energy-orthogonal projection and gives best approximation in the energy norm. Céa's lemma gives an analogous constant-factor estimate for bounded coercive forms. Neither result promises a particular power of mesh width without regularity of the exact solution and suitable mesh approximation properties. Singular corners can limit regularity even when the data look smooth.
A small residual needs the right interpretation
Solving KU=F accurately removes algebraic error for the chosen discrete problem, not necessarily the error relative to the continuum solution. Mesh refinement addresses approximation error, while accurate quadrature addresses integration error. A continuous piecewise-linear function has zero second derivative inside each element but derivative jumps at element interfaces, so its pointwise strong residual is not the whole story. The weak form includes the effect of those jumps through integration. Residual-based error estimators must account for element contributions, interface jumps, and the boundary model.
The function lab plots only y=ax², its tangent at x, and its signed integral from zero to x. Set a=−1 and move x to compare the smooth quadratic shape with a linear tangent; observe where a local straight-line description differs from the curve. This is an analogy for local approximation, not a finite element mesh, an assembled stiffness matrix, or an error estimator. The one-node calculation below supplies the actual finite element construction and checks it against the known quadratic solution.
Work it through
Assemble a one-node finite element solution
Approximate −u''=2 on (0,1) with zero endpoint values using nodes 0, 1/2, 1 and continuous piecewise-linear elements.
There is one free basis function: φ(x)=2x on [0,1/2] and φ(x)=2(1−x) on [1/2,1]. It equals one at the interior node and zero at the endpoints.
Its stiffness entry is K=∫(φ′)² dx=4·(1/2)+4·(1/2)=4. Its load is F=∫2φ dx=2·(triangle area 1/2)=1.
The coefficient is U=F/K=1/4, hence u_h=φ/4. The exact solution u=x(1−x) also has value 1/4 at the midpoint, although the functions differ between nodes.
On each half-interval, u′−u_h′ ranges linearly from 1/2 to −1/2. Direct integration gives ∫|u′−u_h′|² dx=1/12. Thus matching all three nodal values does not make the approximation exact in energy.
The discrete midpoint value is 1/4, and the squared gradient error is 1/12 despite exact nodal agreement.
The living notebook
Explore the model
Interactive lab · function
Compare a smooth curve with local linear information
Set coefficient a to −1 in y=ax² and move position x to inspect the tangent and signed area. A tangent matches value and slope at one location yet misses curvature away from it. This is a local-approximation analogy; the lab contains no finite element basis, mesh refinement, stiffness assembly, or error estimator.
- y at chosen x
- 0.608
- Tangent slope · 2ax
- 1.35
- Signed area · ax³/3
- 0.182
This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forAn approximation must be judged in a stated norm, rather than by agreement at selected points.
Pause & reason
Check your understanding
Your turn
Try it yourself
For the same one-node mesh, change the source from 2 to 6. Find the midpoint coefficient and compare it with the exact solution.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
The stiffness stays four while the load scales linearly with the source.
Compare with the solution
The load becomes ∫6φ=3, so U=3/4. The exact zero-boundary solution is u=3x(1−x), whose midpoint is also 3/4. The finite element function is three times the earlier approximation. Its gradient error norm is multiplied by three, and its squared gradient error becomes 9/12=3/4. Nodal agreement still does not make the full functions identical.
Keep the idea
Take it with you
- A finite element method enforces a weak balance in a selected finite-dimensional space.
- Coercivity and boundary conditions support existence and stable approximation.
- Algebraic accuracy and continuum accuracy are separate error budgets.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.