### Instruction: Find the $3 \times 3$ matrix $\mathbf{M}$ such that for a $3 \times 3$ matrix $\mathbf{N},$ $\mathbf{M} \mathbf{N}$ is the result of swapping the first row and second row of $\mathbf{N},$ and doubling the third row of $\mathbf{N}.$  In other words,
\[\mathbf{M} \begin{pmatrix} a & b & c \\ d & e & f \\ g & h & i \end{pmatrix} = \begin{pmatrix} d & e & f \\ a & b & c \\ 2g & 2h & 2i \end{pmatrix}.\].### Response: To find $\mathbf{M},$ I need to figure out how to express the first row of $\mathbf{M} \mathbf{N}$ as a linear combination of the rows of $\mathbf{N}.$
Since the first row of $\mathbf{M} \mathbf{N}$ is the same as the second row of $\mathbf{N},$ I can write it as $0 \times (a,b,c) + 1 \times (d,e,f) + 0 \times (g,h,i).$
This means that the first row of $\mathbf{M}$ is $(0,1,0),$ since the coefficients of the rows of $\mathbf{N}$ are the entries of the rows of $\mathbf{M}.$
Similarly, I can find the second and third rows of $\mathbf{M}$ by looking at the coefficients of the linear combinations that produce the second and third rows of $\mathbf{M} \mathbf{N}.$
The second row of $\mathbf{M} \mathbf{N}$ is the same as the first row of $\mathbf{N},$ so I can write it as $1 \times (a,b,c) + 0 \times (d,e,f) + 0 \times (g,h,i).$
This means that the second row of $\mathbf{M}$ is $(1,0,0).$
The third row of $\mathbf{M} \mathbf{N}$ is twice the third row of $\mathbf{N},$ so I can write it as $0 \times (a,b,c) + 0 \times (d,e,f) + 2 \times (g,h,i).$
This means that the third row of $\mathbf{M}$ is $(0,0,2).$