# An integral with Chebyshev polynomials

I am posting this question on behalf of a friend of mine, who studies mathematics and isn't proficient in English. In his project work, he encountered the following integral:

$$\int_{-1}^1 x^k U_n(x) U_m (x)\sqrt{1-x^2} dx,$$

where $$k$$, $$n$$ and $$m$$ are arbitrary natural numbers and

$$U_n(x) = \frac{\sin[(n+1) \arccos (x)]}{\sqrt{1-x^2}}$$

are Chebyshev polynomials of the second kind.

Is there any formula for the value of this integral for arbitrary $$k$$, $$n$$ and $$m$$? If so, how can it be derived?

We would also be grateful for a reference to a paper or a book in which a general theory is given of the integral $$\int_{-1}^1 f(x) U_n(x) U_m (x) \sqrt{1-x^2} dx$$ for elementary functions $$f(x)$$ like $$\sin(x)$$, $$\cos (x)$$, $$\exp(x)$$ and so on.

The Chebyshev $$U$$ polynomials are defined by the recurrence relation $$U_{n+1}=2xU_n-U_{n-1}\tag{0}$$ Rearranging, $$xU_n=\frac{U_{n+1}+U_{n-1}}{2}\tag{1}$$ One can then iterate this relation to obtain $$x^kU_n=\frac{1}{2^k}\sum_{j=0}^k{\binom{k}{j}U_{n-k+2j}}\tag{2}$$ if $$k\leq n$$. (Perhaps (2) is not so obvious; an easy way to deduce it is to recognize that the coefficient of $$U_a$$ in $$x^kU_n$$ is the probability that an unbiased random walk starting at $$n$$ is at $$a$$ after $$k$$ steps.)
Thus when $$k,m\leq n$$, we have \begin{align*} \int_{-1}^1{x^kU_n(x)U_m(x)\sqrt{1-x^2}\,dx}&=\frac{1}{2^k}\sum_{j=0}^k{\binom{k}{j}\int_{-1}^1{U_{n-k+2j}(x)U_m(x)\sqrt{1-x^2}\,dx}} \\ &=\frac{1}{2^k}\sum_{j=0}^k{\binom{k}{j}\cdot\frac{\pi}{2}\delta_{n-k+2j,m}} \tag{3} \\ &=\frac{\pi}{2^{k+1}}\binom{k}{\frac{m-n+k}{2}} \end{align*} where the binomial coefficient is $$0$$ if the "denominator" is noninteger.
Of course, that leaves the case where $$k>\max{\!(m,n)}$$. For that scenario, the first step is to define $$U_n$$ for $$n$$ negative by extending (0). But now we should like to reuse the properties of $$U_n$$ when $$n$$ is nonnegative. Do they still hold?
Well, those properties arise from the trigonometric definition $$U_n(\cos{\theta})=\frac{\sin{(n+1)\theta}}{\sin{\theta}}$$ This trigonometric definition is preserved by (0); thus it in fact holds for the new, "extended" $$U_n$$. In particular, $$U_{-n}(\cos{\theta})=\frac{\sin{(1-n)\theta}}{\sin{\theta}}=-\frac{\sin{(n-1)\theta}}{\sin{\theta}}=-U_{n-2}(\cos{\theta})$$
Thus we can still perform the above calculation, as long as we replace each instance of $$U_{-n}$$ with $$-U_{n-2}$$ when it arises. This gives an additional term in (3): \begin{align*} \int_{-1}^1{x^kU_n(x)U_m(x)\sqrt{1-x^2}\,dx}&=\frac{1}{2^k}\sum_{j=0}^k{\binom{k}{j}\cdot\frac{\pi}{2}(\delta_{n-k+2j,m}+\delta_{m+2,k-n-2j})} \tag{3'} \\ &=\frac{\pi}{2^{k+1}}\left(\binom{k}{\frac{m-n+k}{2}}+\binom{k}{\frac{k-n-m}{2}-1}\right) \end{align*} where each binomial coefficient vanishes unless the denominator is a nonnegative integer $${}\leq k$$.