I don't understand how equating/comparing coefficients of trigonometric functions and identities works. I will use this question as an example. The question is as follows.
Use the basic definition of periodicity to show algebraically that the period of $f(x) = \sin(nx)$ is $\frac{2\pi}{n}$ for all $n > 0$.
The answer I got is as follows:
The period of a function $f(x)$ is the smallest $p > 0$ such that $f(x+p) = f(x)$ \begin{gather*} \therefore \sin[n(x+p)] = \sin(nx) \\ \therefore \sin(nx+np)=\sin(nx) \\ \therefore \sin(nx) \cos(np) + \cos(nx)\sin(np) = \sin(nx) \end{gather*} Here is the part where I need help with. The answer in the book continues as follows:
Equating coefficients of $\sin(nx)$ and $\cos(nx)$, \begin{gather*} \cos(np) = 1,\sin(np) = 0 \\ \therefore np = 2k\pi, k \subset \Bbb R \\ \therefore p = \frac{2k\pi}{n}, k \subset \Bbb R \end{gather*}
I just don't understand how they came to the conclusion that $\cos(np) = 1$ and that $\sin(np) = 0$.Can someone explain?