Introduction

Consider a scalar (complex) polynomial P(x) of degree n and a basis given by \(\{B_0(x), B_1(x), \ldots , B_{n-1}(x), B_n(x)\}\). This basis determines the representation \(P(x)=\sum _{j=0}^n a_jB_j(x)\), where \(a_j \in \mathcal {C}\) and, regardless of the basis, the coefficient of \(x^n\) in the expression is nonzero. Alternatively, this polynomial can be written as

$$\begin{aligned} P(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {I}}\left[ \begin{array}{ccccc}B_0(x)\\ B_1(x)\\ \vdots \\ B_{n-1}(x)\\ B_n(x)\end{array}\right] , \end{aligned}$$
(1.1)

where \(\mathbf {I}\) is the unit matrix of size \(n+ 1\).

We want to find a matrix \(\mathbf {D}\), the differentiation matrix, of size \(n+ 1\) such that the kth order derivative of P(x), shown by \({\rm d}^kP(x)\over {\rm d}x^k\) or \(P^{(k)}(x)\), can be written as

$$\begin{aligned} P^{(k)}(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {D}}^k\left[ \begin{array}{ccccc}B_0(x)\\ B_1(x)\\ \vdots \\ B_{n-1}(x)\\ B_n(x)\end{array}\right] . \end{aligned}$$
(1.2)

For a polynomial of degree n, \(\mathbf {D}\) has to be a nilpotent matrix of degree \(n+1\).

\(\mathbf {D}\) has a well-known structure and can be easily found for the monomial basis. For convenience, let us assume \(n = 5\) and the generalizations for all positive n will be clear. If

$$\begin{aligned} P(x)= \left[ \begin{array}{cccccc}a_0&a_1&a_2&a_3&a_4&a_5\end{array}\right] {\mathbf {I}}\left[ \begin{array}{cccccc}1\\ x\\ x^2\\ x^3\\ x^4\\ x^5\end{array}\right] , \end{aligned}$$
(1.3)

then

$$\begin{aligned} {\mathbf {D}}= \left[ \begin{array}{cccccc} 0&{}0&{}0 &{}0 &{}0 &{}0\\ 1&{}0&{}0&{} 0 &{} 0&{}0 \\ 0&{}2&{}0&{} 0 &{} 0&{}0\\ 0&{}0&{}3&{} 0 &{} 0&{}0\\ 0&{}0&{}0&{} 4 &{} 0&{}0\\ 0&{}0&{}0&{} 0 &{} 5&{}0\end{array}\right] . \end{aligned}$$
(1.4)

Differentiation in bases other than the monomial basis has been occasionally studied. One of the most important applications of polynomial differentiation in other bases is in spectral methods like collocation method [14]. Differentiation matrices for Chebyshev and Jacobi polynomials were computed [13]. The differentiation of Jacobi polynomials through Bernstein basis was studied [12]. Chirikalov [2] computed the differentiation matrix for the Hermite basis.

In this paper, we present explicit formulas for \(\mathbf {D}\) in different polynomial bases. Constructing \(\mathbf {D}\) is fairly straightforward and having \(\mathbf {D}\), we can easily find derivatives of higher order by raising \(\mathbf {D}\) to higher powers accordingly. Another important advantage of having a formula for \(\mathbf {D}\) in a basis is that we do not need to change the basis—often to the monomial basis— to differentiate P(x). Conversion between bases has been exhaustively studied in [6], but it can be unstable [8].

Section “Degree-graded bases” of this paper considers degree-graded bases and finds \(\mathbf {D}\) in general for them. Orthogonal bases are all among degree-graded bases. Section “Degree-graded bases” then discusses other important special cases such as the monomial and Newton bases as well as the Hermite basis. Section “Bernstein basis” and “Lagrange basis” concern the Bernstein and Lagrange bases, respectively, and find \(\mathbf {D}\) for them.

The Bernstein (Bézier) basis and the Lagrange basis are most useful in computer-aided geometric design (see [5], for example). For some problems in partial differential equations with symmetries in the boundary conditions Legendre polynomials can be successfully used the most natural. Finally, in approximation theory, Chebyshev polynomials have a special place due to their minimum-norm property (see e.g., [11]).

