# How to derive the Weak Formulation of a Partial Differential Equation for Finite Element Method?

I have taken a basic introduction to Finite Element Method, which did not emphasize a sophisticated understanding of a 'weak formulation'. I understand that with the galerkin method, we multiply both sides of the (elliptical) PDE by a test function and then integrate (by parts or by Divergence theorem). Sometimes, I have needed to integrate by parts twice before arriving at the appropriate weak formulation (based upon the answer in the back of the book). But when I try to apply the same concept to other PDE's (lets say, they are still time-independent), I can't seem to recognize when the formulation is appropriate for discretization. Is there any 'red flag' that can tell me that THIS FORM can be discretized into a linear system of equations?

Furthermore, how do I choose an appropriate set of basis functions?

First, how does the integration by parts affect the solvability of the problem, and the space of solutions?

Second, for which space of functions can you build a series of subspaces (the ansatz functions) that you can implement?

Let us regard the Poisson problem $u'' = f$ for $f \in L^2$, say, on $[0,1]$, with homogenous Dirichlet boundary conditions. By integration, the left and the right side of the equation can be regarded as bounded functionals on $L^2$, say for $\phi \in L^2$ we have

$\phi \mapsto \int u'' \phi dx$ and $\phi \mapsto \int f \phi dx$

Since any function in $L^2$ can be $L^2$-approximated by smooth functions with compact support, both integral functionals are completely known if you only know the values for all test functions. But with the test functions, you can perform integration by parts, and transform the left-hand side to the functional

$\phi \mapsto -\int u' \phi' dx$

Read this as: "I take a test function $\phi$, compute its differential, and integrate it with -u' over [0,1], and return you the result." But that functional is not defined and bounded on $L^2$, since you cannot take the differential of an arbitrary $L^2$ function. They may look extremely strange in general.

Still we observe, that this functional can be extended to the Sobolev space $H^1$, and it is even a bounded functional on $H_0^1$. That means, given $\phi \in H_0^1$, you can roughly estimate the value of $\int -u' \phi' dx$ by a multiple of the $H_0^1$-norm of $\phi'$. And, furthermore, the functional $\phi \mapsto \int f \phi dx$ is, of course, not only defined and bounded on $L^2$, but also defined and bounded on $H_0^1$.

Now you can, e.g., apply the Lax-Milgram lemma, as it is presented in any PDE-book. A finite element book which describes it as well, only with functional analysis, is e.g. the classic by Ciarlet, or the rather new book by Braess.

The Lax-Milgram lemma gives PDE-people a nice tool for pure analysis, but they employ much stranger tools as well for their purpose. Still, these tools are also relevant for numerical analysits, because you can in fact build a discretization for these spaces.

For example, in order to have discrete subspace of $H_0^1$, just take the hat functions. They do not have jumps and are piecewise differentiable. Their differential is a piecewise constant vector field. This construction works in $d=1,2,3,...$, which is fine, but can you come up with an ansatz space whose functions not only have a gradient (that is nice,i.e., square-integrable), but also whose gradients have in turn a divergence? (again, square-integrable). That is pretty hard in general.

So the reason in general how you build weak formulations is that you want to apply the Lax-Milgram lemma, and to have a formulation such that the functions can in fact be implemented. ( For the record, neither is Lax-Milgram the last word in that context, nor are $H_0^1$ ansatz spaces the last word in discretization, see, e.g., Discontinuous Galerkin methods. )

For the case of mixed boundary conditions, the natural test space may differ from your your search space (in the analytic setting), but I have no idea how to describe that without referring to distribution theory, so I stop here. I hope this is helpful.

• While this seems to be an excellent answer, my ordinary brain (practising engineer) cannot understand the mathematical rigour (and the terms/lemmas etc used). I'd like a more layman's explanation of the weak form. Jan 2, 2020 at 18:40
• Can you please guide me on how to analyze the following PDE $u_t+c u_x= \frac{-c}{x}u$? How would I try a weak formulation ? Jun 20, 2022 at 16:17