Why does specifying an interval for a function make the function odd or even?

I am currently reading about Fourier series and Orthogonality of functions and Complete Sets of functions. Below are two extracts from the book I'm reading for which I simply do not understand:

Extract 1:

$\sin {nx}$ is a complete set on $(0, \pi)$; we used this fact when we started with a function given on $(0, \pi)$, defined it on $(−\pi, 0)$ to make it odd, and then expanded it in a sine series.

Extract 2:

A function given on $(0, l)$ can be expanded in a sine series by defining it on $(−l, 0)$ to make it odd, or in a cosine series by defining it on $(−l, 0)$ to make it even (where $l$ is the period of the function).

For the first extract I don't understand why 'defining $\sin{nx}$ on $(-\pi,0)$' makes it an odd function as it was my understanding that $\sin{nx}$ is odd on $[0,\pi]$.

For the second extract I am starting to wonder if there is a typo; since it says that we can define it on $[-l,0]$ to make a sine series or a cosine series. This doesn't make any sense to me, as I don't see how that interval can represent $\fbox{both}$ a sine series and a cosine series.

Most importantly; Why is $\sin{nx}$ a complete set of orthogonal functions on $[0,\pi]$?

Any ideas?

Many thanks.

• The extract is not talking about defining \sin nx. As you note, it is already odd. It's about extending the definition of some arbitrary function that you wish to expand into a Fourier series. – Harald Hanche-Olsen Apr 9 '16 at 11:32
• @Harald Thanks for your reply, Can you please explain what you mean by 'extending the definition of some arbitrary function'? Does that mean the same thing as 'extending the interval for which some arbitrary function is defined'? Sorry, I'm a little confused with the terminology. – BLAZE Apr 9 '16 at 11:38
• The entire point of Fourier series is to expand a function $f$ into a trigonometric series, and to study the connection between the function and the corresponding series. So I am talking about that function $f$ here. In many applications, $f$ is naturally defined on an interval $(0,l)$, and so you extend it to an even or odd function in order to get a cosine or a sine series. – Harald Hanche-Olsen Apr 9 '16 at 11:41
• @Harald Okay now we are getting somewhere, that was a helpful comment. The last sentence you wrote is exactly what this whole post is about; namely: "In many applications, $f$ is naturally defined on an interval $(0,l)$, and so you extend it to an even or odd function in order to get a cosine or a sine series". My question is how do you extend it to an even or odd function if it is already naturally defined as odd or even on a certain interval? Is it clear what I'm asking? – BLAZE Apr 9 '16 at 11:48
• Um, maybe. Consider the function $f(x)=x$ on $(0,l)$. It might seem like a “naturally odd” function, but you could extend it to an even function by setting $f(x)=-x$ for $x\in(-l,0)$. In general, a function defined on $(0,l)$ is neither “naturally odd” nor “naturally even”. You get to decide. Or rather, in reality, the problem for which this is going to be used will decide for you. – Harald Hanche-Olsen Apr 9 '16 at 11:54

I think this question touches an important and essential aspect of a function. Namely, a function is more than the mapping $$y=f(x)$$ It is an object which also crucially depends on the domain and the codomain where it is defined. \begin{align*} &f:X\rightarrow Y\\ &y=f(x) \end{align*}

It is important to know, that the definition of domain and codomain have fundamental influence to the properties of a function.

Question: Is $\sin x$ odd? Answer: It depends! It depends on the definition of domain and codomain.

\begin{align*} f:(0,\pi)\rightarrow\mathbb{R}\\ f(x)=\sin(x) \end{align*} This is not an odd function (at least in a non-void sense), since there is no $x\in(0,\pi)$ with $\sin(x)=-\sin(-x)$. Negative $x$ are not even defined for it. But, if we extend the domain to $X=[-\pi,\pi]$, then $f(x)=\sin(x)$ becomes an odd function.

With respect to your second question, let us assume a function $f$ is defined at $(0,l)$ \begin{align*} &f:(0,l)\rightarrow\mathbb{R}\\ &y=f(x) \end{align*}

