5. Let $k$ and $\theta$ be real numbers such that the roots of the equation $x^{2}-(2 k+$ 1) $x+k^{2}-1=0$ are $\sin \theta$ and $\cos \theta$. Then the range of $\theta$ is $\qquad$.
$5 . \theta=2 k_{1} \pi+\pi$ or $2 k_{1} \pi-\frac{\pi}{2}$ ( $k_{1}$ is any integer $)$.
By Shuda's theorem, we get
$$
\sin \theta+\cos \theta=2 k+1 \cdot \sin \theta \cdot \cos \theta=k^{2}-1 \text {. }
$$

From $\sin ^{2} \theta+\cos ^{2} \theta=1$ we get
$(\sin \theta+\cos \theta)^{2}-2 \sin \theta \cdot \cos \theta=1$.
Then $(2 k+1)^{2}-2\left(k^{2}-1\right)=1$,
which simplifies to $(k+1)^{2}=0$. Therefore, $k=-1$.
$\mathrm{J} \cdot$ Thus, $\sin \theta \cdot \cos \theta=0$, which means $\sin 2 \theta=0$.
Hence, $2 \theta=k_{1} \pi, \theta=k_{1} \cdot \frac{\pi}{2}$ ( $k_{1}$ is an integer $)$.
Furthermore, since $\sin \theta+\cos \theta=-1$. Therefore, $\theta=2 k_{1} \pi+\pi$ or $2 k_{1} \pi-\frac{\pi}{2}\left(k_{1}\right.$ is any integer $)$.
Note: It is easy to incorrectly answer $\theta=k_{1} \cdot \frac{\pi}{2}$ ( $k_{1}$ is any integer).