## Abstract

Explicit differentiation matrices in various polynomial bases are presented in this work. The idea is to avoid any change of basis in the process of polynomial differentiation. This article concerns both degree-graded polynomial bases such as orthogonal bases, and non-degree-graded polynomial bases including the Lagrange and Bernstein bases.

### Similar content being viewed by others

Avoid common mistakes on your manuscript.

## 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

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 *k*th order derivative of *P*(*x*), shown by \({\rm d}^kP(x)\over {\rm d}x^k\) or \(P^{(k)}(x)\), can be written as

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

then

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

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.

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

###
**Lemma 1**

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

*where*

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

*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

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

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

where

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\).

Now

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

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

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

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

### 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,\)

then

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

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

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.

#### 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

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

## Bernstein basis

A Bernstein polynomial (also called Bézier polynomial) defined over the interval [*a*, *b*] has the form

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 [*a*, *b*], 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

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*

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

###
*Proof*

A little computation using (3.1) shows that

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.

\(\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

where the “weights” \(w_j\) are

and

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

###
**Lemma 3**

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

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

###
*Proof*

A little computation using (4.1) shows that

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.

\(\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

We can write \({\mathbf {J}}= {\mathbf {T}}^{-1}{\mathbf {D}}\mathbf {T}\). The *j*th 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

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

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.

## References

Berrut, J., Trefethen, L.: Barycentric Lagrange interpolation. SIAM Rev.

**46**(3), 501–517 (2004)Chirikalov, V.I.: Computation of the differentiation matrix for the Hermite interpolating polynomials. J. Math. Sci.

**68**(6), 766–770 (1994)Davis, P.J.: Interpolation and Approximation. Blaisdell, New York (1963)

Farin, G.: Curves and Surfaces for Computer-Aided Geometric Design. Acadmeic Press, San Diego (1997)

Farouki, R.T., Goodman, T.N.T., Sauer, T.: Construction of orthogonal bases for polynomials in Bernstein form on triangular simplex domains. Comput. Aided Geom. Design

**20**, 209–230 (2003)Gander, W.: Change of basis in polynomial interpolation. Numer. Linear Algebra Appl.

**12**(8), 769–778 (2002)Gautschi, W.: Orthogonal Polynomials: Computation and Approximation. Clarendon, Oxford (2004)

Hermann, T.: On the stability of polynomial transformations between Taylor, Bézier Hermite forms. Numer. Algo.

**13**, 307–320 (1996)Higham, N.: The numerical stability of barycentric Lagrange interpolation. IMA J. Numer. Anal.

**24**, 547–556 (2004)Lorentz, G., Jetter, K., Riemenschneider, S.D.: Birkhoff Interpolation. Addison Wesley Publishing Company, Boston (1983)

Ravlin, T.: Chebyshev Polynomials. Wiley, New York (1990)

Rabbah, A., Al-Refai, M., Al-Jarrah, R.: Computing derivatives of Jacobi polynomials using Bernstein transformation and differentiation matirx. Numer. Funct. Anal. Optim.

**29**(5–6), 660–673 (2008)Shen, J., Tang, T., Wang, L.: Spectral Methods: Algorithms, Analysis and Applications. Springer Series in Computational Mathematics, vol. 41. Springer, New York (2011)

Wang, L., Samson, D., Zhao, X.: A well-conditioned collocation method using a pseudospectral integration matrix. SIAM J. Sci. Comput.

**36**(3), 907–929 (2014)

## Author information

### Authors and Affiliations

### Corresponding author

## Rights and permissions

**Open Access** This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## About this article

### Cite this article

Amiraslani, A. Differentiation matrices in polynomial bases.
*Math Sci* **10**, 47–53 (2016). https://doi.org/10.1007/s40096-016-0177-x

Received:

Accepted:

Published:

Issue Date:

DOI: https://doi.org/10.1007/s40096-016-0177-x