A Brief Introduction To Weak Formulations of Pdes and The Finite Element Method
A Brief Introduction To Weak Formulations of Pdes and The Finite Element Method
A Brief Introduction To Weak Formulations of Pdes and The Finite Element Method
1 Introduction
The aim of this note is to give a very brief introduction to the “modern” study of partial differential
equations (PDEs), where by “modern” we mean the theory based in weak solutions, Galerkin approx-
imation, and the closely-related finite element method. We will illustrate the main ideas by reference
to an elliptic PDE of second order. The point is not to be totally rigorous about all details, but rather
to give some motivation for an important connection between linear algebra and PDEs that has deep
consequences both for the mathematical analysis of PDEs and their numerical solution on computers.
In fact, almost all of the important ideas in this note are covered by the case d = 1, so that is a good
place to start if your vector calculus is a bit rusty.
For a scalar-valued function u : D → R, ∇u : D → Rd denotes its gradient, i.e. the vector field whose
components are the first-order partial derivatives of u:
∂u ∂u
∇u(x) = (x), . . . , (x) ∈ Rd .
∂x1 ∂xd
1 Mathematics Institute and School of Engineering, University of Warwick, Coventry CV4 7AL, United Kingdom
(t.j.sullivan@warwick.ac.uk)
2 Zuse Institute Berlin, Takustraße 7, 14195 Berlin, Germany (sullivan@zib.de)
1
T. J. Sullivan
Later on, we will discuss a so-called “weak” interpretation of this gradient. Similarly, for a vector field
v = (v1 , . . . , vd ) : D → Rd , we will write ∇ · v : D → R for its divergence, the scalar field given by
∂v1 ∂vd
∇ · v(x) = (x) + · · · + (x).
∂x1 ∂xd
Let a : D → R and f : D → R be given, and consider the problem of finding u : D → R such that
−∇ · (a(x)∇u(x)) = f (x) for x ∈ D, (3.1)
u(x) = 0 for x ∈ ∂D.
A standard example of such a problem is Poisson’s equation, with a(x) ≡ 1:
−∆u(x) = f (x) for x ∈ D, (3.2)
u(x) = 0 for x ∈ ∂D,
where ∆ is the Laplace operator
∂2u ∂2u
∆u(x) = 2 (x) + · · · + (x). (3.3)
∂x1 ∂x2d
On the face of it, expressions like (3.1), (3.2), and (3.3) only make sense if u is twice differentiable and
a is differentiable. This is the so-called strong form of the PDE. It is an unfortunate fact of mathematical
life that the strong formulation is simply too strong in practice, in the sense that many physical problems
of interest have no strong solutions.
Using integration by parts, however, we can relax the definition of a solution considerably. We will
call ϕ : D → R a compactly supported test function if ϕ is infinitely differentiable (i.e. it has all mixed
partial derivatives of all orders) and there is a closed and bounded set S ⊂ D such that ϕ and all its
partial derivatives are zero on D \ S. Let
∞ ϕ is infinitely differentiable and, for some closed, bounded S ⊂ D,
Cc (D) = ϕ : D → R . (3.4)
ϕ and all its partial derivatives are zero outside S
denote the space of all such test functions.
Exercise 3.1. Show that Cc∞ (D) as defined above is a vector space, i.e. if α1 , α2 ∈ R and ϕ1 , ϕ2 ∈ Cc∞ (D),
then α1 ϕ1 + α2 ϕ2 ∈ Cc∞ (D).
We will now derive the so-called weak form of the PDE (3.1). The motivation for this weak form is the
following observation: any two finite-dimensional vectors u, v ∈ Rd are equal if and only if their inner
products with an arbitrary ϕ ∈ Rd are equal, i.e.
u = v ∈ Rd ⇐⇒ ∀ϕ ∈ Rd , u · ϕ = v · ϕ ∈ R. (3.5)
We call this “testing” the equation u = v against the test direction ϕ ∈ Rd . In essence, the weak form
of (3.1) consists of “testing” the equation (3.1) against an arbitrary test function ϕ. It turns out that
we can do something similar for infinite-dimensional spaces of functions, the kinds of spaces in which a
solution u to (3.1) might live; the only catch is that then the “ ⇐⇒ ” in (3.5) is only an “ =⇒ ”, and so
the weak form is genuinely weaker than the “strong form” (3.1).
Exercise 3.2 (Deriving the weak form of (3.1)). Multiply (3.1) by an arbitrary test function ϕ ∈ Cc∞ (D)
and integrate the resulting equation over all of D to get
Z Z
− ∇ · (a(x)∇u(x))ϕ(x) dx = f (x)ϕ(x) dx
D D
u(x)ϕ(x) = 0 for x ∈ ∂D.
Then use integration by parts and the fact that both u and ϕ vanish on ∂D to obtain that, if u is a
solution to (3.1), then
Z Z
a(x)∇u(x) · ∇ϕ(x) dx = f (x)ϕ(x) dx (3.6)
D D
2
Weak formulations of PDEs and the finite element method
If u is such that (3.6) holds for all test functions ϕ, then we call u a weak solution to the PDE (3.1). Note
that, perhaps surprisingly, (3.6) makes no use of the second derivative of u, only first-order derivatives,
and this is one reason that seeking a weak solution u that satisfies (3.6) is genuinely a weaker/easier
problem than seeking a strong solution u to (3.1).
In fact, when people speak of “weak solutions”, they usually mean that (3.6) holds for all ϕ in some
Sobolev space, as defined later, but this definition will do for now. Three important facts here are that
(a) many PDEs have weak solutions even when they do not have strong solutions;
(b) weak solutions are much easier to describe in terms of linear algebra and its infinite-dimensional
analogues than strong solutions are;
(c) even when a strong solution exists, it is often easier to first show that a weak solution exists and
then show that it is in fact strong, than to find a strong solution directly.
To see why linear algebra is very relevant here, observe that (3.6) can be reformulated as the system
of equations
B(u, ϕ) = hf, ϕiL2 (3.7)
where B is the bilinear function (meaning that it is a linear function of each of its two arguments)
Z
B(u, v) = a(x)∇u(x) · ∇v(x) dx
D
and
Z
hu, viL2 = u(x)v(x) dx
D
is the L2 inner product. Thus, solving the PDE in weak form looks very much like solving something
like an infinite-dimensional matrix-vector equation “B(u, · ) = f ”.
Exercise 3.3 (A more general setting). Let L be a second-order differential operator of the following
so-called “divergence form”:
d X d
X ∂ ∂u ∂u
Lu(x) = − aij (x) (x) + bi (x) (x)
i,j=1
∂x i ∂xj i=1
∂xi
for d2 functions aij : D → R and d functions bi : D → R. Follow the model described above to derive an
equation similar to (3.7) for a weak solution u of the equation Lu = f .
4 Sobolev spaces
The purpose of this section is to give various equivalent, though slightly informal, definitions of the
Sobolev spaces H 1 (D) and H01 (D).
Our first definition is one sentence long: the Sobolev space H01 (D) consists of all functions u : D → R
that are square-integrable (i.e. D |u(x)|2 dx is finite) and have a square-integrable gradient, and that
R
and norm
Z Z
kuk2H 1 = |u(x)|2 dx + |∇u(x)|2 dx (4.3)
D D
Z d
XZ 2
∂u
= |u(x)|2 dx + (x) dx. (4.4)
D i=1 D ∂xi
3
T. J. Sullivan
This first definition leaves some important technical points unanswered. For example, does the gradient
really have to exist everywhere in D?
A second, slightly better definition is given by first weakening the notion of a derivative, again using
the trick of integrating by parts. We will say that v : D → R is a weak derivative for u : D → R in the
ith coordinate direction, 1 ≤ i ≤ d, if
Z Z
∂ϕ
u(x)ϕ(x) dx = − v(x) (x) dx
D D ∂xi
1
H0 (D).
Calculate all the inner products hψn , ψm iL2 and hψn0 , ψm
0
iL2 for m, n ∈ {0, . . . , N }.
The piecewise linear finite elements are a good motivating example, but we will now take a more
abstract view and simply let ψ1 , . . . , ψN be some linearly independent functions in H01 (D); they span an
N -dimensional subspace VN of H01 (D).
In principle, we are charged with finding u ∈ H01 (D) such that
Z Z
a(x)∇u(x) · ∇v(x) dx = f (x)v(x) dx
D D
PN
for all v ∈ H01 (D). Now we shall seek an approximate solution in VN of the form u = n=1 un ψn . Instead
PN
of testing u against arbitrary v ∈ H01 (D) we shall only test against v ∈ VN of the form v = n0 =1 vn0 ψn0 .
This is called Galerkin’s method for solving the PDE.
4
Weak formulations of PDEs and the finite element method
PN
By the linearity of integration, we seek u = n=1 un ψn ∈ VN such that
N
X Z N Z
X
a(x)∇un ψn (x) · vn0 ∇ψn0 (x) dx = f (x)vn0 ψn0 (x) dx
n,n0 =1 D n0 =1 D
PN
for all v = n0 =1 vn0 ψn0 ∈ VN . Equivalently,
N
X Z N
X Z
un vn0 a(x)∇ψn (x) · ∇ψn0 (x) dx = vn0 f (x)ψn0 (x) dx.
n,n0 =1 D n0 =1 D
u = (un )N N
n=1 ∈ R ,
Z N
b= f (x)ψm (x) dx ∈ RN ,
D m=1
Z N
A= a(x)∇ψn (x) · ∇ψm (x) dx ∈ RN ×N ,
D n,m=1
Au = b (5.1)
The matrix A is called the stiffness matrix of the basis {ψ1 , . . . , ψN } and the coefficient field a.
PN
If furthermore f = (fm )N N
R
m=1 , where f = m=1 fm ψm , and M = ( D ψn ψm dx)n,m=1 , then (5.1) can
be equivalently expressed as
Au = M f .
The matrix M is called the mass matrix of the basis {ψ1 , . . . , ψN } and is independent of the coefficient
field a. Note that the matrices A and M can be assembled ahead of time, before knowledge of the right-
hand side f , and hence can be re-used for many different f s to generate the corresponding approximate
solution coefficient vectors u.
Exercise 5.2. Show that the matrices A and M are always symmetric matrices. Show that M is always
positive-definite, and that A is positive-definite if there exists some a0 > 0 such that a(x) ≥ a0 for all
x ∈ D. Hence show that, if a is bounded below in this way, the matrix-vector equation Au = b in (5.1)
has a unique solution u ∈ RN .
Theorem 5.3 (Lax–Milgram lemma). Let V be a Hilbert space (i.e. a complete inner product space).
Suppose that B : V × V → R is a bilinear function that is
(a) bounded, in the sense that there is a constant C > 0 such that
5
T. J. Sullivan
(b) and coercive, in the sense that there is a constant c > 0 such that
In order to determine the constants c and C for application of the Lax–Milgram lemma to our elliptic
PDEs, with V = H01 (D), one generally needs to do some careful mathematical analysis, beyond the scope
of these notes. However, an accessible special case is the following:
Exercise 5.4. Determine the constants c and C for the bilinear form B associated to Poisson’s equation
on the d-dimensional unit cube D. Hence show that, for every f ∈ L2 (D), Poisson’s equation −∆u = f
has a unique weak solution u ∈ H01 (D).
The answer to the second question, convergence, is answered by a result called Céa’s lemma, which
states that the exact solution u ∈ V and the approximate solution uN ∈ VN satisfy
C
ku − uN k ≤ inf ku − vk
c v∈VN
Thus, in some sense, the Galerkin / finite-element solution is a “quasi-optimal” approximation of u within
the finite-dimensional subspace VN .
In fact, when the bilinear form B in the Lax–Milgram problem is symmetric (i.e. B(u, v) = B(v, u),
which is the case for our motivating example (3.1)), one can show a little bit more: the subspace
solution puN is the best approximation to the full-space solution u with respect to the energy norm
kukB := B(u, u) and is the orthogonal projection of u onto the subspace VN with respect to the energy
inner product hu, viB := B(u, v).
Exercise 5.5. Write a computer program (e.g. in C/C++, Python, or Matlab) to approximately solve
Poisson’s equation −∆u = f in dimension d = 1 in the piecewise linear finite element basis of Exercise 5.1.
That is, build the stiffness and mass matrices and solve the Galerkin system (5.1).
References
R. A. Adams and J. J. F. Fournier. Sobolev Spaces, volume 140 of Pure and Applied Mathematics
(Amsterdam). Elsevier/Academic Press, Amsterdam, second edition, 2003. ISBN 0-12-044143-8.
L. C. Evans. Partial Differential Equations, volume 19 of Graduate Studies in Mathematics.
American Mathematical Society, Providence, RI, second edition, 2010. ISBN 978-0-8218-4974-3.
doi:10.1090/gsm/019.
M. Renardy and R. C. Rogers. An Introduction to Partial Differential Equations, volume 13 of Texts in
Applied Mathematics. Springer-Verlag, New York, second edition, 2004. ISBN 0-387-00444-0.