Trigonometry/A Square Wave in Sines
Trigonometric PolynomialsEdit
We start by considering trigonometric polynomials. These are functions that are a sum of different sine and cosine functions. For example:
is a trigonometric polynomial. In general, a trigonometric polynomial has the form:
Really, the underlying idea here isn't that different from ordinary polynomials. We're forming a linear combination of functions whose properties we know well. With ordinary polynomials the functions are with . Here the functions are or with
Worked Example: We can and will define the degree of a trigonometric polynomial, and discuss their various properties but before we get into that it might be interesting to notice it is not immediately obvious which functions can be written as trigonometric polynomials. Consider for example: It doesn't look like a trigonometric polynomial at first sight, but if we use our sum of angle formulas to calculate we find that it is: 
Exercise: An alternative? Look at the formula above for trigonometric polynomials. Does it include the same functions? 
Exercise: A Trigonometric Polynomial
as a trigonometric polynomial in 
Exercise: Combining Trigonometric Polynomials

As well as sum of angle formulas we have another very useful tool on our side. Among the many amazing properties of the trigonometric functions and are the socalled orthogonality relations. These are the following results concerning the integrals:
Similarly,
to do: graphs showing informal argument as to why this is so using symmetry properties.
For example, taking the function we started with, , we can compute
Notice this last line follows from the integrals we have computed above. This means we can use integrals to determine the coefficients of a trigonometric polynomial. This is an intriguing idea since not every trigonometric polynomial is clearly a trigonometric polynomial at first sight. The question becomes how do we know when to stop calculating the coefficients of the trigonometric polynomial? How do we know when we have found them all? One answer might be to compare the graphs. We first demonstrate that this idea can be used in the case that we know how far to go, for example let
then numerically calculate the integrals for and . We can see from the graph when we have calculated all of the coefficients, as indicated in the animation below.
Let's try another example where we do not know the degree of the trigonometric polynomial immediately. The function can be written as a trigonometric polynomial, our procedure of integrating to find the coefficients and looking at the graph to tell when we are done can be used, and below is an animation of what happens.
Notice that for this specific function it took rather a long time to decide when we reached the end. It turns out that we have have to go all the way to N=48 before we find all the coefficients. This may seem like a problem, particularly if we accidentally start out with a function that is not a trigonometric polynomial.
To see what happens, let's assumed that we started with a square wave, that is we let
and is defined to be periodic with period , i.e. we define . If we use our procedure on , then we quickly discover that it never seems to stop as shown in the animation:
This animation shows that as we increase the number of terms we take in the trigonometric polynomial, we never quite make it to the original function. On the other hand, we get very close, especially away from .
With this motivation we could ask the bold question, what if we let the number of terms approach infinity; do the trigonometric polynomials converge to the square wave? This is the beginning of the study of Fourier series.