20. 设 $\triangle A B C$ 的内角 $A, B, C$ 所对边的长分别是 $a, b, c$, 且 $b=3, c=1, A=2 B$.

(I) 求 $a$ 的值;

(II) 求 $\sin \left(A+\frac{\pi}{4}\right)$ 的值.
: ( I ) $\because A=2 B, \therefore \sin A=\sin 2 B=2 \sin B \cos B$,

由正弦定理得 $a=2 b \cdot \frac{a^{2}+c^{2}-b^{2}}{2 a c}$

$\because b=3, c=1, \therefore a^{2}=12, a=2 \sqrt{3}$.

(II) 由余弦定理得 $\cos A=\frac{b^{2}+c^{2}-a^{2}}{2 b c}=\frac{9+1-12}{6}=-\frac{1}{3}$,

由于 $0<A<\pi, \therefore \sin A=\sqrt{1-\cos ^{2} A}=\sqrt{1-\left(-\frac{1}{3}\right)^{2}}=\frac{2 \sqrt{2}}{3}$,

故 $\sin \left(A+\frac{\pi}{4}\right)=\sin A \cos \frac{\pi}{4}+\cos A \sin \frac{\pi}{4}=\frac{2 \sqrt{2}}{3} \times \frac{\sqrt{2}}{2}+\left(-\frac{1}{3}\right) \times \frac{\sqrt{2}}{2}=\frac{4-\sqrt{2}}{6}$.