# 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.

#### Solutions Collecting From Web of "Why does specifying an interval for a function make the function odd or even?"

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}
\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}
\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{}}\$