Big Ideas in Applied Math: Galerkin Approximation

My first experience with the numerical solution of partial differential equations (PDEs) was with finite difference methods. I found finite difference methods to be somewhat fiddly: it is quite an exercise in patience to, for example, work out the appropriate fifth-order finite difference approximation to a second order differential operator on an irregularly spaced grid and even more of a pain to prove that the scheme is convergent. I found that I liked the finite element method a lot better1Finite element methods certainly have their own fiddly-nesses (as anyone who has worked with a serious finite element code can no doubt attest to). as there was a unifying underlying functional analytic theory, Galerkin approximation, which showed how, in a sense, the finite element method computed the best possible approximate solution to the PDE among a family of potential solutions. However, I came to feel later that Galerkin approximation was, in a sense, the more fundamental concept, with the finite element method being one particular instantiation (with spectral methods, boundary element methods, and the conjugate gradient method being others). In this post, I hope to give a general introduction to Galerkin approximation as computing the best possible approximate solution to a problem within a certain finite-dimensional space of possibilities.

Systems of Linear Equations

Let us begin with a linear algebraic example, which is unburdened by some of the technicalities of partial differential equations. Suppose we want to solve a very large system of linear equations Ax = b, where the matrix A is symmetric and positive definite (SPD). Suppose that A is N\times N where N is so large that we don’t even want to store all N components of the solution x on our computer. What can we possibly do?

One solution is to consider only solutions x lying in a subspace \mathcal{X} of the set of all possible solutions \mathbb{R}^N. If this subspace has a basis x_1,x_2,\ldots,x_M \in \mathcal{X}, then the solution x \in \mathcal{X} can be represented as x = a_1x_1 + \cdots + a_Mx_M and one only has to store the M < N numbers a_1,\ldots,a_M. In general, x will not belong to the subspace \mathcal{X} and we must settle for an approximate solution \hat{x} \in \mathcal{X}.

The next step is to convert the system of linear equations Ax = b into a form which is more amenable to approximate solution on a subspace \mathcal{X}. Note that the equation Ax = b encodes n different linear equations a_i^\top x = b_i where a_i^\top is the ith row of A and b_i is the ith element of b. Note that the ith equation is equivalent to the condition e_i^\top A x = e_i^\top b, where e_i is the vector with zeros in all entries except for the ith entry which is a one. More generally, by multiplying the equation Ax = b by an arbitrary test row vector y^\top, we get y^\top Ax = y^\top b for all y \in \mathbb{R}^N. We refer to this as a variational formulation of the linear system of equations Ax = b. In fact, one can easily show that the variational problem is equivalent to the system of linear equations:

(1)   \begin{equation*} Ax = b \:\mbox{ if, and only if, }\: y^\top Ax = y^\top b \mbox{ for every } y \in \mathbb{R}^N. \end{equation*}

Since we are seeking an approximate solution from the subspace \mathcal{X}, it is only natural that we also restrict our test vectors y to lie in the subspace \mathcal{X}. Thus, we seek an approximate solution \hat{x} to the system of equations Ax = b as the solution of the variational problem

(2)   \begin{equation*} y^\top A\hat{x} = y^\top b \mbox{ for every } y \in\mathcal{X}. \end{equation*}

One can relatively easily show this problem possesses a unique solution \hat{x}.2Here is a linear algebraic proof. As we shall see below, the same conclusion will also follow from the general Lax-Milgram theorem. Let P be a matrix whose columns form a basis for \mathcal{X}. Then every y\in \mathcal{X} can be written as y = Pu for some u \in \mathbb{R}^M. Thus, writing \hat{x} = Pw, we have that y^\top A\hat{x} = u^\top P^\top A P w = u^\top P^\top b for every u\in \mathbb{R}^M. But this is just a variational formulation of the equation (P^\top A P)w = P^\top b. The matrix P^\top A P is SPD since v^\top(P^\top A P)v = (Pv)^\top A (Pv) > 0 for v\ne 0 since A is SPD. Thus (P^\top A P)w = P^\top b has a unique solution w = (P^\top A P)^{-1}P^\top b. Thus \hat{x} = Pw = P(P^\top AP)^{-1}P^\top b is the unique solution to the variational problem Eq. (2). In what sense is \hat{x} a good approximate solution for Ax = b? To answer this question, we need to introduce a special way of measuring the error to an approximate solution to Ax = b. We define the A-inner product of a vector x and y to be \langle x, y \rangle_A := y^\top Ax and the associated A-norm \|x\|_A = \sqrt{\langle x, x\rangle_A} = \sqrt{x^\top A x}.3Note that A-norm can be seen as a weighted Euclidean norm, where the components of the vector x in the direction of the eigenvectors of A are scaled by their corresponding eigenvector. Concretely, if x = a_1 q_1 + \cdots + a_N q_N where q_j is an eigenvector of A with eigenvalue \lambda_j (Aq_j = \lambda_j q_j), then we have \|x\|_A^2 = \lambda_1 a_1^2 + \cdots + \lambda_N a_N^2. All of the properties satisfied by the familiar Euclidean inner product and norm carry over to the new A-inner product and norm (e.g., the Pythagorean theorem). Indeed, for those familiar, one can show \langle \cdot, \cdot \rangle_A satisfies all the axioms for an inner product space.

We shall now show that the error x - \hat{x} between x and its Galerkin approximation \hat{x} is A-orthogonal to the space \mathcal{X} in the sense that \langle y, x - \hat{x}\rangle_A = 0 for all y \in \mathcal{X}. This follows from the straightforward calculation, for y \in \mathcal{X},

(3)   \begin{equation*} \langle y, x - \hat{x} \rangle_A = y^\top A (x - \hat{x}) = y^\top A x - y^\top A \hat{x} = y^\top b - y^\top b = 0, \end{equation*}

where y^\top A x = y^\top b since x solves the variational problem Eq. (1) and y^\top A \hat{x} since x solves the variational problem Eq. (2).

The fact that the error x - \hat{x} is A-orthogonal to \mathcal{X} can be used to show that \hat{x} is, in a sense, the best approximate solution to Ax = b in the subspace \mathcal{X}. First note that, for any approximate solution z \in \mathcal{X} to Ax = b, the vector \hat{x} - z \in \mathcal{X} is A-orthogonal to x - \hat{x}. Thus, by the Pythagorean theorem,

(4)   \begin{equation*} \|x - z\|^2_A = \|(x - \hat{x}) + (\hat{x}-z)\|_A^2 = \|x-\hat{x}\|_A^2 + \|\hat{x} - z\|_A^2 \ge \|x - \hat{x} \|_A^2. \end{equation*}

Thus, the Galerkin approximation \hat{x} is the best approximate solution to Ax = b in the subspace \mathcal{X} with respect to the A-norm, \|x - z\|_A \ge \|x - \hat{x} \|_A for every z \in \mathcal{X}. Thus, if one picks a subspace \mathcal{X} for which the solution x almost lies in \mathcal{X},4In the sense that \inf_{z \in \mathcal{X}} \|x - z\| is small then \hat{x} will be a good approximate solution to Ax = b, irrespective of the size of the subspace \mathcal{X}.

Variational Formulations of Differential Equations

As I hope I’ve conveyed in the previous section, Galerkin approximation is not a technique that only works for finite element methods or even just PDEs. However, differential and integral equations are one of the most important applications of Galerkin approximation since the space of all possible solution to a differential or integral equation is infinite-dimensional: approximation in a finite-dimensional space is absolutely critical. In this section, I want to give a brief introduction to how one can develop variational formulations of differential equations amenable to Galerkin approximation. For simplicity of presentation, I shall focus on a one-dimensional problem which is described by an ordinary differential equation (ODE) boundary value problem. All of this generalized wholesale to partial differential equations in multiple dimensions, though there are some additional technical and notational difficulties (some of which I will address in footnotes). Variational formulation of differential equations is a topic with important technical subtleties which I will end up brushing past. Rigorous references are Chapters 5 and 6 from Evans’ Partial Differential Equations or Chapters 0-2 from Brenner and Scott’s The Mathematical Theory of Finite Element Methods.

As our model problem for which we seek a variational formulation, we will focus on the one-dimensional Poisson equation, which appears in the study of electrostatics, gravitation, diffusion, heat flow, and fluid mechanics. The unknown u is a real-valued function on an interval which take to be [0,1].5In higher dimensions, one can consider an arbitrary domain \Omega \subseteq \mathbb{R}^d with, for example, a Lipschitz boundary. We assume Dirichlet boundary conditions that u is equal to zero on the boundary u(0) = u(1) = 0.6In higher dimensions, one has u = 0 on the boundary \partial \Omega of the region \Omega. Poisson’s equations then reads7-\Delta u = f on \Omega and u = 0 for higher dimensions, where \Delta is the Laplacian operator.

(5)   \begin{equation*} -u''(x) = f(x) \mbox{ for every } x \in (0,1), \quad u(0) = u(1) = 0. \end{equation*}

We wish to develop a variational formulation of this differential equation, similar to how we develop a variational formulation of the linear system of equations in the previous section. To develop our variational formulation, we take inspiration from physics. If u(x) represents, say, the temperature at a point x, we are never able to measure u(x) exactly. Rather, we can measure the temperature in a region around x with a thermometer. No matter how carefully we engineer our thermometer, our thermometer tip will have some volume occupying a region R in space. The temperature u_{\rm meas} measured by our thermometer will be the average temperature in the region R or, more generally, a weighted average u_{\rm meas} = \int_0^1 u(x) v(x) \, dx where v(\cdot) is a weighting function which is zero outside the region R. Now let’s use our thermometer to “measure” our differential equation:

(6)   \begin{equation*} \int_0^1-v(x) u''(x) \, dx = \int_0^1 v(x)f(x) \, dx. \end{equation*}

