# Differentiation Matrix In DG-FEM - Hesthaven/Warburton

In the book of Hesthaven and Warburton on discontinual Galerkin methods the authors give motivation to the differentiation matrix (page 52), referred to as $$D_r(i,j)=\frac{dl_j}{dr}|_{r_i}$$ where $$l_i(r) = \prod_{j=1 \\ j\neq i} \frac{r - \xi_j}{\xi_i - \xi_j}$$ a base-vector of the Lagrangian polynomial base.

They say that the following equation motivates this definition:

$$u_h(r)=\sum_{n=1}^{N_p}\hat{u}\tilde{P}_{n-1}(r)=\sum_{n=1}^{N_p}u(r_i)l_i(r)$$

where the first sum is a linear combination of the orthonormal Legendre-polynomial basis and (I suspect) the second sum gives the same polynomial with respect to the Lagrange basis. They say that in the equation above $$D_r$$ is the operator that transforms point values, $$u(r_i)$$, to derivatives at these same points (e.g. $$u_h'=D_ru_h$$). Sadly, I do not see the connection there.

What follows are some manipulation of which I do not grasp the disappearance of the sum in the integral $$(MD_r)_{ij}= \sum_{n=1}^{N_p} M_{in}D_r(n,j)= \sum_{n=1}^{N_p}\int_{-1}^1l_i(r)l_n(r)\frac{dl_j}{dr}|_{r_n}dr \\= \int_{-1}^1l_i(r)\sum_{n=1}^{N_p}l_j(r)\frac{dl_j}{dr}|_{r_n}l_n(r)dr=\int_{-1}^1 l_i(r)\frac{dl_j(r)}{dr}dr=S_{ij}$$

So the use of $$\sum_{n=1}^{N_p}l_j(r)\frac{dl_j}{dr}|_{r_n} l_n(r) = \frac{dl_j(r)}{dr}$$ is not clear to me.

Taking your questions in order, the definition of $$D_r$$ as the operator converting the nodal values of $$u_h$$ into derivatives follows immediately from the definition, although the notation is a little inexact,: $$u_h(r) = \sum_i u(r_i)l_i(r)$$ hence $$\frac{du_h}{dr} = \sum_j u(r_j)\frac{dl_j}{dr}$$
$$\left.\frac{du_h}{dr}\right|_{r_i} = \sum_j u(r_j)\left.\frac{dl_j}{dr}\right|_{r_i} = \sum D_{ij}u(r_j)=[Du_h]_i$$ where we've made free use of the fact that $$u_h=u$$ at the node points, and that we can view the node data as a finite dimensional vector and $$D$$ as a matrix-style operator.
The second identity, $$\sum_n \left.\frac{dl_j}{dr}\right|_{r_n} l_n(r) = \frac{dl_j}{dr}$$ can either be argued from the order of the polynomials involved, (the derivative of an $$N_p$$ polynomial is order $$N_p-1$$, so it must have an exact representation in the nodal basis, which is what we just wrote down) or again shown directly: $$\frac{dl_j}{dr} = \sum_n \frac{1}{r_j-r_k}\prod_{k\neq n,k\neq j}\frac{r-r_k}{r_j-r_k},$$ $$\qquad = \sum_n \frac{1}{r_j-r_k}\prod_{k\neq n,k\neq j}\frac{r_n-r_k}{r_j-r_k}\prod_{k\neq n}\frac{r-r_k}{r_n-r_k},$$ $$\qquad = \sum_n \left.\frac{dl_j}{dr}\right|_{r_n} l_n(r).$$