<s>[INST] 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}$$
 [/INST] $$\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.
</s>