Let's try to pin down the idea of the opposite category, which like "mirror image" of a catgory, obtained by systematically reversing "left" and "right" in the construction of a category. Where do left and right appear?

Consider a morphism \$$f: A \rightarrow B\$$. We may view this as a relationship between \$$A\$$ and \$$B\$$, which object \$$A\$$ on the left and object \$$B\$$ on the right. In a mirror image category, we could have a twin morphism \$$f'\$$, with the labelling reversed, so that the left object of \$$f'\$$ is \$$B\$$ and the right object is \$$A\$$.

The standard names for 'left' and 'right' are 'domain' and 'codomain'.

The opposite of a category \$$X\$$ has the same objects as \$$X\$$, and its system of morphisms consists of all the twins \$$f'\$$ for morphisms \$$f\$$ in \$$X\$$.

The reversal is stated by the following equations:

\$dom(f') = cod(f)\$
\$cod(f') = dom(f)\$

Now suppose that \$$f: A \rightarrow B\$$, \$$g: B \rightarrow C\$$ in \$$X\$$. This is a composable pair, and we may designate the composition by \$$f \triangleright g\$$.

To distinguish composition in the opposite category \$$X'\$$, let's use a different symbol for the composition operator.

For morphisms \$$u, v\$$ in \$$X'\$$, we'll write \$$u \triangleleft v\$$ for their composition in \$$X'\$$.

Having established notation, let's turn our attention back to our composable pair \$$f \triangleright g\$$ in \$$X\$$.

The question naturally arises: how can we form a composable pair from \$$f'\$$ and \$$g'\$$ in the opposite category \$$X'\$$?

First let's try \$$f' \triangleleft g'\$$. For that to work, as always, in any category, we would require that \$$cod(f') = dom(g')\$$.

But \$$cod(f') = dom(f)\$$, which is not equal to \$$dom(g') = cod(f)\$$. Bzzt.

The only other choice for the composable pair is \$$g' \triangleleft f'\$$, and this works well. Indeed, we have that \$$cod(g') = dom(f')\$$, which follows from that \$$cod(f) = dom(g)\$$.

In a word:

\$g' \triangleleft f' = (f \triangleright g)'\$

These three equations define the transformation of a category \$$X\$$ into its opposite category \$$X'\$$.