Rotating Matrix by $180$ degrees through another matrix To rotate a $2\times2$ matrix by $180$ degrees around the center point, I have the following formula:
$PAP$ = Rotated Matrix, where
$$P =\begin{bmatrix}
0 & 1\\ 
1 & 0
\end{bmatrix}$$
$$A= \begin{bmatrix}
a & b\\ 
c & d
\end{bmatrix}$$
And the resulting matrix will equal
\begin{bmatrix}
d & c\\ 
b & a
\end{bmatrix}
I need to have this in the form of:
$AP$ = Rotated matrix.
How would I get it to this form?

The example sheet asks for a matrix $T$ so that $AT=B$ where $A$ is $[[a,b],[c,d]]$ and $B=[[d,c],[b,a]].$ (writing 2x2 matrices as [[row1],[row2]]. Also the example sheet doesn't say that your matrix $[[0,1],[1,0]]$ needs to be involved in the matrix $T$ you're looking for.
Now note that $AT=B$ becomes $T=A^{-1}B$ when both sides are multiplied on the left by $A^{-1}.$ This makes it clear that for a solution $T$ to exist you need $A$ to be invertible, that is the determinant $ad-bc \ne 0.$ It also makes it clear that, if such a matrix $T$ exists, its entries are uniquely determined, provided $A$ is invertible.
Calculating $T$ by this formula $T=A^{-1}B$ then gives $T=[[p,q],[r,s]]$ where, using $D=ad-bc$ to abbreviate the determinant of $A$, we have
$$p=(-b^2+d^2)/D,\ q=(-ab+cd)/D,\\ r=(ab-cd)/D,\ s=(a^2-c^2)/D.$$
Of course it is natural that $T$ has coefficients depending on those of the matrices $A,B$ since they were used to calculate $T$. This makes one wonder why bother computing $T$ at all, since in a program it would be simpler to just rearrange the entries of a given matrix $A$, rather than come up with a matrix $T$ which can only be computed if you already know the "rotated" matrix $B$.
