# Clenshaw-type recurrence for derivative of Chebyshev series

The naive summation of a Chebyshev series \begin{align*} f(x) = \frac{c_0}{2} + \sum_{k=1}^{n-1} c_{k}T_{k}(x) \end{align*} which employs the three-term recurrence for evaluation of the Chebyshev polynomials is known to be numerically unstable near $x=\pm 1$. For this reason, Clenshaw presented an algorithm which avoids this instability; see Clenshaw's original work and an exposition in Algorithm 3.1 of Numerical Methods for Special Functions.

Is there literature which presents a numerically stable method for evaluating the derivative of a Chebyshev series, perhaps using an analogy to the Clenshaw recurrence presented above? Or is the naive method stable?

• A useful alternative to the answer you got is to derive the Chebyshev coefficients of the derivative from the coefficients of the original function. – J. M. Sep 18 '17 at 7:50

You can just take Clenshaw's recurrence $$u_k(x) = 2xu_{k+1}(x)-u_{k+2}(x)+\color{red}{a_k},\\ f(x) = x u_1(x)-u_2(x)+\color{red}{a_0}$$ and differentiate it directly: $$u_k'(x) = 2xu_{k+1}'(x)-u_{k+2}'(x) + \color{blue}{2u_{k+1}(x)},\\ f'(x) = x u_1'(x)-u_2'(x) + \color{blue}{u_1(x)}.$$ Note that now the derivatives of partial sums, $u_k'(x)$ satisfy exactly the same recurrence, except that the coefficients $a_k$ are replaced by $2u_{k+1}(x)$. This means that the series for the derivative can be written as the Chebyshev series $$f'(x) = \tfrac12 u_1(x) + \sum_{k\geq1} 2u_{k+1}(x)T_k(x).$$
Since Clenshaw's recurrence evaluates Chebyshev series accurately, it will evaluate the Chebyshev series with coefficients $2u_{k+1}(x)$ accurately too, and it doesn't need to be analyzed separately. A very similar thing happens when differentiating polynomials using Horner's rule.
• This is effectively a manual application of automatic differentiation on the loop for Clenshaw's recurrence. It should be noted that this method is easily extensible if one wants second, third, ... $n$-th order derivatives. – J. M. Sep 18 '17 at 7:51