Where finite differences run out of room
The previous rung taught you to solve a partial differential equation by stamping a stencil onto a regular grid: replace each derivative by a difference of neighbouring values, demand that the equation hold at every interior node, and you get a big sparse linear system to solve. The five-point Laplacian is the poster child — clean, fast, and a joy on a rectangle. The trouble is the words 'regular grid' and 'rectangle'. The moment your domain is a turbine blade, a human aorta, a car body with curved fillets, or a crack tip, a tidy axis-aligned grid no longer fits the shape. You can try to staircase the boundary, but the corners you invent are not in the real problem, and the accuracy there suffers. Finite differences are a method that loves straight rulers in a world full of curves.
The finite element method begins by refusing the grid entirely. Instead of points marching in rows, it chops the domain into a mesh of small triangles or tetrahedra — little flat pieces that you can fit snugly against any curved boundary, fine where the action is and coarse where it is calm. But there is an immediate puzzle. A derivative is defined at a point; how do you even ask for a second derivative across the seam where two flat triangles meet, where the solution might have a kink? The honest answer is that the classical, pointwise form of the PDE is the wrong thing to insist on here. We need a way of stating the same physics that survives kinks, irregular meshes, and curved walls. That restatement is the weak form, and getting to it is the whole job of this guide.
Multiply by a test function and integrate
Take the simplest interesting PDE, a one-dimensional model of a heated rod or a loaded string: -u''(x) = f(x) on the interval from 0 to 1, with u(0) = 0 and u(1) = 0. The classical or strong form demands that this equation hold at every single point x, which silently requires u to have a genuine second derivative everywhere. The first move of the weak form is to relax that demand into something gentler. Pick any smooth test function v(x) that vanishes at the two endpoints, multiply the whole equation by it, and integrate over the rod: the integral of -u''(x)*v(x) dx equals the integral of f(x)*v(x) dx. We have stopped insisting the equation hold pointwise and started insisting it hold on average, weighted by v. Think of v as a probe: instead of checking the temperature at one spot, you press the probe against the whole rod and read off a weighted total.
Here is the decisive trick, and it is just integration by parts. On the left we have the integral of -u''*v dx. Integrating by parts moves one derivative off u and onto v: the integral of -u''*v dx becomes the integral of u'*v' dx, minus a boundary term [u'*v] evaluated at the endpoints. But we chose v to vanish at both endpoints, so that boundary term dies. What remains is breathtakingly balanced: the integral of u'(x)*v'(x) dx equals the integral of f(x)*v(x) dx, required to hold for every admissible test function v. Notice what happened to the derivatives. We started needing two derivatives of u, and now we need only one derivative each of u and v — the burden was shared out evenly. This is exactly why the form is called 'weak': it asks less of u than the original equation did.
STRONG form (pointwise): -u''(x) = f(x) for every x in (0,1), u(0)=u(1)=0
multiply by test fn v, v(0)=v(1)=0, integrate:
integral of -u''(x) v(x) dx = integral of f(x) v(x) dx
integrate by parts (boundary term vanishes since v(0)=v(1)=0):
WEAK form: integral of u'(x) v'(x) dx = integral of f(x) v(x) dx for ALL such v
\_______ a(u,v) ________/ \______ L(v) ______/
two 2nd-derivatives -> one 1st-derivative on each sideWhy 'weaker' is actually stronger
It feels backwards that asking less of the solution should help. The payoff is that the weak form admits solutions the strong form would reject, and those are exactly the ones we can compute. A function made of straight line segments — a piecewise-linear hat shape, like the piecewise-linear interpolant you met earlier — has no second derivative at its corners, so it can never satisfy -u'' = f pointwise. But its first derivative exists almost everywhere (it is just a staircase of constant slopes), so the integral of u'*v' dx makes perfect sense. The weak form happily lets simple, kinked, mesh-friendly functions into the competition. We have widened the door precisely so that the candidates we can actually build with a mesh are allowed to walk through it.
There is a second gift hiding in that vanished boundary term, and it concerns boundary conditions. The condition u(0) = u(1) = 0 had to be built into our space of candidate functions by hand — we only allowed functions that are already zero at the ends. Conditions of this 'pin the value' type are called essential boundary conditions because they are essential to even define the space. But suppose the rod's end were instead insulated, prescribing the slope u'(0) rather than the value. That kind of condition turns out to live inside the boundary term we threw away; by choosing whether v vanishes there, such conditions get absorbed automatically into the weak form without being imposed on the space at all. These are natural boundary conditions. The distinction between essential and natural boundary conditions — one baked into the space, one falling out of the integral — is a direct and lasting consequence of integrating by parts.
Galerkin: from infinitely many test functions to a matrix
The weak form still lives in an infinite-dimensional world: it must hold for every test function v in a whole function space, and the unknown u ranges over that space too. A computer cannot juggle infinitely many functions, so we do what numerical analysis always does — replace the infinite space by a finite, manageable piece of it. Choose a finite collection of simple building-block functions, the shape functions phi_1, ..., phi_N defined on the mesh (in one dimension, the little hat functions, each one a tent peaked at a single mesh node and zero at all the others). Look for an approximate solution that is a combination of just these: u_h(x) = c_1*phi_1(x) + ... + c_N*phi_N(x). The N unknown numbers c_1, ..., c_N are all the computer has to find. We have traded an unknown function for a finite list of unknown coefficients.
Now comes the choice that names the whole method. We still need to pin down those N coefficients, and we still have a weak form that wants to be tested against functions v. The Galerkin idea is to test against the very same building blocks we used to build the solution: require the weak equation to hold for v = phi_1, then for v = phi_2, and so on through v = phi_N. Each choice of test function gives one scalar equation, so N test functions give exactly N equations for the N unknowns c_i — a square system, neither under- nor over-determined. Substituting u_h into a(u_h, phi_j) = L(phi_j) and using linearity turns each equation into a row: the sum over i of c_i times a(phi_i, phi_j) equals L(phi_j). That is a linear system A c = b in disguise, with A_{ji} = a(phi_i, phi_j) and b_j = L(phi_j).
If a faint bell is ringing, trust it: this is the same projection idea behind least squares from an earlier rung. There you could not hit a target vector exactly, so you found the closest point in a subspace by demanding the residual be orthogonal to that subspace. Galerkin does precisely this for functions: u_h cannot satisfy the PDE exactly, so we demand that its residual be 'orthogonal' to the span of the shape functions, where the inner product is the integral a(.,.). The Galerkin method is best-approximation-by-orthogonal-projection lifted from vectors to function spaces — which is also the seed of the error theory you will meet later, Cea's lemma, saying the computed u_h is within a constant of the best possible approximation the mesh can offer.
What you have built, and where it goes next
Step back and see the shape of the whole pipeline, because the rest of this rung simply fills it in. You start with a PDE you cannot solve and a domain too awkward for a grid. You restate the PDE in its weak form by multiplying by a test function and integrating by parts, which both halves the smoothness needed and sorts your boundary conditions into essential and natural. You replace the infinite function space by a finite span of mesh-based shape functions, and you apply Galerkin to turn 'hold for all test functions' into N concrete equations. The result is a linear system A c = b whose matrix A — built from integrals of products of shape-function derivatives — is the famous stiffness matrix of the next guide. A continuous problem in infinitely many unknowns has become a finite matrix equation, and we already own a toolbox of solvers for those.
Two honest reminders before we go on. First, every integral in a(phi_i, phi_j) and L(phi_j) is itself approximated on the computer by numerical quadrature — typically Gaussian quadrature on each element — so even the entries of A and b carry a small approximation error, on top of everything done in floating-point where 0.1 has no exact binary form. Second, the weak form does not make hard problems easy; it makes them posable. The stiffness matrix it produces can be large and, for the wrong choice of elements or a badly shaped mesh, ill-conditioned, so that solving A c = b loses precision just as any ill-conditioned system does — which is why the choice of mesh and element in the coming guides matters so much.