# The matrix $C$ such that $B = CA$ where $B$ is $A$ except with two rows swapped

If I have a matrix $A \in \mathbb{M}_{n \times n}(\mathbb{R})$, and $B$ is just the matrix $A$ with the rows $s$ and $t$ swapped for $1 \leq s < t \leq n$, how would I find the matrix $C$? I think this will be the identity matrix, with rows $s,t$ swapped as well, but how would I intuitively/algebraically show this?

• You mean $C$ is an elementary matrix with the two rows of $I$ swapped. – StubbornAtom May 14 '17 at 8:14

We have $B=CA\iff B^T=A^TC^T$. With the last equality we work with the columns and we must show that $C^T$ is the identity matrix, with columns $s,t$ swapped. To see this, recall that if $(e_1,\ldots,e_n)$ is the standard basis of $\Bbb M_{n,1}(\Bbb R)$ and $M$ is a matrix then $Me_i$ is the $i$-th columns of $M$. Now take $i=s$ we get $C^Te_s=e_t$ and then $A^TC^Te_s=A^Te_t=Be_s$ and do the same thing for $i=t$ and for $i\ne s,t$.

$C$ is the identity matrix $I$ when you swap same rows as you did in $A$ to get $B$.

Check it to see it really works!