$\tan x = \frac{b}{a} \Rightarrow \sin x = \frac{b}{\sqrt{a^2 + b^2}}$ and $\cos x = \frac{a}{\sqrt{a^2 + b^2}}$.
Substitute these results into $\cos (2x) = \cos^2 x - \sin^2 x$ and $\sin (2x) = 2 \sin x \cos x$.