# What are all these functions in FEM? Shape function vs Basis Function vs Trial Function vs Test Function vs Interpolation Function

I am a novice in FEM. I have some experience with FDM which was pretty straight forward. Since I have a confusion with a number of concepts, I will try to break them down by writing down what I have understood and what the confusion. Sorry if the question is too long.

Firstly, all the FEM textbooks start off by saying its a method used to solve PDEs, etc and then directly goes on to using linear spring as an element and derivation of stiffness matrix without mentioning anything about the said PDEs. This is really confusing.

1. If I understand correctly, the solution to the given problem is talked about either in terms of within an element or the solution throughout the entire computational domain(the actual solution). The Shape functions come into play with-in an element. It approximates the "shape" of the solution within that element. It interpolates the solution values at node points throughout an element and it is what defines an element.

• Are shape functions and interpolation functions the same thing?

• Are there one shape function for each of the node points?

• Are the value of the shape function unity for a particular node point and zero at other node points? (I am asking because there is a confusion with Shape function and Basis function, with some explanation stating basis function has a value of unity at node points. Ref: https://www.comsol.com/multiphysics/finite-element-method)

2. Basis functions come to play when we are stating the solution throughout the computational domain as a linear combination of the basis function. This states the solution at the global level (entire computational domain). How is it brought down to the element level from the global level? ie how are basic functions and the shape functions related? (because once the explanation of basis function begins there is no mention of shape function, which makes me suspect the basis function that was used at the global level in the weighted residual method is same as the shape function at the element level in the FEM.)

• Are basis functions and trial functions the same thing?

• Are trial function and test functions the same thing?

• What is the difference between basis function and shape function?

3. Just to get clarity between FDM and FEM: In FDM we replace the derivatives with a finite difference equation, i.e., we approximate the given differential equation itself but in FEM we try to approximate the solution to the differential equation. Is my understanding correct?

• Although @Paul already gave you a great answer, I would suggest that you split your question into several posts so you can get better answers. – nicoguaro Jun 1 '19 at 17:57
• "Firstly, all the FEM textbooks start off by saying its a method used to solve PDEs, etc and then directly goes on to using linear spring as an element and derivation of stiffness matrix without mentioning anything about the said PDEs. This is really confusing." That is not true. Probably, you have seen books with Mechanics/Civil Engineering in mind. – nicoguaro Jun 1 '19 at 17:58
• @nicoguaro I wanted one place where to find these answers and maybe branch off from here as you have suggested. Yes, I have been referring to a book which is more inclined towards the mechanical engineers. – GRANZER Jun 2 '19 at 5:54

This confused me a lot as well when I was first studying FEM. They are often used interchangeably, but they are not necessarily all the same.

Trial Functions vs Test Functions

I think of it as if there are two spaces on which we are doing interpolation. First is the “input space”, which is the space where the solution u exists. Secondly is the “output space”, which is the space where the solutions are mapped to using the PDE, which can be written in abstract form as $$Au=f$$, where $$A$$ is a differential operator.

You may be asking why it is important to make this distinction. As it turns out, trial and test functions serve two different purposes. In FEM, we construct an approximate solution using a linear combination of functions in the input space. These are called trial functions. The coefficients of this linear combination are what we want to solve for using FEM.

But in order to determine the coefficients, we need to impose orthogonality conditions in the output space. Think of the “exact” solution of the PDE as a single point in an infinite dimensional space. Think of the mapping of the approximate solution (via $$A$$) as a finite dimensional plane in the output space. Ultimately, the solution we seek in the finite dimensional output space is the one closest to the exact solution in the infinite dimensional space. It’s like finding the point in the plane closest to the point in 3D space. The closest solution is the one along the line perpendicular to the plane. So, we determine the coefficients by enforcing orthogonality with respect to the plane, which is the same as enforcing orthogonality with respect to each basis function defining the plane.

There is no one way to define the set of basis functions that make up the output space. In the standard finite element method (Bubnov-Galerkin method), you use the exact same functions to define both the input space and output space.

But this is not the only way to do it. You can use different basis functions to define the input and output spaces (Petrov-Galerkin method). In some situations, the Petrov-Galerkin method provides a better approximation than the standard method. The only cases where I’ve experienced this is with the 1st order wave equation, but I think it also works well for any PDE with odd order derivatives.

Basis function is a catch-all term for functions used to define a function space. I’ve heard it applied to the trial (input) or test (output) spaces, but I’ve also heard it applied to interpolation functions used on a reference element, so the confusion is understandable.

Generally speaking, the basis functions (i.e. in the input space) can interpolate the solution across the entire domain. In practice, this is not a good strategy because it would yield a dense matrix system of equations. It’s better to limit the basis functions to be zero almost everywhere except in small regions. Thus, even though the functions can interpolate globally, it’s better to limit each function to interpolate locally. Often, we want both the global and reference element functions to be equal to one at node points for convenience sake (but this is not the only way to do it).

Specifically, we can choose global basis functions that interpolate linearly, quadratically, etc. across each element. Within each element, we can choose functions that have the same basic shape. In doing so, we can perform integration on a reference element and map the results to each specific element. This also allows us to automate the assembly of the system of equations.

I usually use shape function to refer to the functions used to interpolate within a reference element, rather than the functions used to interpolate globally in the domain of the problem.

You are correct about the Finite Difference Method, but not FEM. FEM uses a projection of solutions onto finite dimensional function spaces using a different notion of orthogonality that applies to function spaces specifically. For more on this topic, see my other answer on the motivation behind the galerkin method.

Is there only one basis function for each node in the mesh? If you’re using nodal basis functions (e.g. using lagrange interpolation), then yes. However, each function is defined in a piecewise manner so that there is a unique expression within each element. From the reference element perspective, it would seem as though there is only one function for each node in the reference element.

However, nodal basis functions are not the only possible choice. Modal basis functions can also be used in FEM (see spectral element methods for more details).

• Would I be correct in thinking that in the Galerikin method we state the solution as a linear combination of $basis functions$ ( the premise of the galerikin method is to state that the solution belongs to the finite function space, which is a subset infinite dimensional function space and as you have explained in your motivation behind Galerkin method post, use the orthogonality condition to get the coefficients.). But, Galerikin method gives the global solution using the basis functions and this would yield a very dense matrix. So we use the .... – GRANZER Jun 2 '19 at 4:26
• ... ideas of the Galerikin method in FEM ie instead of giving the solution globally we state it locally ..within an element. So within an element, we don't have shape functions which are used as the basis function? I am not understanding how the global basis function and the local shape functions are related (or are they even related?). – GRANZER Jun 2 '19 at 4:33
• @GRANZER: They are almost the same. Products of global basis functions (or their derivatives) are what we really want to integrate. Shape functions are representations of global basis functions onto a reference element so that we can automate calculating the integrals. – Paul Jun 2 '19 at 5:26
• So, (not a mathematically rigorous statement) saying that if we put together all the local/elementary basis function (this is the shape function right?) of all the elements in the domain gives us global shape function (the one we are looking for). Going the other way around we can state the shape functions are like pieces/parts of the global basis function... – GRANZER Jun 2 '19 at 5:43
• @GRANZER: I prefer to think of the reference element as a fictitious element of a fixed size and thus with fixed basis functions. The elements in the mesh may have varying sizes or sizes not equal to the reference element (thus needing unique basis functions for each element). We use a calculus trick (substitution for multiple integrals using the jacobian) to calculate the integrals of the global basis functions in the mesh elements using integrals in the reference element using the reference element basis functions (these are what I would call shape functions). – Paul Jun 2 '19 at 14:22