9. Find the range of the function $y=(\sin x+3 \sqrt{2})(\cos x+3 \sqrt{2})$.
9. $y=(\sin x+3 \sqrt{2})(\cos x+3 \sqrt{2})=\sin x \cos x+3 \sqrt{2}(\sin x+\cos x)+18$, let $\sin x + \cos x = t$, then $\sin x \cos x = \frac{1}{2}(t^2 - 1)$, and $t \in [-\sqrt{2}, \sqrt{2}]$, $y = \frac{1}{2}(t^2 - 1) + 3 \sqrt{2} t + 18 = \frac{1}{2} t^2 + 3 \sqrt{2} t + 17 \frac{1}{2} = \frac{1}{2}[t + 3 \sqrt{2}]^2 + 8 \frac{1}{2}$. When $t = \sqrt{2}$, $y_{\text{max}} = 24 \frac{1}{2}$, at this time $x = 2k\pi + \frac{\pi}{4}$; when $t = -\sqrt{2}$, $y_{\text{min}} = 12 \frac{1}{2}$, at this time $x = 2k\pi + \frac{5}{4} \pi$.