Suppose $\sin x=\sin y$. Then for the cosine there are just two possibilities, since $\cos^2x=1-\sin^2x=1-\sin^2y=\cos^2y$: either $\cos x=\cos y$ or $\cos x=-\cos y$.
In the first case, the angles $x$ and $y$ must differ by an integer multiple of $2\pi$; in the second case, if we write $z=\pi-y$, we have $\sin z=\sin y$ and $\cos z=-\cos y$, so $\sin x=\sin z$ and $\cos x=\cos z$, so we're in the above case and we conclude $x$ differs from $z=\pi-y$ by an integer multiple of $2\pi$.
Therefore the equation $\sin x=\sin y$ is solved by the two cases
- $x=y+2k\pi$
- $x=\pi-y+2k\pi$
In your particular case the first one becomes $5x=x+2k\pi$ that can also be written
$$
x=k\frac{\pi}{2}
$$
and the second case becomes $5x=\pi-x+2k\pi$, that is,
$$
x=\frac{\pi}{6}+k\frac{\pi}{3}
$$
Some solutions, for instance $\pi/2$ appear in both sets.
With a similar reasoning you can solve $\cos x=\cos y$ with the two sets
If you have $\sin x=\cos y$, you reduce it to the previous cases by noting it is the same as $\sin x=\sin(\pi/2-y)$ (or $\cos(\pi/2-x)=\cos y$).