9. Given that the function $g(x)=\cos x$ is transformed by stretching all points on its graph vertically by a factor of 2 (keeping the horizontal coordinates unchanged), and then shifting the resulting graph to the right by $\frac{\pi}{2}$ units to obtain the graph of the function $y=f(x)$, and that the equation $f(x)+g(x)=m$ has two distinct solutions $\alpha, \beta$ in the interval $[0,2 \pi)$.
(1) Find the range of real numbers $m$ that satisfy the condition;
(2) Find $\cos (\alpha-\beta)$ (expressed in terms of $m$).
(1) Stretching the vertical coordinates of all points on the graph of $g(x)=\cos x$ to twice their original length (the horizontal coordinates remain unchanged) yields the graph of $y=2 \cos x$. Then, shifting the graph of $y=2 \cos x$ to the right by $\frac{\pi}{2}$ units results in the graph of $y=2 \cos \left(x-\frac{\pi}{2}\right)$, hence $f(x)=2 \sin x$,
$$
f(x)+g(x)=2 \sin x+\cos x=\sqrt{5} \sin (x+\varphi)
$$
(where $\sin \varphi=1 / \sqrt{5}, \cos \varphi=2 / \sqrt{5}$ ), according to the problem, $\sin (x+\varphi)=\frac{m}{\sqrt{5}}$ has two distinct solutions $\alpha, \beta$ in the interval $[0,2 \pi)$, if and only if $\left|\frac{m}{\sqrt{5}}\right|<1$, thus the range of $m$ is $(-\sqrt{5}, \sqrt{5})$.
6 points
(2) Since $\alpha, \beta$ are two distinct solutions of the equation $\sqrt{5} \sin (x+\varphi)=m$ in $[0,2 \pi)$, we have
$$
\sin (\alpha+\varphi)=\frac{m}{\sqrt{5}}, \quad \sin (\beta+\varphi)=\frac{m}{\sqrt{5}}
$$

When $1 \leq m<\sqrt{5}$, $\alpha+\beta=2\left(\frac{\pi}{2}-\varphi\right)$, i.e., $\alpha-\beta=\pi-2(\beta+\varphi)$; when $-\sqrt{5}<m<1$, $\alpha+\beta=2\left(\frac{3 \pi}{2}-\varphi\right)$, i.e., $\alpha-\beta=3 \pi-2(\beta+\varphi)$.
11 points Therefore, $\cos (\alpha-\beta)=-\cos 2(\beta+\varphi)=2 \sin ^{2}(\beta+\varphi)-1=2\left(\frac{m}{\sqrt{5}}\right)^{2}-1=\frac{2 m^{2}}{5}-1$.
14 points