This integral expression is some kind of variational formulation of our differential equation, as it is an equation involving the solution to our differential equation u which must hold for every averaging function v. (The precise meaning of every will be forthcoming.) It will benefit us greatly to make this expression more “symmetric” with respect to u and v. To do this, we shall integrate by parts:8Integrating by parts is harder in higher dimensions. My personal advice for integrating by parts in higher dimensions is to remember that integration by parts is ultimately a result of the product rule. As such, to integrate by parts, we first write an expression involving our integrand using the product rule of some differential operator and then integrate by both sides. In this case, notice that \nabla \cdot (v \nabla u) = v\Delta u + \nabla v \cdot \nabla u. Rearranging and integrating, we see that \int_\Omega -v\Delta u \, dx = \int_\Omega \nabla v \cdot \nabla u \, dx - \int_\Omega \nabla \cdot (v\nabla u) \, dx. We then apply the divergence theorem to the last term to get \int_\Omega \nabla \cdot (v\nabla u) \, dx = \int_{\partial \Omega} v \nabla u \cdot n dS(x), where n represents an outward facing unit normal to the boundary \partial \Omega and dS(x) represents integration on the surface \partial \Omega. If v is zero on \partial \Omega, we conclude \int_\Omega \nabla v \cdot \nabla u \, dx  = \int_\Omega v f \, dx for all nice functions v on \Omega satisfying v = 0 on \partial \Omega.

(7)   \begin{equation*} \int_0^1-v(x)u''(x) \, dx = \int_0^1 v'(x)u'(x) \, dx - v(0) u'(0) - v(1)u'(1). \end{equation*}

In particular, if v is zero on the boundary v(0) = v(1) = 0, then the second two terms vanish and we’re left with the variational equation

(8)   \begin{equation*} \int_0^1 v'(x)u'(x) \, dx = \int_0^1 v(x) f(x) \, dx \mbox{ for all \textit{nice} functions $v$ on $[0,1]$ with } v(0) = v(1) = 0. \end{equation*}

Compare the variational formulation of the Poisson equation Eq. (8) to the variational formulation of the system of linear equations Ax = b in Eq. (1). The solution vector x in the differential equation context is a function u satisfying the boundary condition of u being zero on the boundary u(0) = u(1) = 0. The right-hand side b is replaced by a function f on the interval [0,1]. The test vector y is replaced by a test function v on the interval [0,1]. The matrix product expression y^\top A x is replaced by the integral \int_0^1 v'(x)u'(x) \, dx. The product y^\top b is replaced by the integral \int_0^1 v(x) f(x) \, dx. As we shall soon see, there is a unifying theory which treats both of these contexts simultaneously.

Before this unifying theory, we must address the question of which functions v we will consider in our variational formulation. One can show that all of the calculations we did in this section hold if v is a continuously differentiable function on [0,1] which is zero away from the endpoints 0 and 1 and u is a twice continuously differentiable function on [0,1]. Because of technical functional analytic considerations, we shall actually want to expand the class of functions in our variational formulation to even more functions v. Specifically, we shall consider all functions v which are (A) square-integrable (\int_0^1|v(x)|^2 \,dx is finite), (B) possess a square integrable derivative9More specifically, we only insist that v possess a square-integrable weak derivative. v' (\int_0^1|v'(x)|^2 \,dx is finite), and (C) are zero on the boundary. We refer to this class of functions as the Sobolev space H_0^1((0,1)).10The class of functions satisfying (A) and (B) but not necessarily (C) is the Sobolev space H^1((0,1)). For an arbitrary function in H^1((0,1)), the existence of a well-defined restriction to the boundary 0 and 1 is actually nontrivial to show, requiring showing the existence of a trace operator. Chapter 5 of Evan’s Partial Differential Equations is a good introduction to Sobolev spaces. The Sobolev spaces H_0^1((0,1)) and H^1((0,1)) naturally extend to spaces H_0^1(\Omega) and H^1(\Omega) for an arbitrary domain \Omega \subseteq \mathbb{R}^d with a nice boundary.

Now this is where things get really strange. Note that it is possible for a function u to satisfy the variational formulation Eq. (8) but for u not to satisfy the Poisson equation Eq. (5). A simple example is when f possesses a discontinuity (say, for example, a step discontinuity where f is 0 and then jumps to 1). Then no continuously differentiable u will satisfy Eq. (5) at every point in \Omega and yet a solution u to the variational problem Eq. (8) exists! The variational formulation actually allows us to give a reasonable definition of “solving the differential equation” when a classical solution to -u'' = f does not exist. Our only requirement for the variational problem is that u, itself, belongs to the space H_0^1((0,1)). A solution to the variational problem Eq. (8) is called a weak solution to the differential equation Eq. (5) because, as we have argued, a weak solution to Eq. (8) need not always solve Eq. (5).11One can show that any classical solution to Eq. (5) solves Eq. (8). Given certain conditions on f, one can go the other way, showing that weak solutions are indeed bonafide classical solutions. This is the subject of regularity theory.

The Lax-Milgram Theorem

Let us now build up an abstract language which allows us to use Galerkin approximation both for linear systems of equations and PDEs (as well as other contexts). If one compares the expressions y^\top A x from the linear systems context and \int_0^1 v'(x)u'(x) \, dx from the differential equation context, one recognizes that both these expressions are so-called bilinear forms: they depend on two arguments (x and y or u and v) and are a linear transformation in each argument independently if the other one is fixed. For example, if one defines a(x,y) = y^\top A x one has a(x,\alpha_1 y_1 + \alpha_2 y_2) = \alpha_1 a(x,y_1) + \alpha_2 a(x,y_2). Similarly, if one defines a(u,v) = \int_0^1 v'(x)u'(x) \, dx, then a(\alpha_1 u_1 + \alpha_2 u_2,v) = \alpha_1 a(u_1,v) + \alpha_2 a(u_2, v).

Implicitly swimming in the background is some space of vectors or function which this bilinear form a(\cdot,\cdot) is defined upon. In the linear system of equations context, this space \mathbb{R}^N of N-dimensional vectors and in the differential context, this space is H_0^1((0,1)) as defined in the previous section.12The connection between vectors and functions is even more natural if one considers a function u : [0,1] \to \mathbb{R} as a vector of infinite length, with one entry for each real number x \in [0,1]. Call this space \mathcal{V}. We shall assume that \mathcal{V} is a special type of linear space called a Hilbert space, an inner product space (with inner product \langle \cdot, \cdot \rangle_\mathcal{V}) where every Cauchy sequence converges to an element in \mathcal{V} (in the inner product-induced norm).13Note that every inner product space has a unique completion to a Hilbert space. For example, if one considers the space C_{0}^\infty((0,1)) of C^\infty smooth functions which are zero away from the boundary of (0,1) with the inner product \langle u, v \rangle_{H^1_0((0,1))} = \int_0^1 u(x)v(x) + u'(x)v'(x) \, dx, the completion is H_0^1((0,1)). A natural extension to higher dimensions hold. The Cauchy sequence convergence property, also known as metric completeness, is important because we shall often deal with a sequence of entries u_1,u_2,\ldots \in \mathcal{V} which we will need to establish convergence to a vector u \in \mathcal{V}. (Think of u_1,u_2,\ldots as a sequence of Galerkin approximations to a solution u.)

With these formalities, an abstract variational problem takes the form

(9)   \begin{equation*} \mbox{Find $u \in \mathcal{V}$ such that }a(u,v) = \ell(v) \mbox{ for all } v \in \mathcal{V}, \end{equation*}

where a(\cdot,\cdot) is a bilinear form on \mathcal{V} and \ell(\cdot) is a linear form on \mathcal{V} (a linear map \ell: \mathcal{V} \to \mathbb{R}). There is a beautiful and general theorem called the Lax-Milgram theorem which establishes existence and uniqueness of solutions to a problem like Eq. (9).

Theorem (Lax-Milgram): Let a(\cdot,\cdot) and f satisfy the following properties:

  1. (Boundedness of a) There exists a constant C \ge 0 such that every u,v \in \mathcal{V}, |a(u,v)| \le C \|u\|_{\mathcal{V}}\|v\|_{\mathcal{V}}.
  2. (Coercivity) There exists a positive constant c > 0 such that a(u,u) \ge c \|u\|_{\mathcal{V}}^2 for every u \in \mathcal{V}.
  3. (Boundedness of \ell) There exists a constant K such that |\ell(v)| \le K \|v\|_{\mathcal{V}} for every v\in \mathcal{V}.

Then the variational problem Eq. (9) possesses a unique solution.

For our cases, a will also be symmetric a(u,v) = a(v,u) for all u,v \in \mathcal{V}. While the Lax-Milgram theorem holds without symmetry, let us continue our discussion with this additional symmetry assumption. Note that, taken together, properties (1-2) say that the a-inner product, defined as \langle u, v \rangle_a = a(u,v), is no more than so much bigger or smaller than the standard inner product \langle u, v\rangle_{\mathcal{V}} of u and v.14That is, one has that the a-norm and the \mathcal{V}-norm are equivalent in the sense that \sqrt{c}\|v\|_{\mathcal{V}} \le \|v\|_a \le \sqrt{C} \|v\|_{\mathcal{V}}. so the norms \|\cdot\|_\mathcal{V} and \|\cdot\|_a define the same topology.

Let us now see how the Lax-Milgram theorem can apply to our two examples. For a reader who wants a more “big picture” perspective, they can comfortably skip to the next section. For those who want to see Lax-Milgram in action, see the discussion below.

Applying the Lax-Milgram Theorem
Begin with the linear system of equations with \mathcal{V} = \mathbb{R}^N with inner product \langle x, y \rangle_{\mathbb{R}^N} = y^\top x, a(x,y) = y^\top Ax, and \ell(y) = y^\top b. Note that we have the inequality \lambda_{\rm min} x^\top x \le x^\top A x \le \lambda_{\rm max} x^\top x.15This is an easy consequence of the Courant-Fischer theorem. More generally, note that, since A is symmetric, A has an orthonormal basis of eigenvectors q_1,\ldots,q_N with eigenvalues \lambda_{\rm max} = \lambda_1 \ge \lambda_2 \ge \cdots \ge \lambda_N = \lambda_{\rm min}. Then x = x_1q_1 + \cdots + x_Nq_N and x^\top Ax = \lambda_{\rm max} x_1^2 + \cdots + \lambda_{\rm min} x_N^2. The inequalities follow from noting the Parseval relation \|x\|^2 = x^\top x = x_1^2 + \cdots + x_N^2 and noting that x^\top Ax / x^\top x is a convex combination of the eigenvalues of A. In particular, we have that \|x\|_A = \sqrt{x^\top A x} \le \sqrt{\lambda_{\rm max}} \|x\|. Property (1) then follows from the Cauchy-Schwarz inequality applied to the A-inner product: |a(x,y)| = |\langle x, y\rangle_A| \le \|x\|_A \|y\|_A \le \lambda_{\rm max} \|x\|\|y\|. Property (2) is simply the established inequality a(x,x) = x^\top Ax \ge \lambda_{\min} = x^\top x. Property (3) also follows from the Cauchy-Schwarz inequality: |\ell(y)| = |y^\top b| \le \|b\|\|y\|. Thus, by Lax-Milgram, the variational problem y^\top Ax = y^\top b for y \in \mathbb{R}^N has a unique solution x. Note that the linear systems example shows why the coercivity property (2) is necessary. If A is positive semi-definite but not positive-definite, then there exists an eigenvector v of A with eigenvalue 0. Then v^\top Av = 0 \not\ge c v^\top v for any positive constant c and A is singular, so the variational formulation of Ax = b has no solution for some choices of the vector b.

