Using that difference formula, we just need to deduce the following values
$$\cos(\theta) = \frac{3}{5},\quad \cos(X) = -\frac{1}{2},\quad \sin(\theta) = -\frac{4}{5},\quad \text{ and } \quad \sin(X) = \frac{\sqrt{3}}{2}.$$
The first one is given, so we just need to determine the other three.
First let's show that $\sin(\theta) = -4/5$. Recall that $(\cos(\theta),\sin(\theta))$ is the point on the unit circle corresponding to $\theta$ (which is in Quadrant IV). So by the Pythagorean theorem,
$$\sin^2(\theta) + \cos^2(\theta) = 1.$$
Since $\cos(\theta) = 3/5$, we get $\sin^2(\theta) = 16/25$. We noted that $\theta$ is in Quadrant IV, so we must have $\sin(\theta) = -4/5$ (as opposed to $+4/5)$.
To determine the remaining two values, note that the equation $\tan(X) = -\sqrt 3$ has a unique solution in Quadrant II (up to added integer multiples of $2\pi$). Namely, $X = \frac{2\pi}{3} + 2\pi k,$ for some integer $k$. Since $\sin$ and $\cos$ are $2\pi$-periodic, we get
$$\sin(X) = \sin\left(\frac{2\pi}{3}\right) = \frac{\sqrt 3}{2} \qquad \text{ and } \qquad \cos(X) = \cos\left(\frac{2\pi}{3}\right) = -\frac{1}{2}.$$