Let us consider a function $g$ with \begin{align*} &g:(-l,l)\rightarrow\mathbb{R}\\ &g(x)=\begin{cases} f(x)\qquad\quad &x\geq 0\\ f(-x)\qquad &x<0 \end{cases} \end{align*} Here $g$ is defined as even function, since $g(x)=g(-x)$ for all $x$ in the domain of $g$.

Let us consider a function $h$ with \begin{align*} &h:(-l,l)\rightarrow\mathbb{R}\\ &h(x)=\begin{cases} f(x)\qquad\quad\quad &x \geq 0\\ -f(-x)\qquad &x <0 \end{cases} \end{align*}

Here $h$ is defined as odd function, since $h(x)=-h(-x)$ for all $x$ in the domain of $h$.

We observe we can extend the function $f$ either to an odd or even function, so that approximation via a family of odd functions like $(\sin nx)$ or a family of even functions $(\cos nx)$ becomes feasible.

Note: When we talk about $\sin$ as odd function, we implicitely consider an appropriate domain.

Epiloque: To say it less formally, it is essential where an object lives.

Question: Is $f(x)=|x|$ differentiable? Answer: It depends! Question: Is $f(x)=\text{sign}(x)$ continuous? Answer: It depends! The term continuous touches another essential aspect. It does not merely depend on the domain and codomain as a whole, but also on the fine grained structure, namely what are the open sets, what are neighborhoods of points. This is a main theme in point set topology.

Add-on [2016-04-10] according to a comment of OP.

It is stated in the question, that $(\sin nx)$ is a complete set on $(0,\pi)$, which may sound somewhat peculiar, since the statement that \begin{align*} \{1,\cos x,\sin x,\cos 2x, \sin 2x, \ldots\}\tag{1} \end{align*} is a complete set of orthogonal functions in $(-\pi,\pi)$ is much more common. In fact it's again the domain which is crucial for the correctness of OPs statement.

Recall, a set of orthogonal functions is complete, if the function $0$ is the only function which is orthogonal to all elements of the set. This means, the set cannot be extended by another orthogonal function. In a more general context we talk about $L^2$ functions and call a set of orthogonal functions complete, if the only function orthogonal to all members of the set is $0$ almost everywhere.

A proof showing this claim on $(0,\pi)$ based on the completeness of (1) on $(-\pi,\pi)$ is given in this paper.

To show that the infinite set of functions $\sin(nx)$ or $$\{\sin{x}, \sin(2x), \sin(3x),.....,\sin(mx), \sin(nx)\}$$ is a complete set of orthogonal functions on $[0,\pi]$, where $m,n \in \mathbb{Z}$

We need to show that $$\int_{x=0}^{\pi}\sin(mx)\cdot\sin(nx)\,\mathrm{d}x=0 \quad\ \text{for}\quad m\ne n$$

To do this we make use of the identity: $$\sin(mx)\cdot\sin(nx)=\frac{\cos\Big((m-n)x\Big) -\cos\Big((m+n)x\Big)}{2}$$

\Large\therefore\begin{align}\int_{x=0}^{\pi}\sin(mx)\cdot\sin(nx)\,\mathrm{d}x & = \int_{x=0}^{\pi}\frac{\cos\Big((m-n)x\Big) -\cos\Big((m+n)x\Big)}{2}\,\mathrm{d}x \\&= \frac12\left[\frac{\sin\Big((m-n)x\Big)}{(m-n)}-\frac{\sin\Big((m+n)x\Big)}{(m+n)}\right]_{x=0}^{\pi}\\&=0 \end{align} Since the sine of zero or any multiple of\pi$is zero.$\large{\fbox{}}$• This answer shows that the set is orthogonal. It does not prove completeness. In order to show that it is complete, you have to consider an arbitrary function orthogonal to$\sin nx$for all$n$and conclude that only the function$f\equiv 0\$ is orthogonal to all functions. Nevertheless (+1) for your serious effort. – Markus Scheuer Apr 12 '16 at 10:06
• @Markus I had an idea that would be the case; Thank you for your confirmation. It is much appreciated ^^. – BLAZE Apr 12 '16 at 13:03