The weak form
Finite Elements
What you need to know first 1 concepts, 1 layers
The requisite-knowledge inventory for this page, bottom-up: the primitives at the base, combined upward until you reach what this page assumes. Skim the layers you already own; start wherever the ground gets unfamiliar.
- base
- ↳you are here
This is the return of integration by parts. The integration by parts formula has an interesting set of properties because it converts an integral into another equivalent form, two terms, one with a derivative and one without a derivative. The insight is that the method actually can be used to lower the degree of the derivative. With the right boundary conditions you can simply lower the derivative because the boundary term will go to zero. We'll get into the specifics of how to do this transformation works in a minute. This transformation has some interesting properties which kind of show you the relation between a differential equation and an integral. Fascinating right? The intuition behind the finite element me method is that you create an approximation over these finite regions and then you tune the approximations unti the solution is correct. You take one more difficult problem and turn it into a simpler problem. If you look at the solution, it almost looks like the trapezoidal rule, except all the books will tell you that it is a bunch of hat functions, which is correct, but you actually can build the trapezoids out of the hat functions. Finite elements are where all that nonsense about piecewise functions pays off. You actually get to use a piecwise linear approximation.
The strong form
Take 1D Poisson's equation as our running example:
This is the strong form. It demands that be twice differentiable everywhere on and that the equation hold at every single point. That's a stiff demand — and one we'll relax in a moment.
Multiply by a test function and integrate
Pick any function that vanishes at the boundary, — call it a test function. Multiply the strong form by and integrate over the domain:
This is just an integral identity, valid for any classical solution . Now integrate the left-hand side by parts once. The boundary term vanishes because is zero at both endpoints, leaving:
This is the weak form. Read what changed. On the left, the second derivative of is gone — we now have only first derivatives, paired symmetrically between and . On the right, the source is averaged against a test function instead of being matched pointwise. The original PDE was a constraint at every point; the weak form is a constraint for every choice of .
Why the trade is good
Three things changed for the better:
- Lower regularity required. The weak form only needs to be square-integrable, not . That's a much larger function space — and it includes piecewise-linear functions that are non-differentiable at the seams. Those are the basis functions FEM is going to use.
- Symmetric in and . The bilinear form treats both arguments the same way. Discretizing with the same basis for trial and test functions (Galerkin's method) gives a symmetric system matrix — Poisson is self-adjoint, and the weak form preserves that.
- Boundary conditions split cleanly. Dirichlet conditions (specified ) get baked into the function space — we just refuse to consider any that doesn't satisfy them. Neumann conditions (specified at the boundary) appear naturally from the boundary term we threw away in integration by parts; with a non-zero at the boundary they would contribute. We say Dirichlet is essential and Neumann is natural — and the labels reflect how each one enters the formulation.
From the weak form to a linear system
The weak form is still infinite-dimensional — ranges over an entire function space. To discretize, we restrict both and to a finite-dimensional subspace with basis . Write the discrete solution as a linear combination:
Plug into the weak form, take for each , and the integral collapses into something finite:
That's a linear system with
Solve for the coefficient vector and you have your discrete solution . The matrix is called the stiffness matrix and the vector is the load vector — both names are vestiges of FEM's origin in structural mechanics.
What this leaves us to design: the basis functions . The whole personality of an FEM implementation lives in that choice. Hat functions on a one-dimensional mesh — what the next chapter builds — are the simplest non-trivial choice, and they make sparse, symmetric, positive-definite, and tridiagonal. Hard to ask for a friendlier matrix.
Where this is going
Chapter 2 builds a 1D mesh and the corresponding hat-function basis, with a visualizer that lets you refine the mesh and see the basis adapt. Chapter 3 picks up where this one left off — it computes the integrals and in closed form per element, assembles them into the global and , solves the system, and overlays on the analytic so you can watch the FEM solution converge as the mesh refines.