Find the smallest positive number $p$ for which the equation $\cos(p\sin x)=\sin(p \cos x)$ has a solution $x\in[0,2\pi].$
It must be that $p\sin{x}+p\cos{x}=\dfrac{\pi}{2}$ with, $p=\dfrac{\pi}{2(\sin{x}+\cos{x})}$.
So, to minimize $p$, $\sin{x}+\cos{x}$ must be maximized.
$\sin{x}+\cos{x}=\sqrt{2} \sin\left(x+\dfrac{\pi}{4}\right)$, which is maximized when $\sin\left(x+\dfrac{\pi}{4}\right)=1$ at $x=\dfrac{\pi}{4}, \dfrac{7\pi}{4}$.
Hence, $p=\dfrac{\pi}{2\sin\left(\dfrac{\pi}{2}\right)}$.
$p=\dfrac{\pi}{2\sqrt2}$.
Hence, $x=\dfrac{\pi}{4}, \dfrac{7\pi}{4}$ in the interval $[0, 2\pi]$.
Given two angles $\alpha$ and $\beta$ one has $$\cos\alpha=\sin\beta=\cos(\beta-{\pi\over2})$$ iff either $$\alpha=\beta-{\pi\over2}+2k\pi\tag{1}$$ or $$\alpha=-(\beta-{\pi\over2})+2k\pi,\quad{\rm i.e.}\quad \alpha+\beta={\pi\over2}+2k\pi\ .\tag{2}$$ In our case $\alpha=p\sin x$ and $\beta=p\cos x$, so that $(1)$ is equivalent with $$p(\cos x-\sin x)={\pi\over2}-2k\pi\ ,$$ so that we have to make sure that the equation $$p{2\over\sqrt{2}}\sin({\pi\over4}-x)={\pi\over2}-2k\pi$$ has a real solution $x$. This is the case if $${2\over\sqrt{2}}p \geq|{\pi\over2}-2k\pi|$$ for a suitable $k$, and the smallest positive $p$ that satisfies this is $p={\pi\over 2\sqrt{2}}$. The resulting solution $x$ of the original equation is then $x={7\pi\over4}$.
The case $(2)$ is similar and has the same outcome for $p$ (so that this is the definitive solution of the problem); the corresponding $x$ is then ${\pi\over4}$.