Applying the Lax-Milgram theorem to differential equations can require powerful inequalities. In this case, the \mathcal{V} = H_0^1((0,1))-inner product is given by \langle u, v \rangle_{H_0^1((0,1))} = \int_0^1 v(x)u(x) + v'(x)u'(x) \, dx, a(u,v) = \int_0^1 v'(x)u'(x) \, dx, and \ell(v) = \int_0^1 v(x)f(x) \, dx. Condition (1) is follows from a application of the Cauchy-Schwarz inequality for integrals:16 In higher dimensions, we need even more Cauchy-Schwarz! First, we note that the absolute value of integral is less than the integral of absolute value |a(u,v)| \le \int_\Omega |\nabla v \cdot \nabla u| \, dx. Second, we apply the Cauchy-Schwarz inequality for the vectors \nabla u and \nabla v to get |\nabla v \cdot \nabla u| \le |\nabla v| |\nabla u| where, e.g., \|\nabla v\| is the Euclidean norm of the vector \nabla v. This gives |a(u,v)| \le \int_\Omega \|\nabla v\| \|\nabla u\| \, dx. Next, we apply the Cauchy-Schwarz inequality for integrals to get |a(u,v)| \le \le \left(\int_\Omega \|\nabla v\|^2 \, dx\right)^{1/2} \left(\int_\Omega \|\nabla u\|^2 \, dx\right)^{1/2}. Finally, we note that \int_\Omega \|\nabla v\|^2 \, dx \le \int_\Omega v^2 + |\nabla v|^2 \, dx = \langle v, v\rangle_{H_0^1(\Omega)} = \|v\|_{H_0^1(\Omega)}^2 and thus obtain |a(u,v)| \le \|v\|_{H_0^1(\Omega)}\|u\|_{H_0^1(\Omega)}. This is the desired inequality with constant one.

(10)   \begin{equation*} \begin{split} |a(u,v)| &\le \int_0^1 |v'(x)||u'(x)| \, dx \\ &\le \left(\int_0^1 |v'(x)|^2 \, dx\right)^{1/2} \left(\int_0^1 |u'(x)|^2 \, dx\right)^{1/2} \\ &\le \|v\|_{H_0^1((0,1))}\|u\|_{H_0^1((0,1))}. \end{split} \end{equation*}

Let’s go line-by-line. First, we note that the absolute value of integral is less than the integral of absolute value. Next, we apply the Cauchy-Schwarz inequality for integrals. Finally, we note that \int_0^1|v'(x)|^2 \, dx \le \int_0^1|v(x)|^2 + |v'(x)|^2 \, dx = \langle v, v\rangle_{H_0^1((0,1))} = \|v\|_{H_0^1((0,1))}^2. This establishes Property (1) with constant C = 1. As we already see one third of the way into verifying the hypotheses of Lax-Milgram, establishing these inequalities can require several steps. Ultimately, however, strong knowledge of just a core few inequalities (e.g. Cauchy-Schwarz) may be all that’s needed.

