12. Solve the equation $x^{2}-2 x \sin \frac{\pi x}{2}+1=0$.
12. The equation can be transformed into $\left(x-\sin \frac{\pi}{2} x\right)^{2}+1-\sin ^{2} \frac{\pi}{2} x=0,\left(x-\sin \frac{\pi}{2} x\right)^{2}+\cos ^{2} \frac{\pi}{2} x=0$, so $\left\{\begin{array}{l}x-\sin \frac{\pi}{2} x=0 \\ \cos \frac{\pi}{2} x=0\end{array} \Rightarrow\left\{\begin{array}{l}x= \pm \sqrt{1-\cos ^{2} \frac{\pi}{2} x}= \pm 1 \\ \frac{\pi}{2} x=k \pi+\frac{\pi}{2} \Rightarrow x=2 k+1 .\end{array}\right.\right.$ Therefore, $x= \pm 1$ are the roots of the original equation.