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?
 A: There is no such $2 \times 2$ matrix $P$ which will do what you want for a general $A$.  This is because you need to rearrange both the rows and columns and so need a matrix action on the left and on the right.  To see this explicitly, define $$P = \left[\begin{array}{cc} p_1 & p_2 \\ p_3 & p_4 \end{array} \right] $$
Compute $AP$ and notice there is never an $a$ term which appears on the bottom row.
Edit for the case where $a,b,c,d$ are fixed variables and we can write $P$ in terms of them:
If $A$ is invertible, $$P = A^{-1}B$$ where $B$ is the rotated form of $A$.  If you don't care about singular matrices (since most matrices are non-singular), then just use this.  Otherwise expand out $AP$ as I mentioned before and find values for $P$ which will make it work, if possible.
A: 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$.
A: There are matrices $A$ for which no such $P$ exists. For example, if $$A=\left[\begin{array}{cc}0 & 0\\c & d\end{array}\right]$$ for some $c,d$ not both $0$, then for any $$P=\left[\begin{array}{cc}\alpha & \beta\\\gamma & \delta\end{array}\right]$$ we have $$AP=\left[\begin{array}{cc}0 & 0\\c\alpha+d\gamma & c\beta+d\delta\end{array}\right]\neq\left[\begin{array}{cc}d & c\\0 & 0\end{array}\right].$$
Our problem, then, is worse than the impossible task of trying to find a single matrix $P$ that rotates all matrices $A$ in this way--sometimes, we can't even rotate a given matrix like this.