Proving coercivity (Property (2)) actually requires a very special inequality, Poincaré’s inequality.17In higher dimensions, Poincaré’s inequality takes the form \int_\Omega \|\nabla u\|^2 \, dx \ge k\int_\Omega u^2 \, dx for a constant k depending only on the domain \Omega. In it’s simplest incarnation, the inequality states that there exists a constant k such that, for all functions u \in H_0^1((0,1)),18A simple proof of Poincaré’s inequality for continuously differentiable u with u(0) = u(1) = 0 goes as follows. Note that, by the fundamental theorem of calculus, u(x) = u(0) + \int_0^x u'(y) \, dy = \int_0^x u'(y) \, dy. Applying the Cauchy-Schwarz inequality for integrals gives |u(x)|\le \left(\int_0^x 1^2 \, dy\right)^{1/2}\left(\int_0^x |u'(y)|^2 \, dy\right)^{1/2} \le \sqrt{x} \left(\int_0^x |u'(y)|^2 \, dy\right)^{1/2} \le \left(\int_0^1 |u'(y)|^2 \, dy\right)^{1/2} since 0\lex\le 1. Thus |u(x)|^2 \le \int_0^1 |u'(y)|^2 \, dy for all x \in [0,1] integrating over x gives \int_0^1\int_0^1|u'(y)|^2 \, dy\, dx = \int_0^1|u'(x)|^2 \, dx \ge \int_0^1|u(x)|^2 \, dx. This proves Poincaré’s inequality with the constant k = 1.

(11)   \begin{equation*} \int_0^1|u'(x)|^2 \, dx \ge k\int_0^1|u(x)|^2 \, dx. \end{equation*}

With this inequality in tow, property (2) follows after another lengthy string of inequalities:19The same estimate holds in higher dimensions, with the appropriate generalization of Poincaré’s inequality.

(12)   \begin{equation*} \begin{split} a(u,u) &= \int_0^1 |u'(x)|^2 \, dx \\ &= \frac{1}{2} \int_0^1 |u'(x)|^2 \, dx + \frac{1}{2} \int_0^1 |u'(x)|^2 \, dx \\ &\ge \frac{1}{2} \int_0^1 |u'(x)|^2 \, dx + \frac{k}{2} \int_0^1 |u(x)|^2 \, dx \\ &\ge \min \left(\frac{1}{2},\frac{k}{2}\right) \left( \int_0^1 |u'(x)|^2 \, dx + \int_0^1|u(x)|^2 \, dx\right) \\ &= \min \left(\frac{1}{2},\frac{k}{2}\right) \|u\|_{H_0^1((0,1))}^2. \end{split} \end{equation*}

For Property (3) to hold, the function f must be square-integrable. With this hypothesis, Property (3) is much easier than Properties (1-2) and we leave it as an exercise for the interested reader (or to a footnote20The proof is similar in one dimension or higher dimensions, so we state it for arbitrary domain \Omega for brevity. By Cauchy-Schwarz, we have that \ell(v) = \int_\Omega vf \, dx \le \left( \int_{\Omega} f^2 \, dx \right){1/2}\left( \int_{\Omega} v^2 \, dx \right){1/2} \le \left( \int_{\Omega} f^2 \, dx \right) \|v\|_{H_0^1(\Omega)}. for the uninterested reader).

This may seem like a lot of work, but the result we have achieved is stunning. We have proven (modulo a lot of omitted details) that the Poisson equation -u'' = f has a unique weak solution as long as f is square-integrable!21And in the footnotes, we have upgraded this proof to existence of a unique weak solution to the Poisson equation -\Delta u = f on a domain \Omega. What is remarkable about this proof is that it uses the Lax-Milgram theorem and some inequalities alone: no specialized knowledge about the physics underlying the Poisson equation were necessary. Going through the details of Lax-Milgram has been a somewhat lengthy affair for an introductory post, but hopefully this discussion has illuminated the power of functional analytic tools (like Lax-Milgram) in studying differential equations. Now, with a healthy dose of theory in hand, let us return to Galerkin approximation.

General Galerkin Approximation

With our general theory set up, Galerkin approximation for general variational problem is the same as it was for a system of linear equations. First, we pick an approximation space \mathcal{X} which is a subspace of \mathcal{V}. We then have the Galerkin variational problem

(13)   \begin{equation*} \mbox{Find $\hat{u} \in \mathcal{X}$ such that } a(\hat{u},v) = \ell(v) \mbox{ for every } v \in \mathcal{X}. \end{equation*}

Provided a and \ell satisfy the conditions of the Lax-Milgram theorem, there is a unique solution \hat{u} to the problem Eq. (13). Moreover, the special property of Galerkin approximation holds: the error u-\hat{u} is a-orthogonal to the subspace \mathcal{X}. Consequently, \hat{u} is te best approximate solution to the variational problem Eq. (9) in the a-norm. To see the a-orthogonality, we have that, for any v \in \mathcal{X},

(14)   \begin{equation*} \langle u-\hat{u}, v\rangle_a = a(u-\hat{u},v) = a(u,v) - a(\hat{u},v) = \ell(v) - \ell(v) = 0, \end{equation*}

where we use the variational equation Eq. (9) for a(u,v) = \ell(v) and Eq. (13) for a(\hat{u},v) = \ell(v). Note the similarities with Eq. (3). Thus, using the Pythagorean theorem for the a-norm, for any other approximation solution w \in \mathcal{X}, we have22Compare Eq. (4).

(15)   \begin{equation*} \|u - w\|^2_a = \|(u - \hat{u}) + (\hat{u}-w)\|_a^2 = \|u-\hat{u}\|_a^2 + \|\hat{u} - w\|_a^2 \ge \|u - \hat{u} \|_a^2. \end{equation*}

Put simply, \hat{u} is the best approximation to u in the a-norm.23Using the fact the norms \|\cdot\|_{\mathcal{V}} and \|\cdot\|_a are equivalent in virtue of Properties (1-2), one can also show that \hat{u} is within a constant factor C/c of the best approximation in the norm \|\cdot\|_{\mathcal{V}. This is known as Céa’s Lemma.

Galerkin approximation is powerful because it allows us to approximate an infinite-dimensional problem by a finite-dimensional one. If we let \phi_1,\ldots,\phi_M be a basis for the space \mathcal{X}, then the approximate solution \hat{u} can be represented as \hat{u} = x_1 \phi_1 + \cdots + x_M \phi_M. Since \phi_1,\ldots,\phi_N form a basis of \mathcal{X}, to check that the Galerkin variational problem Eq. (13) holds for all v \in \mathcal{X} it is sufficient to check that it holds for v = \phi_1, v=\phi_2,\ldots,v=\phi_M.24For an arbitrary v\in \mathcal{X} can be written as v = y_1 \phi_1 + \cdots y_M\phi_M, so a(\hat{u},v) = a\left(\hat{u}, \sum_{j=1}^M y_j \phi_j \right) = \sum_{j=1}^M y_j a(\hat{u},\phi_j) = \sum_{j=1}^M y_j \ell(\phi_j) = \ell\left(\sum_{j=1}^M y_j \phi_j\right) = \ell(v). Thus, plugging in \hat{u} = \sum_{j=1}^M x_j \phi_j and v = \phi_i into Eq. (13), we get (using bilinearity of a)

(16)   \begin{equation*} a(\hat{u},v) = a\left(\sum_{j=1}^M x_j \phi_j, \phi_i\right) = \sum_{j=1}^M a(\phi_j,\phi_i) x_j = \ell(v) = \ell(\phi_i), \quad i =1,2,\ldots,M. \end{equation*}

If we define a_{ij} = a(\phi_j,\phi_i) and b_i = \ell(\phi_i), then this gives us a matrix equation Ax = b for the unknowns x_1,\ldots,x_M parametrizing \hat{u}. Thus, we can compute our Galerkin approximation by solving a linear system of equations.

We’ve covered a lot of ground so let’s summarize. Galerkin approximation is a technique which allows us to approximately solve a large- or infinite-dimensional problem by searching for an approximate solution in a smaller finite-dimensional space \mathcal{X} of our choosing. This Galerkin approximation is the best approximate solution to our original problem in the a-norm. By choosing a basis \phi_1,\ldots,\phi_M for our approximation space \mathcal{X}, we reduce the problem of computing a Galerkin approximation to a linear system of equations.

Design of a Galerkin approximation scheme for a variational problem thus boils down to choosing the approximation space \mathcal{X} and a basis \phi_1,\ldots,\phi_M. Picking \mathcal{X} to be a space of piecewise polynomial functions (splines) gives the finite element method. Picking \mathcal{X} to be a space spanned by a collection of trigonometric functions gives a Fourier spectral method. One can use a space spanned by wavelets as well. The Galerkin framework is extremely general: give it a subspace \mathcal{X} and it will give you a linear system of equations to solve to give you the best approximate solution in \mathcal{X}.

Two design considerations factor into the choice of space \mathcal{X} and basis \phi_1,\ldots,\phi_M. First, one wants to pick a space \mathcal{X}, where the solution u almost lies in. This is the rationale behind spectral methods. Smooth functions are very well-approximated by short truncated Fourier expansions, so, if the solution u is smooth, spectral methods will converge very quickly. Finite element methods, which often use low-order piecewise polynomial functions, converge much more slowly to a smooth u. The second design consideration one wants to consider is the ease of solving the system Ax = b resulting from the Galerkin approximation. If the basis function \phi_1,\ldots,\phi_M are local in the sense that most pairs of basis functions \phi_i and \phi_j aren’t nonzero at the same point x (more formally, \phi_i and \phi_j have disjoint supports for most i and j), the system Ax = b will be sparse and thus usually much easier to solve. Traditional spectral methods usually result in a harder-to-solve dense linear systems of equations.25There are clever ways of making spectral methods which lead to sparse matrices. Conversely, if one uses high-order piecewise polynomials in a finite element approximation, one can get convergence properties similar to a spectral method. These are called spectral element methods. It should be noted that both spectral and finite element methods lead to ill-conditioned matrices A, making integral equation-based approaches preferable if one needs high-accuracy.26For example, only one researcher using a finite-element method was able to meet Trefethen’s challenge to solve the Poisson equation to eight digits of accuracy on an L-shaped domain (see Section 6 of this paper). Getting that solution required using a finite-element method of order 15! Integral equations, themselves, are often solved using Galerkin approximation, leading to so-called boundary element methods.

Upshot: Galerkin approximation is a powerful and extremely flexible methodology for approximately solving large- or infinite-dimensional problems by finding the best approximate solution in a smaller finite-dimensional subspace. To use a Galerkin approximation, one must convert their problem to a variational formulation and pick a basis for the approximation space. After doing this, computing the Galerkin approximation reduces down to solving a system of linear equations with dimension equal to the dimension of the approximation space.

Big Ideas in Applied Math: Sparse Matrices

Sparse matrices are an indispensable tool for anyone in computational science. I expect there are a very large number of simulation programs written in scientific research across the country which could be faster by ten to a hundred fold at least just by using sparse matrices! In this post, we’ll give a brief overview what a sparse matrix is and how we can use them to solve problems fast.

A matrix is sparse if most of its entries are zero. There is no precise threshold for what “most” means; Kolda suggests that a matrix have at least 90% of its entries be zero for it to be considered sparse. The number of nonzero entries in a sparse matrix A is denoted by \operatorname{nnz}(A). A matrix that is not sparse is said to be dense.

Sparse matrices are truly everywhere. They occur in finite difference, finite element, and finite volume discretizations of partial differential equations. They occur in power systems. They occur in signal processing. They occur in social networks. They occur in intermediate stages in computations with dense rank-structured matrices. They occur in data analysis (along with their higher-order tensor cousins).

Why are sparse matrices so common? In a word, locality. If the ijth entry a_{ij} of a matrix A is nonzero, then this means that row i and column j are related in some way to each other according to the the matrix A. In many situations, a “thing” is only related to a handful of other “things”; in heat diffusion, for example, the temperature at a point may only depend on the temperatures of nearby points. Thus, if such a locality assumption holds, every row will only have a small number of nonzero entries and the matrix overall will be sparse.

Storing and Multiplying Sparse Matrices

A sparse matrix can be stored efficiently by only storing its nonzero entries, along with the row and column in which these entries occur. By doing this, a sparse matrix can be stored in \mathcal{O}(\operatorname{nnz}(A)) space rather than the standard \mathcal{O}(N^2) for an N\times N matrix A.1Here, \mathcal{O}(\cdot) refers to big-O notation. For the efficiency of many algorithms, it will be very beneficial to store the entries row-by-row or column-by-column using compressed sparse row and column (CSR and CSC) formats; most established scientific programming software environments support sparse matrices stored in one or both of these formats. For efficiency, it is best to enumerate all of the nonzero entries for the entire sparse matrix and then form the sparse matrix using a compressed format all at once. Adding additional entries one at a time to a sparse matrix in a compressed format requires reshuffling the entire data structure for each new nonzero entry.

There exist straightforward algorithms to multiply a sparse matrix A stored in a compressed format with a vector x to compute the product b = Ax. Initialize the vector b to zero and iterate over the nonzero entries a_{ij} of A, each time adding a_{ij}x_j to b_i. It is easy to see this algorithm runs in \mathcal{O}(\operatorname{nnz}(A)) time.2More precisely, this algorithm takes \mathcal{O}(\operatorname{nnz}(A) + N) time since it requires \mathcal{O}(N) operations to initialize the vector b even if A has no nonzero entries. We shall ignore this subtlety in the remainder of this article and assume that \operatorname{nnz}(A) = \Omega(N), which is true of most sparse matrices occurring in practice The fact that sparse matrix-vector products can be computed quickly makes so-called Krylov subspace iterative methods popular for solving linear algebraic problems involving sparse matrices, as these techniques only interact with the matrix A by computing matrix-vector products x \mapsto Ax (or matrix-tranpose-vector products y \mapsto A^\top y).

Lest the reader think that every operation with a sparse matrix is necessarily fast, the product of two sparse matrices A and B need not be sparse and the time complexity need not be \mathcal{O}(\operatorname{nnz}(A) + \operatorname{nnz}(B)). A counterexample is

(1)   \begin{equation*} A = B^\top = \begin{bmatrix} a_1 & 0 & \cdots & 0 \\ a_2 & 0 & \cdots & 0 \\ \vdots & \vdots & \ddots & 0 \\ a_n & 0 & \cdots & 0 \end{bmatrix} \in \mathbb{R}^n \end{equation*}

for a_1,\ldots,a_n \ne 0. We have that \operatorname{nnz}(A) = \operatorname{nnz}(B) = N but

(2)   \begin{equation*} AB = \begin{bmatrix} a_1^2 & a_1 a_2 & \cdots & a_1a_N \\ a_2a_1 & a_2^2 & \cdots & a_2a_N \\ \vdots & \vdots & \ddots & \vdots \\ a_Na_1 & a_Na_2 & \cdots & a_N^2 \end{bmatrix} \end{equation*}

which has \operatorname{nnz}(AB) = N^2 nonzero elements and requires \mathcal{O}(N^2) operations to compute. However, if one does the multiplication in the other order, one has \operatorname{nnz}(BA) = 1 and the multiplication can be done in \mathcal{O}(N) operations. Thus, some sparse matrices can be multiplied fast and others can’t. This phenomena of different speeds for different sparse matrices is very much also true for solving sparse linear systems of equations.

Solving Sparse Linear Systems

The question of how to solve a sparse system of linear equations Ax = b where A is sparse is a very deep problems with fascinating connections to graph theory. For this article, we shall concern ourselves with so-called sparse direct methods, which solve Ax = b by means of computing a factorization of the sparse matrix A. These methods produce an exact solution to the system Ax = b if all computations are performed exactly and are generally considered more robust than inexact and iterative methods. As we shall see, there are fundamental limits on the speed of certain sparse direct methods, which make iterative methods very appealing for some problems.

Note from the outset that our presentation will be on illustrating the big ideas rather than presenting the careful step-by-step details needed to actually code a sparse direct method yourself. An excellent reference for the latter is Tim Davis’ wonderful book Direct Methods for Sparse Linear Systems.

Let us begin by reviewing how LU factorization works for general matrices. Suppose that the (1,1) entry of A is nonzero. Then, LU factorization proceeds by subtracting scaled multiples of the first row from the other rows to zero out the first column. If one keeps track of these scaling, then one can write this process as a matrix factorization, which we may demonstrate pictorially as

(3)   \begin{equation*} \underbrace{\begin{bmatrix} * & * & \cdots & * \\ * & * & \cdots & * \\ \vdots & \vdots & \ddots & \vdots \\ * & * & \cdots & *\end{bmatrix}}_{=A} = \begin{bmatrix} 1 & & &\\ * & 1 & & \\ \vdots & & \ddots & \\ * & & & 1\end{bmatrix} \begin{bmatrix} * & * & \cdots & * \\ & * & \cdots & * \\ & \vdots & \ddots & \vdots \\ & * & \cdots & *\end{bmatrix}. \end{equation*}

Here, *‘s denote nonzero entries and blanks denote zero entries. We then repeat the process on the (N-1)\times (N-1) submatrix in the bottom right (the so-called Schur complement). Continuing in this way, we eventually end up with a complete LU factorization

(4)   \begin{equation*} \underbrace{\begin{bmatrix} * & * & \cdots & * \\ * & * & \cdots & * \\ \vdots & \vdots & \ddots & \vdots \\ * & * & \cdots & *\end{bmatrix}}_{=A} = \underbrace{\begin{bmatrix} 1 & & &\\ * & 1 & & \\ \vdots & \vdots & \ddots & \\ * &* &\cdots & 1\end{bmatrix}}_{=L} \underbrace{\begin{bmatrix} * & * & \cdots & * \\ & * & \cdots & * \\ &  & \ddots & \vdots \\ & & & *\end{bmatrix}}_{=U}. \end{equation*}

In the case that A is symmetric positive definite (SPD), one has that U = DL^\top for D a diagonal matrix consisting of the entries on U. This factorization A = LDL^\top is a Cholesky factorization of A.3Often, the Cholesky factorization is written as A = TT^\top for T=LD^{1/2} or A = RR^\top for R = D^{-1/2}U. These different forms all contain the same basic information, so we shall stick with the LDL^\top formulation in this post. For general non-SPD matrices, one needs to incorporate partial pivoting for Gaussian elimination to produce accurate results.4See the excellent monograph Accuracy and Stability of Numerical Algorithms for a comprehensive treatment of this topic.

Let’s try the same procedure for a sparse matrix. Consider a sparse matrix with the following sparsity pattern:

(5)   \begin{equation*} A = \begin{bmatrix} * & * & * & & * \\ * & * & & * & \\ * & & * & & \\ & * & & * & \\ * & & &  & * \end{bmatrix}. \end{equation*}

When we eliminate the (1,1) entry, we get the following factorization:

(6)   \begin{equation*} \underbrace{\begin{bmatrix} * & * & * & & * \\ * & * & & * & \\ * & & * & & \\ & * & & * & \\ * & & &  & * \end{bmatrix}}_{=A} = \begin{bmatrix} 1 & & & & \\ * & 1& & &  \\ * & & 1 & & \\  & & & 1 & \\ * & & &  & 1 \end{bmatrix} \begin{bmatrix} * & * & * & & * \\ & * & \bullet & * & \bullet \\ & \bullet & * & & \bullet \\ & * & & * & \\ & \bullet & \bullet &  & * \end{bmatrix} \end{equation*}

Note that the Schur complement has new additional nonzero entries (marked with a \bullet) not in the original sparse matrix A. The Schur complement of A is denser than A was; there are new fill-in entries. The worst-case scenario for fill-in is the arrowhead matrix:

(7)   \begin{equation*} \underbrace{\begin{bmatrix} * & * & * & \cdots & * \\ * & * & & & \\ * & & * & & \\ \vdots & & & \ddots & \\ * & & &  & * \end{bmatrix}}_{=A} = \begin{bmatrix} 1 & & & & \\ * & 1& & &  \\ * & & 1 & & \\  \vdots & & & \ddots & \\ * & & & & 1 \end{bmatrix} \begin{bmatrix} * & * & * & * & * \\ & * & \bullet & \cdots & \bullet \\ & \bullet & * & \cdots & \bullet \\ & \vdots & \vdots & \ddots & \vdots \\ & \bullet & \bullet &  \cdots & * \end{bmatrix} \end{equation*}

After one step of Gaussian elimination, we went from a matrix with \mathcal{O}(N) nonzeros to a fully dense Schur complement! However, the arrowhead matrix also demonstrates a promising strategy. Simply construct a permutation matrix which reorders the first entry to be the last5For instance, the circular shift permutation P = \begin{bmatrix} & 1 & & & \\ & & 1 & & \\ & & & \ddots & \\ & & & & 1 \\ 1\end{bmatrix}. and then perform Gaussian elimination on the symmetrically permuted matrix PAP^\top instead. In fact, the entire LU factorization can be computed without fill-in:

(8)   \begin{equation*} \underbrace{\begin{bmatrix} * & & & & * \\ & * & & & * \\ & & * & & * \\  & & & \ddots  & \vdots \\ * & * & * & \cdots & * \end{bmatrix}}_{=PAP^\top} = \begin{bmatrix} 1 & & & & \\ & 1& & &  \\ & & 1 & & \\  & & & \ddots & \\ * & * & * & \cdots & 1 \end{bmatrix} \begin{bmatrix} * & &  & & * \\ & * &  & & * \\ & & * &  & * \\ &  & & \ddots & \vdots \\ &  &  &  & * \end{bmatrix}. \end{equation*}

This example shows the tremendous importance of reordering of the rows and columns when computing a sparse LU factorization.

The Best Reordering

As mentioned above, when computing an LU factorization of a dense matrix, one generally has to reorder the rows (and/or columns) of the matrix to compute the solution accurately. Thus, when computing the LU factorization of a sparse matrix, one has to balance the need to reorder for accuracy and to reorder to reduce fill-in. For these reasons, for the remainder of this post, we shall focus on computing Cholesky factorizations of SPD sparse matrices, where reordering for accuracy is not necessary.6For ill-conditioned and positive semi-definite matrices, one may want to reorder a Cholesky factorization so the result is rank-revealing. This review article has a good discussion of pivoted Cholesky factorization. For most applications, one can successfully compute an accurate Cholesky factorization without any specific accuracy-focused reordering strategy. Since we want the matrix to remain SPD, we must restrict ourselves to symmetric reordering strategies where A is reordered to PAP^\top where P is a permutation matrix.

Our question is deceptively simple: what reordering produces the least fill-in? In matrix language, what permutation P minimizes \operatorname{nnz}(L) where LDL^\top = PAP^\top is the Cholesky factorization of PAP^\top?

Note that, assuming no entries in the Gaussian elimination process exactly cancel, then the Cholesky factorization depends only on the sparsity pattern of A (the locations of the zeros and nonzeros) and not on the actual numeric values of A‘s entries. This sparsity structure is naturally represented by a graph \mathcal{G}(A) whose nodes are the indices \{1,\ldots,N\} with an edge between i \ne j if, and only if, a_{ij} \ne 0.

Now let’s see what happens when we do Gaussian elimination from a graph point-of-view. When we eliminate the (1,1) entry from matrix, this results in all nodes of the graph adjacent to 1 becoming connected to each other.7Graph theoretically, we add a clique containing the nodes adjacent to 1

This shows why the arrowhead example is so bad. By eliminating the a vertex connected to every node in the graph, the eliminated graph becomes a complete graph.

Reordering the matrix corresponds to choosing in what order the vertices of the graph are eliminated. Choosing the elimination order is then a puzzle game; eliminate all the vertices of the graph in the order that produces the fewest fill-in edges (shown red).8This “graph game” formulation of sparse Gaussian elimination is based on how I learned it from John Gilbert. His slides are an excellent resource for all things sparse matrices!

Finding the best elimination ordering for a sparse matrix (graph) is a good news/bad news situation. For the good news, many graphs possess a perfect elimination ordering, in which no fill-in is produced at all. There is a simple algorithm to determine whether a graph (sparse matrix) possesses a perfect elimination ordering and if so, what it is.9The algorithm is basically just a breadth-first search. Some important classes of graphs can be eliminated perfectly (for instance, trees). More generally, the class of all graphs which can be eliminated perfectly is precisely the set of chordal graphs, which are well-studied in graph theory.

Now for the bad news. The problem of finding the best elimination ordering (with the least fill-in) for a graph is NP-Hard. This means, assuming the widely conjectured result that {\rm P} \ne {\rm NP}, that finding the best elimination ordering would be a hard computational problem than the worst-case \mathcal{O}(N^3) complexity for doing Gaussian elimination in any ordering! One should not be too pessimistic about this result, however, since (assuming {\rm P} \ne {\rm NP}) all it says is that there exists no polynomial time algorithm guaranteed to produce the absolutely best possible elimination ordering when presented with any graph (sparse matrix). If one is willing to give up on any one of the bolded statements, further progress may be possible. For instance, there exists several good heuristics, which find reasonably good elimination orderings for graphs (sparse matrices) in linear \mathcal{O}(\operatorname{nnz}(A)) (or nearly linear) time.

Can Sparse Matrices be Eliminated in Linear Time?

Let us think about the best reordering question in a different way. So far, we have asked the question “Can we find the best ordering for a sparse matrix?” But another question is equally important: “How efficiently can we solve a sparse matrix, even with the best possible ordering?”

One might optimistically hope that every sparse matrix possesses an elimination ordering such that its Cholesky factorization can be computed in linear time (in the number of nonzeros), meaning that the amount of time needed to solve Ax = b is proportional to the amount of data needed to store the sparse matrix A.

When one tests a proposition like this, one should consider the extreme cases. If the matrix A is dense, then it requires \mathcal{O}(N^3) operations to do Gaussian elimination,10This is neglecting the possibility of acceleration by Strassentype fast matrix multiplication algorithms. For simplicity, we shall ignore these fast multiplication techniques for the remainder of this post and assume dense Ax = b can be solved no faster than \mathcal{O}(N^3) operations. but A only has \operatorname{nnz}(A) = N^2 nonzero entries. Thus, our proposition cannot hold in unmodified form.

An even more concerning counterexample is given by a matrix A whose graph \mathcal{G}(A) is a \mathcal{O}(\sqrt{N}) \times \mathcal{O}(\sqrt{N}) 2D grid graph.

Sparse matrices with this sparsity pattern (or related ones) appear all the time in discretized partial differential equations in two dimensions. Moreover, they are truly sparse, only having \operatorname{nnz}(A) = \mathcal{O}(N) nonzero entries. Unforunately, no linear time elimination ordering exists. We have the following theorem:

Theorem: For any elimination ordering for a sparse matrix A with \mathcal{G}(A) being a \sqrt{N}\times \sqrt{N} 2D grid graph, in any elimination ordering, the Cholesky factorization PAP^\top = LDL^\top requires \Omega(N^{3/2}) operations and satisfies \operatorname{nnz}(L)= \Omega(N\log N).11Big-Omega notation is a cousin of Big-O notation. One should read f(N) = \Omega(g(N)) as “f(N) is no less than a constant multiple of g(N), asymptotically”.

The proof is contained in Theorem 10 and 11 (and the ensuing paragraph) of classic paper by Lipton, Rose, and Tarjan. Natural generalizations to d-dimensional grid graphs give bounds of \Omega(N^{3(d-1)/d}) time and \operatorname{nnz}(L)=\Omega(N^{2(d-1)/d}) for d > 2. In particular, for 2D finite difference and finite element discretizations, sparse Cholesky factorization takes \Omega(N^{3/2}) operations and produces a Cholesky factor with \operatorname{nnz}(L)= \Omega(N\log N) in the best possible ordering. In 3D, sparse Cholesky factorization takes \Omega(N^{2}) operations and produces a Cholesky factor with \operatorname{nnz}(L)= \Omega(N^{4/3}) in the best possible ordering.

Fortunately, at least these complexity bounds are attainable: there is an ordering which produces a sparse Cholesky factorization with PAP^\top = LDL^\top requiring \Theta(N^{3/2}) operations and with \operatorname{nnz}(L)= \Theta(N\log N) nonzero entries in the Cholesky factor.12Big-Theta notation just means f(N) = \Theta(g(N)) if f(N) = \mathcal{O}(g(N)) and f(N) = \Omega(g(N)) One such asymptotically optimal ordering is the nested dissection ordering, one of the heuristics alluded to in the previous section. The nested dissection ordering proceeds as follows:

  1. Find a separator S consisting of a small number of vertices in the graph \mathcal{G}(A) such that when S is removed from \mathcal{G}(A), \mathcal{G}(A) is broken into a small number of edge-disjoint and roughly evenly sized pieces \mathcal{G}_1,\ldots,\mathcal{G}_k.13In particular, \mathcal{G}(A) is the disjoint union \mathcal{G}(A) = S \cup \mathcal{G}_1 \cup \cdots \mathcal{G}_k and there are no edges between \mathcal{G}_i and \mathcal{G}_j for i\ne j.
  2. Recursively use nested dissection to eliminate each component \mathcal{G}_1,\ldots, \mathcal{G}_k individually.
  3. Eliminate S in any order.

For example, for the 2D grid graph, if we choose S to be a cross through the center of the 2D grid graph, we have a separator of size |S| = \Theta(\sqrt{N}) dividing the graph into 4 roughly \sqrt{N}/2\times \sqrt{N}/2 pieces.

Let us give a brief analysis of this nested dissection ordering. First, consider the sparsity of the Cholesky factor \operatorname{nnz}(L). Let S(N) denote the number of nonzeros in L for an elimination of the \sqrt{N}\times \sqrt{N} 2D grid graph using the nested dissection ordering. Then step 2 of nested dissection requires us to recursively eliminate four \sqrt{N/4} \times \sqrt{N/4} 2D grid graphs. After doing this, for step 3, all of the vertices of the separator might be connected to each other, so the separator graph will potentially have as many as \mathcal{O}(|S|^2) = \mathcal{O}(N) edges, which result in nonzero entries in L. Thus, combining the fill-in from both steps, we get

(9)   \begin{equation*} S(N) = 4S\left(\frac{N}{4}\right) + \mathcal{O}(N). \end{equation*}

Solving this recurrence using the master theorem for recurrences gives \operatorname{nnz}(L) = S(N) = \mathcal{O}(N\log N). If one instead wants the time T(N) required to compute the Cholesky factorization, note that for step 3, in the worst case, all of the vertices of the separator might be connected to each other, leading to a \sqrt{N}\times \sqrt{N} dense matrix. Since a \sqrt{N}\times \sqrt{N} matrix requires \mathcal{O}((\sqrt{N})^3) = \mathcal{O}(N^{3/2}), we get the recurrence

(10)   \begin{equation*} T(N) = 4T\left(\frac{N}{4}\right) + \mathcal{O}(N^{3/2}), \end{equation*}

which solves to T(N) = \mathcal{O}(N^{3/2}).

Conclusions

As we’ve seen, sparse direct methods (as exemplified here by sparse Cholesky) possess fundamental scalability challenges for solving large problems. For the important class of 2D and 3D discretized partial differential equations, the time to solve Ax = b scales like \Theta(N^{3/2}) and \Theta(N^2), respectively. For truly large-scale problems, these limitations may be prohibitive for using such methods.

This really is the beginning of the story, not the end for sparse matrices however. The scalability challenges for classical sparse direct methods has spawned many exciting different approaches, each of which combats the scalability challenges of sparse direct methods for a different class of sparse matrices in a different way.

Upshot: Sparse matrices occur everywhere in applied mathematics, and many operations on them can be done very fast. However, the speed of computing an LU factorization of a sparse matrix depends significantly on the arrangement of its nonzero entries. Many sparse matrices can be factored quickly, but some require significant time to factor in any reordering.

Big Ideas in Applied Math: Smoothness and Degree of Approximation

At its core, computational mathematics is about representing the infinite by the finite. Even attempting to store a single arbitrary real number requires an infinite amount of memory to store its infinitely many potentially nonrepeating digits.1It is a well-known result that a real number has a repeating decimal expansion if, and only if, it is rational. When dealing with problems in calculus, however, the problem is even more severe as we want to compute with functions on the real line. In effect, a function is an uncountably long list of real numbers, one for each value of the function’s domain. We certainly cannot store an infinite list of numbers with infinitely many digits on a finite computer!

Thus, our only hope to compute with functions is to devise some sort of finite representation for them. The most natural representation is to describe function by a list of real numbers (and then store approximations of these numbers on our computer). For instance, we may approximate the function by a polynomial a_1 + a_2 x + \cdots + a_{M} x^{M-1} of degree M-1 and then store the M coefficients a_1,\ldots,a_{M}. From this list of numbers, we then can reconstitute an approximate version of the function. For instance, in our polynomial example, our approximate version of the function is just a_1 + a_2 x + \cdots + a_{M} x^{M-1}. Naturally, there is a tradeoff between the length of our list of numbers and how accurate our approximation is. This post is about that tradeoff.

The big picture idea is that the “smoother” a function is, the easier it will be to approximate it with a small number of parameters. Informally, we have the following rule of thumb: if a function f on a one-dimensional domain possesses s nice derivatives, then f can be approximated by a M-parameter approximation with error decaying at least as fast as 1/M^s. This basic result appears in many variants in approximation theory with different precise definitions of the term “s nice derivatives” and “M-parameter approximation”. Let us work out the details of the approximation problem in one concrete setting using Fourier series.

Approximation by Fourier Series

Consider a complex-valued and 2\pi-period function f defined on the real line. (Note that, by a standard transformation, there are close connections between approximation of 2\pi-periodic functions on the whole real line and functions defined on a compact interval [a,b].2Specifically, suppose that h is a function defined on [a,b]. Then define a function g on [-1,1] by g(x) = h((b-a)x + (b+a)). This linear rescaling of the domain is very simple and easy to understand. Now define a 2\pi-periodic function f on \mathbb{R} by f(\theta) = g(\cos(\theta)). There are very close connections between approximation of f and g. For example, Fourier cosine expansions of f are equivalent to Chebyshev polynomial expansions of g. For more on this subject, Trefethen’s Approximation Theory and Approximation Practice is an excellent reference.) If f is square-integrable, then f possesses a Fourier expansion

(1)   \begin{equation*} f(\theta) = \sum_{k=-\infty}^\infty} \hat{f}_k e^{{\rm i} k\theta}, \quad \hat{f}_k = \frac{1}{2\pi} \int_{-\pi}^\pi f(\theta) e^{-{\rm i}k\theta} \, d\theta. \end{equation*}

The infinite series converges in the L^2 sense, meaning that \lim_{m\to\infty} \|f - f_m\|_{L^2} = 0, where f_m is the truncated Fourier series f_M(\theta) = \sum_{k=-m}^m \hat{f}_k e^{{\rm i} k\theta} and \|\cdot\| is L^2 norm \|f\|_2 = \sqrt{\int_{-\pi}^\pi |f(\theta)|^2 \, d\theta.3One may show with considerable analysis that Fourier series converges in others senses, for example almost everywhere convergence. We also have the Plancherel theorem, which states that

(2)   \begin{equation*} \|f\|_{L^2}^2 = \int_{-\pi}^\pi |f(\theta)|^2\, d\theta = 2\pi \sum_{k=-\infty}^{\infty} |\hat{f}_k|^2. \end{equation*}

Note that the convergence of the Fourier series is fundamentally a statement about approximation. The fact that the Fourier series converges means that the truncated Fourier series f_m of 2m+1 terms acts as an arbitrarily close approximate of f (measured with the L^2 norm). However, the number M=2m+1 of terms we need to store might be quite large if a large value of M is needed for \|f - f_m\|_{L^2} to be small. However, as we shall soon see, if the function f is “smooth”, \|f - f_M\|_{L^2} will be small for even moderate values of M.

Smoothness

Often, in analysis, we refer to a function as smooth when it possesses derivatives of all orders. In one dimension, this means that the jth derivative f^{(j)} exists for every integer j \ge 0. In this post, we shall speak of smoothness as a more graded notion: loosely, a function g is smoother than a function f if g possesses more derivatives than f or the magnitude of g‘s derivatives are smaller. This conception of smoothness accords more with the plain-English definition of smoothness: the graph of a very mildly varying function g with a discontinuity in its 33rd derivative looks much smoother to the human eye than the graph of a highly oscillatory and jagged function f that nonetheless possesses derivatives of all orders.4One might refer to the precise concept of possessing derivatives of all orders as C^\infty smoothness.

For a function defined in terms of a Fourier series, it is natural to compute its derivative by formally differentiating the Fourier series term-by-term:

(3)   \begin{equation*} f'(\theta) = \sum_{k=-\infty}^\infty ({\rm i}k) \hat{f}_k e^{{\rm i} k\theta}. \end{equation*}

This formal Fourier series converges if, and only if, the L^2 norm of this putative derivative f', as computed with the Plancherel theorem, is finite: \|f'\|_{L^2}^2 = 2\pi \sum_{k=-\infty}^\infty |k|^2 |\hat{f}_k|^2 < \infty. This “derivative” f' may not be a derivative of f in the classical sense. For instance, using this definition, the absolute value function g(x) = |x| possesses a derivative g'(x) = +1 for x > 0 and g'(x) = -1 for x < 0. For the derivative of f to exist in the sense of Eq. (3), f need not be differentiable at every point, but it must define a square-integrable functions at the points where it is differentiable. We shall call the derivative f' as given by Eq. (3) to be a weak derivative of f.

If a function f has s square-integrable weak derivatives f^{(j)}(\theta) = \sum_{k=-\infty}^\infty ({\rm i}k)^j \hat{f}_k e^{{\rm i}k\theta} for 1\le j \le s, then we say that f belongs to the Sobolev space H^s. The Sobolev space H^s is equipped with the norm

(4)   \begin{equation*} \|f\|_{H^s} = \sqrt{\sum_{j=0}^s \|f^{(j)}\|_{L^2}^2}. \end{equation*}

The Sobolev norm \|\cdot\|_{H^s} is a quantitative measure of qualitative smoothness. The smaller the Sobolev norm H^s of f, the smaller the derivatives of f are. As we will see, we can use this to bound the approximation error.

Smoothness and Degree of Approximation

If f is approximated by f_m, the error of approximation is given by

(5)   \begin{equation*} f(\theta) - f_m(\theta) = \sum_{|k|>m} \hat{f}_k e^{{\rm i}k\theta}, \quad \|f - f_m\|_{L^2} = \sqrt{ \sum_{|k|>m} |\hat{f}_k|^2 }. \end{equation*}

Suppose that f \in H^s (that is, f has s square integrable derivatives). Then we may deduce the inequality

(6)   \begin{equation*} \begin{split} \|f - f_m\|_{L^2} &= \sqrt{ \sum_{|k|>m} |\hat{f}_k|^2 } \\ &= \sqrt{ \sum_{|k|>m} |k|^{-2s}|k|^{2s}|\hat{f}_k|^2 }\\ &\le m^{-s} \sqrt{ \sum_{|k|>m} |k|^{2s}|\hat{f}_k|^2 } \\ &\le m^{-s}\|f\|_{H^s}. \end{split} \end{equation*}

The first “\le” follows from the fact that |k|^{-2s} < m^{-2s} for |k|>m. This very important result is a precise instantiation of our rule of thumb from earlier: if f possesses s nice (i.e. square-integrable) derivatives, then the (L^2) approximation error for an M=2m+1-term Fourier approximation decays at least as fast as 1/M^s.

Higher Dimensions

The results for one dimension can easily be extended to consider functions f defined on d-dimensional space which are 2\pi-periodic in every argument.5e.g. f(\theta_1,\ldots, \theta_j+2\pi,\ldots,\theta_d) = f(\theta_1,\ldots,\theta_j,\ldots,\theta_d) for every 1\le j \le d For physics-based scientific simulation, we are often interested in d=2 or d=3, but for more modern problems in data science, we might be interested in very large dimensions d.

Letting \mathbb{Z}^d denote the set of all d-tuples of integers, one can show that one has the d-dimensional Fourier series

(7)   \begin{equation*} f(\theta) = \sum_{k \in \mathbb{Z}^d} f_{\hat k} e^{{\rm i}k\cdot \theta}, \quad \hat{f}_k = \frac{1}{(2\pi)^d} \int_{[-\pi,\pi]^d} f(\theta) e^{-{\rm i}k\cdot \theta} \, d\theta. \end{equation*}

Here, we denote k\cdot \theta to be the Euclidean inner product of the d-dimensional vectors k and \theta, k\cdot \theta = k_1\theta_1 + \cdots + k_d\theta_d. A natural generalization of the Plancherel theorem holds as well. Let \max |k| denote the maximum of |k_1|,\ldots,|k_d|. Then, we have the truncated Fourier series f_m = \sum_{\max |k| \le m} \hat{f}_k e^{{\rm i}k\cdot \theta}. Using the same calculations from the previous section, we deduce a very similar approximation property

(8)   \begin{equation*} \|f - f_m\|_{L^2} = \sqrt{ \sum_{\max|k|>m} |\hat{f}_k|^2 }  \le m^{-s}\|f\|_{H^s}. \end{equation*}

There’s a pretty big catch though. The approximate function f_m possesses M = (2m+1)^d terms! In order to include each of the first m Fourier modes in each of d dimensions, the number of terms M in our Fourier approximation must grow exponentially in d! In particular, the approximation error satisfies a bound

(9)   \begin{equation*} \|f - f_m\|_{L^2}  \le \left(\frac{M^{1/d}-1}{2}\right)^{-s}\|f\|_{H^s} \le C(s,d)M^{-s/d} \|f\|_{H^s}, \end{equation*}

where C(s,d) \ge 0 is a constant depending only on s and d.

This is the so-called curse of dimensionality: to approximate a function in d dimensions, we need exponentially many terms in the dimension d. In higher-dimensions, our rule of thumb needs to be modified: if a function f on a d-dimensional domain possesses s nice derivatives, then f can be approximated by a M-parameter approximation with error decaying at least as fast as 1/M^{s/d}.

The Theory of Nonlinear Widths: The Speed Limit of Approximation Theory

So far, we have shown that if one approximates a function f on a d-dimensional space by truncating its Fourier series to M terms, the approximation error decays at least as fast as 1/M^{s/d}. Can we do better than this, particularly in high-dimensions where the error decay can be very slow if s \ll d?

One must be careful about how one phrases this question. Suppose I ask “what is the best way of approximating a function f“? A subversive answer is that we may approximate f by a single-parameter approximation of the form \hat{f} = af with a=1! Consequently, there is a one-parameter approximation procedure that approximates every function perfectly. The problem with this one-parameter approximation is obvious: the one-parameter approximation is terrible at approximating most functions different than f. Thus, the question “what is the best way of approximating a particular function?” is ill-posed. We must instead ask the question “what is the best way of approximating an entire class of functions?” For us, the class of functions shall be those which are sufficiently smooth: specifically, we shall consider the class of functions whose Sobolev norm satisfies a bound \|f\|_{H^s} \le B. Call this class W.

As outlined at the beginning, an approximation procedure usually begins by taking the function f and writing down a list of M numbers a_1,\ldots,a_M. Then, from this list of numbers we reconstruct a function \hat{f} which serves as an approximation to f. Formally, this can be viewed as a mathematical function \Phi which takes f \in W to a tuple (a_1,\ldots,a_M) \in \mathbb{C}^d followed by a function \Lambda which takes (a_1,\ldots,a_M) and outputs a continuous 2\pi-periodic function \hat{f} \in C_{2\pi}(\mathbb{R}).

(10)   \begin{equation*} f \stackrel{\Phi}{\longmapsto}(a_1,\ldots,a_M)\stackrel{\Lambda}{\longmapsto} \hat{f}, \quad \Phi : W \to \mathbb{C}^M, \quad \Lambda : \mathbb{C}^M \to C_{2\pi}(\mathbb{R}). \end{equation*}

Remarkably, there is a mathematical theory which gives sharp bounds on the expressive power of any approximation procedure of this type. This theory of nonlinear widths serves as a sort of speed limit in approximation theory: no method of approximation can be any better than the theory of nonlinear widths says it can. The statement is somewhat technical, and we advise the reader to look up a precise statement of the result before using it any serious work. Roughly, the theory of nonlinear widths states that for any continuous approximation procedure6That is, an approximation procedure for which \Phi : W \to \mathbb{C}^d is a continuous function where W is equipped with the topology defined by the norm \|\cdot\|_{H^s}. that is able to approximate every function in W with L^2 approximation error no more than \epsilon, the number of parameters M must be at least some constant multiple of \epsilon^{-d/s}. Equivalently, the worst-case approximation error for a function in W with an M parameter continuous approximation is at least some multiple of 1/M^{s/d}.

In particular, the theory of nonlinear widths states that the approximation property of truncated Fourier series are as good as any method for approximating functions in the class W, as they exactly meet the “speed limit” given by the theory of nonlinear widths. Thus, approximating using truncated Fourier series is, in a certain very precise sense, as good as any other approximation technique you can think of in approximating arbitrary functions from W: splines, rational functions, wavelets, and artificial neural networks must follow the same speed limit. Make no mistake, these other methods have definite advantages, but degree of approximation for the class W is not one of them. Also, note that the theory of nonlinear widths shows that the curse of dimensionality is not merely an artifact of Fourier series; it affects all high-dimensional approximation techniques.

For the interested reader, see the following footnotes for two important ways one may perform approximations better than the theory of nonlinear widths within the scope of its rules.7The theory of nonlinear widths holds for continuous methods of approximation. This means that discontinuous approximation procedures may circumvent its bounds. Indeed, such discontinuous approximation procedures exist using probabilistic techniques. These methods are of questionable use in practice since discontinuous approximation procedures, by their nature, are extremely sensitive to the perturbations which are ubiquitous in performing computations on computers.8The theory of nonlinear widths holds for means of approximating the entire class W. More efficient methods may exist for meaningful subclasses of W. For instance, Mhaskar and Poggio show that for functions f satisfying a compositional property, that they can effectively be approximated by multilayer artificial neural networks.

Upshot: The smoother a function is, the better it can be approximated. Specifically, one can approximate a function on d dimensions with s nice derivatives with approximation error decaying with rate at least 1/M^{s/d}. In the case of 2\pi-periodic functions, such an approximation can easily be obtained by truncating the function’s Fourier series. This error decay rate is the best one can hope for to approximate all functions of this type.

Big Ideas in Applied Math: The Schur Complement

Given the diversity of applications of mathematics, the field of applied mathematics lacks a universally accepted set of core concepts which most experts would agree all self-proclaimed applied mathematicians should know. Further, much mathematical writing is very carefully written, and many important ideas can be obscured by precisely worded theorems or buried several steps into a long proof.

In this series of blog posts, I hope to share my personal experience with some techniques in applied mathematics which I’ve seen pop up many times. My goal is to isolate a single particularly interesting idea and provide a simple explanation of how it works and why it can be useful. In doing this, I hope to collect my own thoughts on these topics and write an introduction to these ideas of the sort I wish I had when I was first learning this material.

Given my fondness for linear algebra, I felt an appropriate first topic for this series would be the Schur Complement. Given matrices A, B, C, and D of sizes n\times n, n\times m, m\times n, and m\times m with A invertible, the Schur complement is defined to be the matrix D - BA^{-1}C.

The Schur complement naturally arises in block Gaussian elimination. In vanilla Gaussian elimination, one begins by using the (1,1) entry of a matrix to “zero out” its column. Block Gaussian elimination extends this idea by using the n\times n submatrix occupying the top-left portion of a matrix to “zero out” all of the first n columns together. Formally, given the matrix \begin{bmatrix} A & B \\ C & D \end{bmatrix}, one can check by carrying out the multiplication that the following factorization holds:

(1)   \begin{equation*} \begin{bmatrix} A & B \\ C & D \end{bmatrix} = \begin{bmatrix} I_n & 0_{n\times m} \\ BA^{-1} & I_m\end{bmatrix} \begin{bmatrix} A & C \\ 0_{m\times n} & D - BA^{-1}C \end{bmatrix}. \end{equation*}

Here, we let I_j denote an identity matrix of size j\times j and 0_{j\times k} the j\times k zero matrix. Here, we use the notation of block (or partitioned) matrices where, in this case, a (m+n)\times (m+n) matrix is written out as a 2\times 2 “block” matrix whose entries themselves are matrices of the appropriate size that all matrices occurring in one block row (or column) have the same number of rows (or columns). Two block matrices which are blocked in a compatible way can be multiplied just like two regular matrices can be multiplied, taking care of the noncommutativity of matrix multiplication.

The Schur complement naturally in the expression for the inverse of \begin{bmatrix} A & B \\ C & D\end{bmatrix}. One can verify that for a block triangular matrix M = \begin{bmatrix} M_{11} & M_{12} \\ 0_{m\times n} & M_{22}\end{bmatrix}, we have the inverse formula

(2)   \begin{equation*} M^{-1} = \begin{bmatrix} M_{11} & M_{12} \\ 0_{m\times n} & M_{22}\end{bmatrix}^{-1} = \begin{bmatrix} M_{11}^{-1} & -M_{11}^{-1} M_{12}M_{22}^{-1} \\ 0_{m\times n} & M_{22}^{-1}\end{bmatrix}. \end{equation*}

(This can be verified by carrying out the block multiplication MM^{-1} for the proposed formula for M^{-1} and verifying that one obtains the identity matrix.) A similar formula holds for block lower triangular matrices. From here, we can deduce a formula for the inverse of \begin{bmatrix} A & B \\ C & D\end{bmatrix}. Let S = D - BA^{-1}C be the Schur complement. Then

(3)   \begin{equation*} \begin{split} \begin{bmatrix} A & B \\ C & D \end{bmatrix}^{-1} &= \begin{bmatrix} A & C \\ 0_{m\times n} & S \end{bmatrix}^{-1} \begin{bmatrix} I_n & 0_{n\times m} \\ BA^{-1} & I_m\end{bmatrix}^{-1} \\ &= \begin{bmatrix} A^{-1} & -A^{-1}CS^{-1} \\ 0_{m\times n} & S^{-1} \end{bmatrix} \begin{bmatrix} I_n & 0_{n\times m} \\ -BA^{-1} & I_m\end{bmatrix} \\ &= \begin{bmatrix} A^{-1} + A^{-1}CS^{-1}BA^{-1} & -A^{-1}CS^{-1} \\ -S^{-1}BA^{-1} & S^{-1} \end{bmatrix}. \end{split} \end{equation*}

This remarkable formula gives the inverse of \begin{bmatrix} A & B \\ C & D\end{bmatrix} in terms of A^{-1}, S^{-1}, B, and C. In particular, the (2,2)-block entry of \begin{bmatrix} A & B \\ C & D\end{bmatrix}^{-1} is simply just the inverse of the Schur complement.

Here, we have seen that if one starts with a large matrix and performs block Gaussian elimination, one ends up with a smaller matrix called the Schur complement whose inverse appears in inverse of the original matrix. Very often, however, it benefits us to run this trick in reverse: we begin with a small matrix, which we recognize to be the Schur complement of a larger matrix. In general, dealing with a larger matrix is more difficult than a smaller one, but very often this larger matrix will have special properties which allow us to more efficiently compute the inverse of the original matrix.

One beautiful application of this idea is the Sherman-Morrison-Woodbury matrix identity. Suppose we want to find the inverse of the matrix A - CD^{-1}B. Notice that this is the Schur complement of the matrix \begin{bmatrix} D & C \\ B & A \end{bmatrix}, which is the same \begin{bmatrix} A & B \\ C & D \end{bmatrix} after reordering.1Specifically, move the switch the first n rows with the last m rows and do the same with the columns. This defines a permutation matrix P = \begin{bmatrix} 0_{m\times n} & I_m \\ I_n & 0_{n\times m} \end{bmatrix} such that \begin{bmatrix} D & C \\ B & A \end{bmatrix} = P\begin{bmatrix} A & B \\ C & D \end{bmatrix}P^\top. Alternately, and perhaps more cleanly, one may define two Schur complements of the block matrix M = \begin{bmatrix} A & B \\ C & D \end{bmatrix}: one by “eliminating A“, M/A = D - CA^{-1}B, and the other by “eliminating D“, M/D = A - BD^{-1}C. Following the calculation in Eq. (3), just like the inverse of the Schur complement D - BA^{-1}C appears in the (2,2) entry of \begin{bmatrix} A & B \\ C & D \end{bmatrix}^{-1}, the inverse of the alternate Schur complement A - CD^{-1}B can be shown to appear in the (1,1) entry of \begin{bmatrix} A & B \\ C & D \end{bmatrix}^{-1}. Thus, comparing with Eq. (3), we deduce the Sherman-Morrison-Woodbury matrix identity:

(4)   \begin{equation*} (A - CD^{-1}B)^{-1} = A^{-1} + A^{-1}C(D-BA^{-1}C)^{-1}BA^{-1}. \end{equation*}

To see how this formula can be useful in practice, suppose that we have a fast way of solving the system linear equations Ax = b. Perhaps A is a simple matrix like a diagonal matrix or we have already pre-computed an LU factorization for A. Consider the problem of solving the rank-one updated problem (A+uv^\top)x = b. Using the Sherman-Morrison-Woodbury identity with C=u, D=-1, and B = v^\top, we have that

(5)   \begin{equation*} x = (A+uv^\top)^{-1}b = A^{-1}b + A^{-1}u (-1-v^\top A^{-1}u)^{-1}v^\top A^{-1}b, \end{equation*}

Careful observation of this formula shows how we can compute x (solving (A+uv^\top)x = b) by only solving two linear systems Ax_1 = b for x_1 = A^{-1}b and Ax_2 = u for x_2 = A^{-1}u.2Further economies can be saved if one has already previously computed x_1, which may be the case in many applications.

Here’s another variant of the same idea. Suppose we want solve the linear system of equation (D + uv^\top)x = b where D is a diagonal matrix. Then we can immediately write down the lifted system of linear equations

(6)   \begin{equation*} \underbrace{\begin{bmatrix} -1 & v^\top \\ u & D \end{bmatrix}}_{:=M}\begin{bmatrix} y \\ x \end{bmatrix} = \begin{bmatrix} 0 \\ b \end{bmatrix}. \end{equation*}

One can easily see that D+uv^\top is the Schur complement of the matrix M (with respect to the (1,1) block). This system of linear equations is sparse in the sense that most of its entries are zero and can be efficiently solved by sparse Gaussian elimination, for which there exists high quality software. Easy generalizations of this idea can be used to effectively solve many “sparse + low-rank” problems.

Another example of the power of the Schur complement are in least-squares problems. Consider the problem of minimizing \|Ax - b\|, where A is a matrix with full column rank and \|\cdot\| is the Euclidean norm of a vector \|x\|^2 = x^\top x. It is well known that the solution x satisfies the normal equations A^\top A x = A^\top b. However, if the matrix A is even moderately ill-conditioned, the matrix A^\top A will be much more ill-conditioned (the condition number will be squared), leading to a loss of accuracy. It is for this reason that it is preferable to solve the least-squares problem with QR factorization. However, if QR factorization isn’t available, we can use the Schur complement trick instead. Notice that A^\top A is the Schur complement of the matrix \begin{bmatrix} -I_{m} & A \\ A^\top & 0_{n\times n} \end{bmatrix}. Thus, we can solve the normal equations by instead solving the much better-conditioned system3More precisely, one should scale the identity in the (1,1) block of this system to be on the order of the size of the entries in A. If one selects a scale s which is lies in between A‘s largest and smallest singular values of A (for example s = \max_{i,j} |A_{ij}|) and constructs M = \begin{bmatrix} -sI_m & A \\ A^\top & 0_{n\times n}\end{bmatrix}, then one can show that the two-norm condition number of M no more than twice that of A.

(7)   \begin{equation*} \begin{bmatrix} -I_{m} & A \\ A^\top & 0_{n\times n} \end{bmatrix} \begin{bmatrix} r \\ x \end{bmatrix} = \begin{bmatrix} b \\ 0_n \end{bmatrix}. \end{equation*}

Not only is this system better-conditioned, but it’s also highly interpretable. Multiplying out the first block row gives the equation -r + Ax = b which simplifies to r = Ax - b. The unknown r is nothing but the least-squares residual. The second block row gives A^\top r = 0_n, which encodes the condition that the residual is orthogonal to the range of the matrix A. Thus, by lifting the normal equations to a large system of equations by means of the Schur complement trick, one derives an interpretable way of solving the least-squares problem by solving a linear system of equations, no QR factorization or ill-conditioned normal equations needed.

The Schur complement trick continues to have use in areas of more contemporary interest. For example, the Schur complement trick plays a central role in the theory of sequentially semiseparable matrices which is a precursor to many recent developments in rank-structured linear solvers. I have used the Schur complement trick myself several times in my work on graph-induced rank-structures.

Upshot: The Schur complement appears naturally when one does (block) Gaussian elimination on a matrix. One can also run this process in reverse: if one recognizes a matrix expression (involving a product of matrices potentially added to another matrix) as being a Schur complement of a larger matrix , one can often get considerable dividends by writing this larger matrix down. Examples include a proof of the Schur-Morrison-Woodbury matrix identity (see Eqs. (3-4)), techniques for solving a low-rank update of a linear system of equations (see Eqs. (5-6)), and a stable way of solving least-squares problems without the need to use QR factorization (see Eq. (7)).