# Manipulating sums

This post is a list of five spinoffs of my previous post. Except for the last point it doesn’t build on the previous post per se, but I’ll use a sum from that post to illustrate five things:

2. Simplifying sums by generalizing binomial coefficients
3. A bit of notation from Iverson
4. Changing variables in a sum
5. Chebyshev polynomials come up again.

Let’s get started. The equation I want to focus on is the following.

## Putting things under a sum in LaTeX

I said in the previous post that you could equate the real parts of the left and right side to show that cos nθ can be written as sums and products of cos θ and sin θ. To write this in LaTeX we’d say The command that makes it possible to put two lines of stuff under the summation is \substack. Here’s the LaTeX code that produce the summation sign and the text below it.

    \sum_{\substack{0 \leq j \leq n \\ j \text{ even}}}

## Binomial coefficients

We can simplify the sum by removing the limits on j and implicitly letting j run over all integers: This is because the binomial coefficient term is zero when j > n or j < 0. (See this post for an explanation of more general binomial coefficients.)

## Indicator functions

It’s often helpful to turn a sum over a complicated region into a more complicated sum over a simpler region. That is, it’s often easier to deal with complications in the summand than in the domain of summation.

In our case, instead of summing over even integers, we could sum over all integers, if we multiply the summand by a function that is 0 on odd numbers and 1 on even numbers. That is, we multiply by the indicator function of the even integers. The indicator function of a set is 1 on that set and 0 everywhere else.

Kenneth Iverson’s notation uses a Boolean expression in brackets to indicate the function that is 1 if the condition is true and 0 otherwise. So [j even] means the function that is 1 when j is even and 0 when j is odd. So we could write our sum as follows. ## Change of variables

We could get rid of the requirement that j is even by replacing j with 2k for a new variable k. Now our sum is Notice a couple things. For one thing we were table to write (-1)k rather than i2k.

More importantly, the change of variables was trivial because the sum runs over all integers. If we had explicit limits on j, we would have to change them to different explicit limits on k.

Changing limits of summation is error-prone. This happens a lot, for example, when computing power series solutions for differential equations, and there are mnemonics for reducing errors such as “limits and exponents move in opposite directions.” These complications go away when you sum over all integers.

## Chebyshev strikes again

GlennF left a comment on the previous post to the effect that the sum we’ve been talking about reduces to a Chebyshev polynomial.

Since the powers of sin θ are all even, we can replace sin²θ with 1 – cos²θ and get the following. Now the left side is a polynomial in cos θ, call it P(cos θ). Then P = Tn, the nth Chebyshev polynomial because as explained here, one way to define the Chebyshev polynomials is by If you don’t like that definition, you could use another definition and the equation becomes a theorem.

## 3 thoughts on “Manipulating sums”

2. In C-like languages you can write 1*x for the indicator function of x.
$$\cos n\theta = (\cos{\theta})^{n}\sum_k \binom{n}{2k} (i \tan{\theta})^{2k}$$
$$T_n(x) = x^n \sum_k \binom{n}{2k}\bigg(1-\frac{1}{x}\bigg)^k\bigg(1+\frac{1}{x}\bigg)^k$$