so we draw a very steep
right triangle with the opposite = 8 and the adjacent = 1.
The small sharp angle at the top is the complement of q
So
"COtangent" is an abbreviation for "COmplement's tangent",
and cot(p/2-q) IS q's COmplement's tangent.
That's why both are equal.
The opposite side of q is the adjacent side of p/2-q and vice-versa.
Edwin