We have the following picture ($r=1$. $AB$ is the prime meridian):

We can find the coordinates of $C$ using:
$$ x = \sin(b)\cos(a)$$
$$ y=\sin(b)\sin(a)$$
$$ z = \cos(b) $$
I understand this geometrically, but then they do this:

So basically, the z-axis gets shifted in a way that $B$ is now the north pole. They go on to say that the new coordinates of $C$ are:
$$ x' = \sin(a)\cos(180-b) = -\sin(a)\cos(b) $$
$$ y' = \sin(a) \sin(180-b) = \sin(a)\sin(b) $$
$$ z' = \cos(a) $$
I only understand that $$ z' = \cos(a)$$, but I can't geometrically visualize why $x'$ and $y'$ are as stated (why the "180- .." ?)
They go on to confuse me even more, saying that this gives us:
$$ - \sin(a)\cos(B) = \sin(b) \cos(A) \cos(c) - \cos(b) \sin(c) $$
$$ \sin(a)\sin(B) = \sin(b)\sin(A)$$
$$ \cos(a) = \sin(b)\cos(A)\sin(c) + \cos(b) \cos(c) $$
which gives us
$$ \cos(a) = \cos(b) \cos(c) + \sin(b)\sin(c)\cos(A)$$
I don't understand this part at all, I don't understand where they got this from and I don't understand the random capitalization of the letters. Can someone help me understand this badly-written booklet.