Understand 1D FEM solution using quadratics elements I'm a bit confused about applying the FEM using piecewise linear functions.
I think I get understand how to use linear functions. We use the hat function for each element and the solution is 
$$u_h(x) = \sum_{j=0}^M u_j \phi_j(x) $$ where $\phi_j(x)$ is the hat function for each element and the $u_j$ are obtained by solving a matrix system $Au=f$ where $A$ is the stiffness matrix and $f$ is the load vector.
Now for the problem I have, I am given a 1d quadratic reference element on $[-1,1]$ with nodes $\xi_1 = -1, \xi_2=0$ and $\xi_3$ and shape functions $$\psi_1(\xi) = \frac{1}{2}\xi(\xi-1),\;\;\;\psi_2(\xi) = (1+\xi)(1-\xi),\;\;\;\psi_3(\xi) = \frac{1}{2}\xi(\xi+1). $$
which satisfy $\psi_p(\xi_q)=\delta_{pq}$ for $p,q\in\{1,2,3\}$. Then we are given local and global nodes and other stuff.
I have solved parts of the question where I had to transform each element to use the reference element but am missing the bigger picture. 
The part I don't understand is about these quadratic reference elements. Why do I have 3 functions now instead of 1 from the linear case? and what is the solution given by now after I solve the equation for the stiffness matrix and load vector because I have 3 functions? 
Any help on understand this would be greatly appreciated. Thanks a lot.
 A: This question doesn't have anything to do with finite difference methods, but you probably got the attention of the right people anyway. I think you're missing the idea that you actually have 2 functions in the linear case, not just 1. The "hat function" is really something that arises when you plot the basis functions globally. These are derived from a similar reference element as well though:
Given a 1d linear reference element on $[-1, 1]$, and nodes $\xi_1 = -1, \xi_2 = +1$, with shape functions:
$$ 
\psi_1(\xi)=-\frac{1}{2}(\xi-1) \quad \psi_2(\xi)=\frac{1}{2}(\xi+1)
$$
This set of functions also satisfies the "partition of unity" requirement, just like the quadratic shape functions. The hat functions $\phi_j$ are really just these shape functions mapped from the reference element to the problem domain.
The only change when you go from linear to quadratic elements is that you now are using 3 nodal values and 3 shape functions to interpolate solutions over the rest of the element rather than 2 of each.
Interpolating solutions is exactly the same once you realize this.
1) Locate the element that contains $x$
2) Find the value of $\xi$ corresponding to the value of $x$ within that element
3) Interpolate using the shape functions:
$$
u(x)=\sum_{i=1}^N u_i \psi_i(\xi)
$$
where $N$ is the number of nodes in the element and $i$ is the local, not global, index number.
In practice, it is difficult (and unnecessary) to obtain analytical forms of the shape functions in global coordinates, especially when you move to higher dimensions. For this reason, when people say "shape function", they are almost invariably referring to the shape function in the reference element coordinates, so you don't really need a $\phi(x)$ function like you were thinking.
A: Any function $f$ at your quadratic element is interpolated with finite element shape functions, where $(1,2,3)$ are the the nodes (three of them, from the left to the right):
$$f(\xi) = \frac{1}{2}\xi(\xi-1) f_1 + (1-\xi^2)f_2 + \frac{1}{2}\xi(\xi+1) f_3$$
This is equivalent with a finite difference representation:
$$f(\xi) = f_2 + \frac{1}{2}(f_3 - f_1) \xi + \frac{1}{2}(f_3 - 2 f_2 + f_1) \xi^2$$
Where discretizations of the zero'th, first and second derivative are recognized.
Your local nodes obey the same equations, due to isoparametrics:
$$z = z_2 + \frac{1}{2}(z_3 - z_1) \xi + \frac{1}{2}(z_3 - 2 z_2 + z_1) \xi^2$$
Therefore if $\,z_2 = (z_1 + z_3)/2$ , as you say, then $z_3 - 2 z_2 + z_1 = 0$.
With other words: the quadratic term simply drops out and what we finally have is the same linear element as before.
Due to isoparametrics, the same is valid for any $\,f$, resulting in:
$$f_2 = \frac{f_1 + f_3}{2} \quad ; \quad 
f(\xi) = f_2 + \frac{1}{2}(f_3 - f_1) \xi =
\frac{1}{2}(1-\xi) f_1 + \frac{1}{2}(1+\xi) f_3$$
So it's my theory that, e.g. with an equidistant grid, quadratic elements aren't useful. But I have a personal bias towards linear elements, admittedly :-)
