It's been a while since I studied linear algebra. I am trying to get the elements of a matrix to be in a certain order to follow a convention used in optics. In that context, the elements of the matrix are partial derivatives. Here, imagine the simpler scenario where I have the equations:
$2x+y=1$
$x-y=0$
I can represent these as:
\begin{bmatrix} 2 & 1 & x & 1\\ 1 & -1 & y &0 \end{bmatrix}
In the convention, I want the $x$ to be next to the $1$ and the $y$ next to the $0$. Therefor, the system can be equally represented as: \begin{bmatrix} -1 & 1& y & 0\\ 1 & 2 & x & 1 \end{bmatrix}
If I were to generalize this to a $3\times 3$ (or higher order) matrix (i.e. add another equation to the list), how could I change change the order of the elements while still keeping the $x$ next to $1$ (and $y$ next to $0$)?
In this problem, if you represent
$2x+y=1$
$x-y=0$ as
$-y+x=0$
$y+2x=1$
then you get the matrix
\begin{bmatrix} -1 & 1& y & 0\\ 1 & 2 & x & 1 \end{bmatrix}
So in general what you want to do is rearrange the variables in whichever order you prefer, then rearrange the order of the equations so that the equation with a 1 is in the position of x in the rearranged variables.
As an example if you had
$2x+y=1$
$x-y=0$
$x+y+z=0$
I can represent these as:
\begin{bmatrix} 2 & 1 &0& x & 1\\ 1 & -1 &0& y &0\\ 1&1&1&z&0 \end{bmatrix}
If you want to rearrange the variables so that it $xyz$ goes to $zyx$ then you would consider the equations as
$y+2x=1$
$-y+x=0$
$z+y+x=0$
To get the $x$ next to the 1, since for $zyx$, $x$ is in the third position, you want the equation with a 1 to be in the third position also, so
$-y+x=0$
$z+y+x=0$
$y+2x=1$ to get the matrix
\begin{bmatrix} 0 & -1 &1& z &0 \\ 1 & 1 &1& y &0\\ 0&1&2&x&1 \end{bmatrix}