Example 1 (2007 Jiangxi Province Liberal Arts College Entrance Examination Question) As shown in Figure 4-1-1, the graph of the function $y=2 \cos (\omega x+\theta)(x \in \mathbf{R}$, $\left.\omega>0,0 \leqslant \theta \leqslant \frac{\pi}{2}\right)$ intersects the $y$-axis at the point $(0, \sqrt{3})$, and the smallest positive period of this function is $\pi$.
(1) Find the values of $\theta$ and $\omega$;
(2) Given the point $A\left(\frac{\pi}{2}, 0\right)$, point $P$ is a point on the graph of this function, and point $Q\left(x_{0}, y_{0}\right)$ is the midpoint of $P A$. When $y_{0}=\frac{\sqrt{3}}{2}, x_{0} \in\left[\frac{\pi}{2}, \pi\right]$, find the value of $x_{0}$.
(1) Substituting $x=0, y=\sqrt{3}$ into the function $y=2 \cos (\omega x+\theta)$ yields $\cos \theta=\frac{\sqrt{3}}{2}$. Since $0 \leqslant \theta \leqslant \frac{\pi}{2}$, we have $\theta=\frac{\pi}{6}$. Given $T=\pi$ and $\omega>0$, we get $\omega=\frac{2 \pi}{T}=\frac{2 \pi}{\pi}=2$.
(2) Since point $A\left(\frac{\pi}{2}, 0\right), Q\left(x_{0}, y_{0}\right)$ is the midpoint of $P A$, and $y_{0}=\frac{\sqrt{3}}{2}$, the coordinates of point $P$ are $\left(2 x_{0}-\frac{\pi}{2}, \sqrt{3}\right)$.

Since point $P$ lies on the graph of $y=2 \cos \left(2 x+\frac{\pi}{6}\right)$, and $\frac{\pi}{2} \leqslant x_{0} \leqslant \pi$, we have $\cos \left(4 x_{1}-\frac{5 \pi}{6}\right)=\frac{\sqrt{3}}{2}$, $\frac{7 \pi}{6} \leqslant 4 x_{0}-\frac{5 \pi}{6} \leqslant \frac{19 \pi}{6}$, thus $4 x_{0}-\frac{5 \pi}{6}=\frac{11 \pi}{6}$ or $4 x_{0}-\frac{5 \pi}{6}=\frac{13 \pi}{6}$, which gives $x_{0}=\frac{2 \pi}{3}$ or $x_{0}=\frac{3 \pi}{4}$.