$\cos ^{-1} x-\cos ^{-1} y$ $$
\cos ^{-1} x-\cos ^{-1} y=\left\{\begin{array}{l}
\cos ^{-1}\left(x y+\sqrt{1-x^{2}} \sqrt{1-y^{2}}\right) ; \text { if }-1 \leq x, y \leq 1 \quad \text{and} \quad x \leq y \\
-\cos ^{-1}\left(x y+\sqrt{1-x^{2}} \sqrt{1-y^{2}}\right) ; \text { if }-1 \leq y \leq 0,0<x \leq 1 \quad \text{and} \quad x \geqslant 1
\end{array}\right.
$$
I'm having some issues proving for different cases, this is what I tried so far:
Let $\cos ^{-1} x=\alpha, \quad \cos ^{-1} y=\beta \quad \Longrightarrow \quad x=\cos \alpha, y=\cos \beta$
$$
\begin{aligned}
\cos (\alpha-\beta) &=\cos \alpha \cos \beta+\sin \alpha \sin \beta \\
&=\cos \alpha \cos \beta+\sqrt{1-\cos ^{2} \alpha} \sqrt{1-\cos ^{2} \beta} \\
&=\left(x y+\sqrt{1-\cos ^{2} \alpha} \sqrt{1-\cos ^{2} \beta}\right)
\end{aligned}
$$
$$
\begin{aligned}
\therefore \alpha-\beta &=\cos ^{-1} x-\cos ^{-1} y \\
&=\cos ^{-1}\left(x y+\sqrt{1-x^{2}} \sqrt{1-y^{2}}\right)
\end{aligned}
$$

$\cos^{-1}z$ will be real $\iff-1\le z\le1$
Now as $0\le\cos^{-1}x,\cos^{-1}y\le\pi,$
$$-\pi<\cos^{-1}x-\cos^{-1}y\le\pi$$
$$\cos^{-1}(xy+\sqrt{(1-x^2)(1-y^2)})\text{ will be }=\cos^{-1}x-\cos^{-1}y$$
$$\iff\cos^{-1}x-\cos^{-1}y\ge0$$
$$\iff\dfrac\pi2-\sin^{-1}x\ge\dfrac\pi2-\sin^{-1}y\iff\sin^{-1}x\le\sin^{-1}y\iff x\le y$$  as $\sin^{-1}x$ is an increasing function
Similarly, $$\cos^{-1}(xy+\sqrt{(1-x^2)(1-y^2)})\text{ will be }=\cos^{-1}y-\cos^{-1}x\iff 
 y\le x$$
See also: Proof for the formula of sum of arcsine functions $ \arcsin x + \arcsin y $
