Checking for orthogonality of $\cos(\pi x)$ on the set of functions ${\sin(n\pi x)}$ in the $[0,1]$ interval I'm trying to verify the orthogonality of the function $\cos(\pi x)$ to the set of functions $\{\sin(n\pi x)\}, n=1,2,3...$,on the $[0,1]$ interval, for which I have taken the integral obtaining the following result:
$$\int_0^1 \cos(\pi x)\sin(n\pi x) dx= \begin{cases}   
  0 & \text{if $n \gt 1$, and if n odd} \\ \frac{n(1+(-1)^n)}{\pi(n^2-1)}  & \text{if $n \gt 1$, and if n even} \end{cases}$$
But the source I'm reading states (with no proving) that the result is:
$$\int_0^1 \cos(\pi x)\sin(n\pi x) dx=   
0 \text{ if $n \neq 1$} $$
Is this the case? I've verified multiple times my calculations by hand and software and still my result differs from the one in the book.

More info:
The original part of the problem was the following claim about the fourier coefficients of the function $\cos(\pi x)$ respect the set of eigenfunctions $\varphi_n(x)=\sin(n\pi x)+n\pi\cos(n\pi x)$ with $n=1,2,3...$ in the interval $[0,1]$
$$a_n=\int_0^1 \cos(\pi x)[\sin(n\pi x)+n\pi\cos(n\pi x)]= \begin{cases}   
  0 & \text{if $n \neq 1$} \\ \frac{\pi}{2}  & \text{if $n = 1$} \end{cases}$$
 A: $$\cos (\pi x) \sin (n \pi x) = \frac{1}{2} (\sin (\pi x + n \pi x) - \sin (\pi x - n \pi x)) = \frac{1}{2}(\sin (\pi (n + 1) x) + \sin (\pi (n - 1)x)$$
We consider only the case where $n \neq 1$.
Taking the integral from $0$ to $1$ gives $\frac{1}{2\pi} (\frac{1}{n + 1} (1 - \cos((n + 1) \pi)) + \frac{1}{n - 1} (1 - \cos((n - 1) \pi)))$.
When $n$ is odd, we have $\cos((n + 1) \pi) = \cos((n - 1) \pi) = 1$ and thus the integral is $0$.
When $n$ is even, we have $\cos((n + 1) \pi) = \cos((n - 1) \pi) = -1$, and thus the integral is $\frac{1}{\pi} (\frac{1}{n + 1} + \frac{1}{n - 1}) = \frac{2n}{\pi(n^2 - 1)}$.
Finally, in the case that $n = 1$, we see that we're integrating only $\frac{1}{2} \sin(2 \pi x)$ from $0$ to $1$. This integral works out to be 0.
So the integral is always equal to $0$ when $n$ is odd, and $\frac{2n}{\pi (n^2 - 1)}$ when $n$ is even.
Thus, both you and the book are wrong in the case $n = 1$. You are correct on all other cases.
A: Generally, the functions $\cos\left(\frac{n\pi}{L} x\right)$ and $\sin\left(\frac{n\pi}{L} x\right)$ form an orthogonal set of functions on the interval $[-L,L]$. In the case of the OP, we have $L=1$ for the functions, but we are only integrating over half of the interval, i.e., $[0,1]$.  These functions are not generally orthogonal on the interval $[0,L]$, as the OP has demonstrated.  (Although $\cos(\pi x)$ and $\sin(\pi x)$ are actually orthogonal on $[0,1]$. Otherwise, the OP is correct.)