Degree-graded bases

Real polynomials \(\{\phi _n(x)\}_{n=0}^{\infty }\) with \(\phi _n(x)\) of degree n which are orthonormal on an interval of the real line (with respect to some nonnegative weight function) necessarily satisfy a three-term recurrence relation (see Chapter 10 of [3], for example). These relations can be written in the form

$$\begin{aligned} x \phi _j(x)=\alpha _j \phi _{j+1}(x) +\beta _j \phi _j(x) + \gamma _j\phi _{j-1}(x), \quad \quad j=0,1,2,\ldots , \end{aligned}$$
(2.1)

where the \(\alpha _j,\;\beta _j,\;\gamma _j\) are real, \(\alpha _j\ne 0\), \(\phi _{-1}(x)\equiv 0\), \(\phi _0(x)\equiv 1\).

The choices of coefficients \(\alpha _j,\;\beta _j,\;\gamma _j\) defining three well-known sets of orthogonal polynomials (associated with the names of Chebyshev and Legendre) are summarized in Table 1.

Table 1 Three well-known orthogonal polynomials

Orthogonal polynomials have well-established significance in mathematical physics and numerical analysis (see e.g., [7]). More generally, any sequence of polynomials \(\{\phi _j(x)\}_{j=0}^{\infty }\) with \(\phi _j(x)\) of degree j is said to be degree-graded and obviously forms a linearly independent set; but is not necessarily orthogonal.

A scalar polynomial of degree n can now be written in terms of a set of degree-graded polynomials \(P(x)=\sum _{j=0}^n a_j\phi _j(x)\), where \(a_j \in \mathcal {C}\) and \(a_n\ne 0\). We can then write

$$\begin{aligned} P(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {I}}\left[ \begin{array}{ccccc}\phi _0(x)\\ \phi _1(x)\\ \vdots \\ \phi _{n-1}(x)\\ \phi _n(x)\end{array}\right] . \end{aligned}$$
(2.2)

Lemma 1

If P(x) is given by (2.2), then

$$\begin{aligned} P^{(k)}(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {D}}^k\left[ \begin{array}{ccccc}\phi _0(x)\\ \phi _1(x)\\ \vdots \\ \phi _{n-1}(x)\\ \phi _n(x)\end{array}\right] , \end{aligned}$$
(2.3)

where

$$\begin{aligned} {\mathbf {D}}= \left[ \begin{array}{cccc} 0&{}0&{}\ldots &{}0\\ &{} &{} &{} \vdots \\ &{} {\mathbf {Q}}&{}&{} \\ &{} &{} &{}0\end{array}\right] . \end{aligned}$$
(2.4)

\(\mathbf {Q}\) is a size n lower triangular matrix that has the following structure for \(i= 1, \ldots , n\).

