$$
\newcommand{\half}{\frac{1}{2}}
\newcommand{\tp}{\thinspace .}
\newcommand{\uex}{{u_{\small\mbox{e}}}}
\newcommand{\normalvec}{\boldsymbol{n}}
\newcommand{\x}{\boldsymbol{x}}
\newcommand{\X}{\boldsymbol{X}}
\renewcommand{\v}{\boldsymbol{v}}
\newcommand{\V}{\boldsymbol{V}}
\newcommand{\dfc}{\alpha}  % diffusion coefficient
\newcommand{\If}{\mathcal{I}_s}     % for FEM
\newcommand{\Ifb}{{I_b}}  % for FEM
\newcommand{\sequencei}[1]{\left\{ {#1}_i \right\}_{i\in\If}}
\newcommand{\sequencej}[1]{\left\{ {#1}_j \right\}_{j\in\If}}
\newcommand{\basphi}{\varphi}
\newcommand{\baspsi}{\psi}
\newcommand{\refphi}{\tilde\basphi}
\newcommand{\sinL}[1]{\sin\left((#1+1)\pi\frac{x}{L}\right)}
\newcommand{\xno}[1]{x_{#1}}
\newcommand{\yno}[1]{y_{#1}}
\newcommand{\dX}{\, \mathrm{d}X}
\newcommand{\dx}{\, \mathrm{d}x}
\newcommand{\ds}{\, \mathrm{d}s}
\newcommand{\Real}{\mathbb{R}}
$$
    
Summary 
 -  When approximating \( f \) by \( u = \sum_j c_j\basphi_j \), the least squares
   method and the Galerkin/projection method give the same result.
   The interpolation/collocation method is simpler and yields different
   (mostly inferior) results.
 
 -  Fourier series expansion can be viewed as a least squares or Galerkin
   approximation procedure with sine and cosine functions.
 
 -  Basis functions should optimally be orthogonal or almost orthogonal,
   because this gives little round-off errors when solving the linear
   system, and the coefficient matrix becomes diagonal or sparse.
 
 -  Finite element basis functions are piecewise polynomials, normally
   with discontinuous derivatives at the cell boundaries. The basis
   functions overlap very little, leading to stable numerics and sparse
   matrices.
 
 -  To use the finite element method for differential equations, we use
   the Galerkin method or the method of weighted residuals
   to arrive at a variational form. Technically, the differential equation
   is multiplied by a test function and integrated over the domain.
   Second-order derivatives are integrated by parts to allow for typical finite
   element basis functions that have discontinuous derivatives.
 
 -  The least squares method is not much used for finite element solution
   of differential equations of second order, because
   it then involves second-order derivatives which cause trouble for
   basis functions with discontinuous derivatives.
 
 -  We have worked with two common finite element terminologies and
   associated data structures
   (both are much used, especially the first one, while the other is more
   general):
 
    -  elements, nodes, and mapping between local and global
       node numbers
 
    -  an extended element concept consisting of cell, vertices,
       degrees of freedom, local basis functions,
       geometry mapping, and mapping between
       local and global degrees of freedom
 
 -  The meaning of the word "element" is multi-fold: the geometry of a finite
   element (also known as a cell), the geometry and its basis functions,
   or all information listed under point 2 above.
 
 -  One normally computes integrals in the finite element method element
   by element (cell by cell), either in a local reference coordinate
   system or directly in the physical domain.
 
 -  The advantage of working in the reference coordinate system is that
   the mathematical expressions for the basis functions depend on the
   element type only, not the geometry of that element in the physical
   domain.  The disadvantage is that a mapping must be used, and
   derivatives must be transformed from reference to physical
   coordinates.
 
 -  Element contributions to the global linear system are collected in
   an element matrix and vector, which must be assembled into the
   global system using the degree of freedom mapping (
dof_map) or
   the node numbering mapping (elements), depending on which terminology
   that is used. 
 -  Dirichlet conditions, involving prescribed values of \( u \) at the
   boundary, are mathematically taken care of via a boundary function that takes
   on the right Dirichlet values, while the basis functions vanish at
   such boundaries. The finite element method features a general
   expression for the boundary function. In software implementations,
   it is easier to drop the boundary function and the requirement that
   the basis functions must vanish on Dirichlet boundaries and instead
   manipulate the global matrix system (or the element matrix and vector)
   such that the Dirichlet values are imposed on the unknown parameters.
 
 -  Neumann conditions, involving prescribed values of the derivative
   (or flux) of \( u \), are incorporated in boundary terms arising from
   integrating terms with second-order derivatives by part.
   Forgetting to account for the boundary terms implies the
   condition \( \partial u/\partial n=0 \) at parts of the boundary where
   no Dirichlet condition is set.