$$\begin{aligned} q_{i, j}= \left\{ \begin{array}{cl} \frac{i}{\alpha _{i-1}}, &{} i=j\\ \frac{1}{\alpha _{i-1}}((\beta _{j-1}-\beta _{i-1})q_{i-1, j}+ \alpha _{j-2}q_{i-1, j-1}+ \gamma _j q_{i-1, j+1}- \gamma _{i-1}q_{i-2, j}). &{} i>j \end{array}\right. \end{aligned}$$
(2.5)

Any entry, q, with a negative or zero index is set to 0 in the above formula.

Proof

We start by differentiating (2.1) to get

$$\begin{aligned} \phi _j(x)=\alpha _j \phi _{j+1}'(x) +(\beta _j- x) \phi _j'(x) + \gamma _j\phi _{j-1}'(x), \quad \quad j=0,1,\ldots . \end{aligned}$$
(2.6)

We can write this equation in a matrix-vector form. Without loss of generality, we assume \(n=4\).

$$\begin{aligned} \left[ \begin{array}{ccccc}1&{}0&{}0 &{}0 &{}0 \\ 0&{}1&{}0&{} 0 &{} 0 \\ 0&{}0&{}1&{} 0 &{} 0\\ 0&{}0&{}0&{} 1 &{} 0\\ 0&{}0&{}0&{} 0 &{} 0\end{array}\right] \left[ \begin{array}{ccccc}\phi _0(x)\\ \phi _1(x)\\ \phi _2(x)\\ \phi _3(x)\\ \phi _4(x)\end{array}\right] = \left[ \begin{array}{ccccc} 0&{}\alpha _0&{}0&{} 0 &{} 0\\ {} \gamma _1&{}\beta _1-x&{}\alpha _1&{} 0 &{} 0\\ 0&{}\gamma _2&{}\beta _2-x&{} \alpha _2 &{} 0\\ 0&{}0&{} \gamma _3 &{} \beta _3-x&{} \alpha _3\\ 0&{}0&{}0&{} 0 &{} 0\end{array}\right] \left[ \begin{array}{ccccc}\phi _0'(x)\\ \phi _1'(x)\\ \phi _2'(x)\\ \phi _3'(x)\\ \phi _4'(x)\end{array}\right] . \end{aligned}$$
(2.7)

Given that \(\phi _0'(x)= 0\) and \(\phi _4(x)\) does not appear in the system, we can eliminate them and rewrite the above system as

$$\begin{aligned} \left[ \begin{array}{cccc}\phi _0(x)\\ \phi _1(x)\\ \phi _2(x)\\ \phi _3(x)\end{array}\right] = {\mathbf {H}} \left[ \begin{array}{cccc}\phi _1'(x)\\ \phi _2'(x)\\ \phi _3'(x)\\ \phi _4'(x)\end{array}\right] , \end{aligned}$$
(2.8)

where

$$\begin{aligned} {\mathbf {H}}= \left[ \begin{array}{cccc} \alpha _0&{} 0 &{} 0 &{} 0\\ \beta _1-x&{}\alpha _1&{} 0 &{} 0\\ \gamma _2&{}\beta _2-x&{} \alpha _2&{} 0\\ 0&{} \gamma _3 &{} \beta _3-x&{} \alpha _3\end{array}\right] . \end{aligned}$$
(2.9)

Since \(\alpha _i\ne 0\), \({\mathbf {H}}^{-1}\) exists and is a lower triangular matrix that has the following row structure in general for \(i= 1, \ldots , n\).

$$\begin{aligned} h^{(*)}_{i, j}= \left\{ \begin{array}{cl} \frac{1}{\alpha _{i-1}}, &{} j= i\\ \frac{x-\beta _j}{\alpha _{j-1}}(h^{(*)}_{i, j+1})- \frac{\gamma _{j+1}}{\alpha _{j-1}}(h^{(*)}_{i, j+2}), &{} j=(i-1), \ldots , 1 \end{array}\right. \end{aligned}$$
(2.10)

Now

$$\begin{aligned} \left[ \begin{array}{cccc}\phi _1'(x)\\ \phi _2'(x)\\ \phi _3'(x)\\ \phi _4'(x)\end{array}\right] = {\mathbf {H}}^{-1} \left[ \begin{array}{cccc}\phi _0(x)\\ \phi _1(x)\\ \phi _2(x)\\ \phi _3(x)\end{array}\right] . \end{aligned}$$
(2.11)

It is obvious from (2.10) that the variable, x, appears in entries of \({\mathbf {H}}^{-1}\). Through a fairly straightforward, but rather tedious process and using (2.1) to eliminate x from \({\mathbf {H}}^{-1}\), we get \(\mathbf {Q}\) as given by (2.5), and we have

$$\begin{aligned} \left[ \begin{array}{cccc}\phi _1'(x)\\ \phi _2'(x)\\ \phi _3'(x)\\ \phi _4'(x)\end{array}\right] = {\mathbf {Q}} \left[ \begin{array}{cccc}\phi _0(x)\\ \phi _1(x)\\ \phi _2(x)\\ \phi _3(x)\end{array}\right] . \end{aligned}$$
(2.12)

From there, adding a \(\mathbf {0}\) row and a \(\mathbf {0}\) column, we find \(\mathbf {D}\) and have

$$\begin{aligned} \left[ \begin{array}{ccccc}\phi _0'(x)\\ \phi _1'(x)\\ \phi _2'(x)\\ \phi _3'(x)\\ \phi _4'(x)\end{array}\right] = \left[ \begin{array}{cccc} 0&{}0&{}\ldots &{}0\\ &{} &{} &{} \vdots \\ &{} \begin{array}{l} {\mathbf {Q}} \end{array}&{}&{} \\ &{} &{} &{}0\end{array}\right] \left[ \begin{array}{ccccc}\phi _0(x)\\ \phi _1(x)\\ \phi _2(x)\\ \phi _3(x)\\ \phi _4(x)\end{array}\right] . \end{aligned}$$
(2.13)

Using these results, we can write the first derivative of a generic first kind Chebyshev polynomial of degree 4 (see Table 1) as

$$\begin{aligned} P'(x)= \left[ \begin{array}{ccccc}a_0&a_1&a_2&a_{3}&a_4\end{array}\right] \left[ \begin{array}{ccccc} 0&{} 0&{}0&{} 0 &{} 0\\ 1&{}0&{}0&{} 0 &{} 0\\ 0&{}4&{}0&{}0 &{} 0\\ 3&{}0&{}6 &{} 0&{} 0\\ 0&{}8&{}0&{} 8 &{} 0\end{array}\right] \left[ \begin{array}{ccccc}T_0(x)\\ T_1(x)\\ T_2(x)\\ T_3(x)\\ T_4(x)\end{array}\right] . \end{aligned}$$
(2.14)

Similarly, for a second kind Chebyshev polynomial of degree 4, we can write the first derivative as

$$\begin{aligned} P'(x)= \left[ \begin{array}{ccccc}a_0&a_1&a_2&a_{3}&a_4\end{array}\right] \left[ \begin{array}{ccccc} 0&{} 0&{}0&{} 0 &{} 0\\ 2&{}0&{}0&{} 0 &{} 0\\ 0&{}4&{}0&{}0 &{} 0\\ 2&{}0&{}6 &{} 0&{} 0\\ 0&{}4&{}0&{} 8 &{} 0\end{array}\right] \left[ \begin{array}{ccccc}U_0(x)\\ U_1(x)\\ U_2(x)\\ U_3(x)\\ U_4(x)\end{array}\right] . \end{aligned}$$
(2.15)
$$\begin{aligned} P'(x)= \left[ \begin{array}{ccccc}a_0&a_1&a_2&a_{3}&a_4\end{array}\right] \left[ \begin{array}{ccccc} 0&{} 0&{}0&{} 0 &{} 0\\ 1&{}0&{}0&{} 0 &{} 0\\ 0&{}3&{}0&{}0 &{} 0\\ 1&{}0&{}5 &{} 0&{} 0\\ 0&{}3&{}0&{} 7 &{} 0\end{array}\right] \left[ \begin{array}{ccccc}P_0(x)\\ P_1(x)\\ P_2(x)\\ P_3(x)\\ P_4(x)\end{array}\right] . \end{aligned}$$
(2.16)

Special degree-graded bases

As mentioned above, the family of degree-graded polynomials with recurrence relations of the form (2.1) include all the orthogonal bases, but are not limited to them. Here, we discuss some of the famous non-orthogonal bases of this kind and, consequently, for which we find the differentiation matrix, \(\mathbf {D}\), formulas. In particular, if in (2.1), we let \(\alpha _j=1\) and \(\beta _j=\gamma _j=0\), it will become the monomial basis. Using (2.4) and (2.5), we can easily verify that in this case, \(\mathbf {D}\) has a form like (1.4).

Another important basis of this kind is the Newton basis. Let a polynomial P(x) be specified by the data \(\{ \left( z_j,{P}_j\right) \}_{j=0}^{n}\) where the \(z_j\)s are distinct. If the “Newton polynomials” are defined by setting \(N_0(x)=1\) and, for \(k=1,\ldots ,n,\)

$$\begin{aligned} N_k(x)=\prod _{j=0}^{k-1}(x-z_j), \end{aligned}$$
(2.17)

then

$$\begin{aligned} P(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {I}}\left[ \begin{array}{ccccc}N_0(x)\\ N_1(x)\\ \vdots \\ N_{n-1}(x)\\ N_n(x)\end{array}\right] \end{aligned}$$
(2.18)

For \(j=0,\ldots ,n\), the \(a_j\)s can be found by divided differences as follows.

$$\begin{aligned} a_j=[P_0,P_1,\ldots ,P_{j-1}], \end{aligned}$$
(2.19)

where we have \([P_j]=P_j\), and

$$\begin{aligned}{}[P_{i},\ldots ,P_{i+j}]=\frac{[P_{i+1},\ldots ,P_{i+j}]-[P_i,\ldots ,P_{i+j-1}]}{z_{i+j}-z_i}. \end{aligned}$$
(2.20)

If in (2.1), we let \(\alpha _j=1\), \(\beta _j=z_j\) and \(\gamma _j=0\), it will become the Newton basis. For \(n= 4\), \(\mathbf {D}\), as given by (2.4), has the following form.

$$\begin{aligned} {\mathbf {D}}=\left[ \begin{array}{ccccc} 0&{}0&{}0&{}0&{}0\\ 1&{}0&{}0&{}0&{}0 \\ z_{0}-z_{1}&{}2&{}0&{}0&{}0\\ (z_{0}-z_{2})(z_{0}-z_{1})&{} -2z_{2 }+z_{1}+z_{0}&{}3&{}0&{}0\\ (z_{0}-z_{3})(z_{0}-z_{2})(z_{0}-z_{1})&{} (z_{1}-z_{3})( z_{1}-2z_{2}+z_{0}) +(z_{0}-z_{2})(z_{0}-z_{1}) &{}-3z_{3}+z_{2}+z_{1}+z_{{0}}&{}4&{}0\end{array}\right] . \end{aligned}$$
(2.21)

The confluent case

Suppose that a polynomial P(x) of degree n as well as its derivatives are sampled at k nodes, i.e., distinct (finite) points \(z_0,\,z_1,\ldots ,z_{k-1}\). We write \(P_j:=P(z_j), P'_j:=P'(z_j), \ldots , P^{(s_j)}_j:=P^{(s_j)}(z_j)\); \(j=0,\ldots ,k-1\). Here \(s=(s_0,s_1,\ldots ,s_{k-1})\) shows the confluencies (i.e., the orders of the derivatives) associated with the nodes and we have \(\sum _{i=0}^{k-1}s_i=n+1-k\). If for \(j=0,\ldots ,k-1\), all \(s_j=0\), then \(k=n+1\) and we have the Lagrange interpolation.

This is an interesting polynomial interpolation that deserves a better consideration: the “Hermite interpolation” (See e.g., [2, 10]). It is basically similar to the Lagrange interpolation, but at each node, we have the value of P(x) as well as its derivatives up to a certain order.

Now, we assume that at each node, \(z_j\), we have the value and the derivatives of P(x) up to the \(s_j\)th order. The nodes at which the derivatives are given are treated as extra nodes. In fact we pretend that we have \(s_j+1\) nodes, \(z_j\), at which the value is \(P_j\) and remember that \(\sum _{i=0}^{k-1}s_i=n+1-k\). In fact, the first \(s_0+1\) nodes are \(z_0\), the next \(s_1+1\) nodes are \(z_1\) and so on.

Using the divided differences technique, as given by (2.20), to find \(a_j\)s, whenever we get \([P_j,P_j,\ldots ,P_j]\) where \(P_j\) is repeated m times, we have

$$\begin{aligned}{}[P_j,P_j,\ldots ,P_j]=\frac{P^{(m-1)}_j}{(m-1)!}, \end{aligned}$$
(2.22)

and all the values \(P'_j\) to \(P^{(s_j)}_j\) for \(j=0,\ldots ,k-1\) are given. For more details see e.g., [10].

The bottom line is that the Hermite basis can be seen as a special case of the Newton basis, thus a degree-graded basis. For the Hermite basis, like the Newton basis, \(\alpha _j= 1\), \(\beta _j= z_i\), and \(\gamma _j= 0\), but some of the \(\beta _j\)s are repeated. Other than that, the differentiation matrix, \(\mathbf {D}\), can be similarly found for the Hermite basis.

For a data set like \(\{(z_0, P(z_0)), (z_0, P'(z_0)), (z_1, P(z_1)), (z_2, P(z_2)), (z_3, P(z_3)\}\), \(\beta _0=z_0\), we have \(\beta _1=z_0\), \(\beta _2= z_1\), \(\beta _3= z_2\), and \(\beta _4= z_3\). In this case, (2.21) becomes

$$\begin{aligned} {\mathbf {D}}=\left[ \begin{array}{ccccc} 0&{}0&{}0&{}0&{}0\\ 1&{}0&{}0&{}0&{}0 \\ 0&{}2&{}0&{}0&{}0\\ 0&{} -2z_{1 }+2z_{0}&{}3&{}0&{}0\\ 0&{} (z_{0}-z_{2})( 2z_{0}-2z_{1})&{}-3z_{3}+z_{1}+2z_{{0}}&{}4&{}0\end{array}\right] . \end{aligned}$$
(2.23)

Bernstein basis

A Bernstein polynomial (also called Bézier polynomial) defined over the interval [ab] has the form

$$\begin{aligned} b_{j}(x)={n\atopwithdelims ()j} \frac{(x-a)^{j}(b-x)^{n-j}}{(b-a)^n}, \quad j=0, \ldots , n. \end{aligned}$$
(3.1)

This is not a typical scaling of the Bernstein polynomials; however, this scaling makes matrix notations related to this basis slightly easier to write.

The Bernstein polynomials are nonnegative in [ab], i.e., \(b_{j}(x)\ge 0\) for all \(x\in [a,b]\) (\(j=0, \ldots , n\)). Bernstein polynomials are widely used in computer-aided geometric design (e.g., see [4]).

A polynomial P(x) written in the Bernstein basis is of the form

$$\begin{aligned} P(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {I}}\left[ \begin{array}{ccccc}b_0(x)\\ b_1(x)\\ \vdots \\ b_{n-1}(x)\\ b_n(x)\end{array}\right] , \end{aligned}$$
(3.2)

where the \(a_j\)s are sometimes called the Bézier coefficients (\(j=0,\ldots , n\)).

Lemma 2

If P(x) is given by (3.2), then

$$\begin{aligned} P^{(k)}(x)= \left[ \begin{array}{ccccc}a_0&a_1&\ldots&a_{n-1}&a_n\end{array}\right] {\mathbf {D}}^k\left[ \begin{array}{ccccc}b_0(x)\\ b_1(x)\\ \vdots \\ b_{n-1}(x)\\ b_n(x)\end{array}\right] , \end{aligned}$$
(3.3)

where \(\mathbf {D}\) is a size \(n+1\) tridiagonal matrix that has the following structure for \(i= 1, \ldots , n+1\).

$$\begin{aligned} d_{i, j}= \left\{ \begin{array}{cl} \frac{n-2(i-1)}{a-b}, &{} i=j\\ \frac{i}{a-b}, &{} i= j-1\\ -\frac{(n-i+1)}{a-b} &{} i= j+1\\ \end{array}\right. \end{aligned}$$
(3.4)

Proof

A little computation using (3.1) shows that

$$\begin{aligned} b_k'(x)= \frac{k-1}{a-b}b_{k-1}(x)+ \frac{n-2k}{a-b}b_k(x)+ \frac{n-k}{a-b}b_{k+1}(x), \end{aligned}$$
(3.5)

for \(k= 0,\ldots , n\). Any \(b_i(x)\) with either a negative or larger than n index is set to 0 in (3.5). This is why \(\mathbf {D}\) is tridiagonal and form here, it is easy to derive (3.4) for \(\mathbf {D}\).

For \(n= 4\), the differentiation matrix is as follows.

$$\begin{aligned} {\mathbf {D}}=\left[ \begin{array}{ccccc} \frac{4}{a-b}&{}\frac{1}{a-b}&{}0&{}0&{}0\\ -\frac{4}{a-b}&{}\frac{2}{a-b}&{}\frac{2}{a-b}&{}0&{}0 \\ 0&{}-\frac{3}{a-b}&{}0&{}\frac{3}{a-b}&{}0\\ 0&{}0&{}-\frac{2}{a-b}&{}-\frac{2}{a-b}&{}\frac{4}{a-b}\\ 0&{}0&{}0&{}-\frac{1}{a-b}&{}-\frac{4}{a-b}\end{array}\right] . \end{aligned}$$
(3.6)

\(\square\)

Lagrange basis

Lagrange polynomial interpolation is traditionally viewed as a tool for theoretical analysis; however, recent work reveals several advantages to computation using new polynomial interpolation techniques in the Lagrange basis (see e.g., [1, 9]). Suppose that a polynomial P(x) of degree n is sampled at \(n+1\) distinct points \(z_0,\,z_1,\ldots ,z_n\), and write \(p_j:=P(z_j)\). Lagrange polynomials are defined by

$$\begin{aligned} L_{j}(x)=\frac{\ell (x)w_j}{x-z_j},\quad \quad j=0,1,\ldots ,n \end{aligned}$$
(4.1)

where the “weights” \(w_j\) are

$$\begin{aligned} w_j=\prod _{m=0,\,m\ne j}^n\frac{1}{z_j-z_m}, \end{aligned}$$
(4.2)

and

$$\begin{aligned} \ell (x)=\prod _{m=0}^n(x-z_m). \end{aligned}$$
(4.3)

Then P(x) can be expressed in terms of its samples in the following form.

$$\begin{aligned} P(x)= \left[ \begin{array}{ccccc}p_0&p_1&\ldots&p_{n-1}&p_n\end{array}\right] {\mathbf {I}}\left[ \begin{array}{ccccc}L_0(x)\\ L_1(x)\\ \vdots \\ L_{n-1}(x)\\ L_n(x)\end{array}\right] \end{aligned}$$
(4.4)

Lemma 3

If P(x) is given by (4.4), then

$$\begin{aligned} P^{(k)}(x)= \left[ \begin{array}{ccccc}p_0&p_1&\ldots&p_{n-1}&p_n\end{array}\right] {\mathbf {D}}^k\left[ \begin{array}{ccccc}L_0(x)\\ L_1(x)\\ \vdots \\ L_{n-1}(x)\\ L_n(x)\end{array}\right] , \end{aligned}$$
(4.5)

where \(\mathbf {D}\) is a size \(n+1\) matrix that has the following structure.

$$\begin{aligned} d_{i, j}= \left\{ \begin{array}{ll} \sum _{k=0, k\ne i-1}^n\frac{1}{z_{i-1}-z_k}, &{} i=j\\ \frac{w_{i-1}}{w_{j-1}(z_{j-1}-z_{i-1})}, &{} i\ne j \end{array}\right. \end{aligned}$$
(4.6)

Proof

A little computation using (4.1) shows that

$$\begin{aligned} L_i'(x)= \sum _{j= 0, j\ne i}^n\frac{w_i}{w_j(z_j- z_i)}L_j(x)+ \sum _{k=0, k\ne i}^n\frac{1}{z_{i}-z_k}L_i(x), \end{aligned}$$
(4.7)

for \(i= 0,\ldots , n\). Form here, it is easy to derive (4.6) for \(\mathbf {D}\). For \(n= 3\), the differentiation matrix is as follows.

$$\begin{aligned} {\mathbf {D}}=\left[ \begin{array}{ccccc} \frac{1}{z_0-z_1}+\frac{1}{z_0-z_2}+\frac{1}{z_0-z_3}&{}\frac{w_0}{w_1(z_1-z_0)}&{}\frac{w_0}{w_2(z_2-z_0)}&{}\frac{w_0}{w_3(z_3-z_0)}\\ \frac{w_1}{w_0(z_0-z_1)}&{}\frac{1}{z_1-z_0}+\frac{1}{z_1-z_2}+\frac{1}{z_1-z_3}&{}\frac{w_1}{w_2(z_2-z_1)}&{}\frac{w_1}{w_3(z_3-z_1)} \\ \frac{w_2}{w_0(z_0-z_2)}&{}\frac{w_2}{w_1(z_1-z_2)}&{}\frac{1}{z_2-z_0}+\frac{1}{z_2-z_1}+\frac{1}{z_2-z_3}&{}\frac{w_2}{w_3(z_3-z_2)}\\ \frac{w_3}{w_0(z_0-z_3)}&{}\frac{w_3}{w_1(z_1-z_3)}&{}\frac{w_3}{w_2(z_2-z_3)}&{}\frac{1}{z_3-z_0}+\frac{1}{z_3-z_1}+\frac{1}{z_3-z_2}\end{array}\right] . \end{aligned}$$
(4.8)

\(\square\)

Concluding remarks

A differentiation matrix, \(\mathbf {D}\), of size \(n+1\) in a certain basis is a nilpotent matrix of degree \(n+1\). As such, all of its eigenvalues are zero. Assuming \(n = 5\)—and the generalizations for all positive n will be clear—we can fairly easily verify that the Jordan form for \(\mathbf {D}\) in any basis is

$$\begin{aligned} {\mathbf {J}}= \left[ \begin{array}{cccccc} 0&{}1&{}0 &{}0 &{}0 &{}0\\ 0&{}0&{}1&{} 0 &{} 0&{}0 \\ 0&{}0&{}0&{} 1 &{} 0&{}0\\ 0&{}0&{}0&{} 0 &{} 1&{}0\\ 0&{}0&{}0&{} 0 &{} 0&{}1\\ 0&{}0&{}0&{} 0 &{} 0&{}0\end{array}\right] . \end{aligned}$$
(5.1)

We can write \({\mathbf {J}}= {\mathbf {T}}^{-1}{\mathbf {D}}\mathbf {T}\). The jth column of the transformation matrix, \(\mathbf {T}\), is the first column of \(\displaystyle {\mathbf {D}}^{n+1-j}\) for \(j=1, \ldots , n+1\). For example, for the \(\mathbf {D}\) given by (1.4), we have

$$\begin{aligned} {\mathbf {T}}= \left[ \begin{array}{cccccc} 0&{}0&{}0 &{}0 &{}0 &{}1\\ 0&{}0&{}0&{} 0 &{} 1&{}0 \\ 0&{}0&{}0&{} 2 &{} 0&{}0\\ 0&{}0&{}6&{} 0 &{} 0&{}0\\ 0&{}24&{}0&{} 0 &{} 0&{}0\\ 120&{}0&{}0&{} 0 &{} 0&{}0\end{array}\right] . \end{aligned}$$
(5.2)

Now, if we consider two different polynomial bases for which the differentiation matrices are \(\mathbf {D}_{1}\) and \(\mathbf {D}_{2}\), then we can write \({\mathbf {J}}= {\mathbf {T}}_{1}^{-1}{\mathbf {D}}_{1}{\mathbf {T}}_{1}\) and \({\mathbf {J}}= {\mathbf {T}}_{2}^{-1}{\mathbf {D}}_{2}{\mathbf {T}}_{2}\). From here it is easy to check that

$$\begin{aligned} {\mathbf {D}}_2= ({\mathbf {T}}_1{\mathbf {T}}_2)^{-1}{\mathbf {D}}_1({\mathbf {T}}_1{\mathbf {T}}_2), \end{aligned}$$
(5.3)

which shows, as expected, the differentiation matrices in different bases are similar.

In this paper, we have found explicit formulas for the differentiation matrix, \(\mathbf {D}\), in various polynomial bases. The most important advantage of having \(\mathbf {D}\) explicitly is that there is no need to go from one basis to another (normally monomial) to differentiate a polynomial in a given basis. Moreover, having \(\mathbf {D}\), we can easily find higher order derivatives of any polynomial in its original basis. One may hope that new and more efficient polynomial-related algorithms, such as root-finding methods, can be developed using \(\mathbf {D}\).

These results can be easily extended to matrix polynomials in different bases.