elementary matrices and row operations I am studying for an exam tomorrow and this is one of the problems given. The instructor gave the solution but I do not understand how he found the solution. The question is "write down the elementary matrices E1, E2 that correspond to the row operations you performed in part (a) in the order you performed them. Are these matrices 3x3 or 5x5?" In that answer, he says that they are 3x3. The first row of the matrix E1 is 1 0 0. The second row is 1 1 0. The third row is 0 0 1. The first row of the matrix E2 is 1 0 0. The second row is 0 1 0. The third row is 0 -1 1. How did he get this solution? The first row operation from part a was R1 + R2. The second row operation from part a was -R2 + R3. I do not understand the concept of an elementary matrix. 
 A: If I decode your question correctly, you say that you're told that the correct answer is
$$E_1=\pmatrix{1&0&0\\1&1&0\\0&0&1},\quad E_2=\pmatrix{1&0&0\\0&1&0\\0&-1&1}$$
But you don't tell us the complete story of what this is the complete answer to, right?
I imagine that you must have had a $3\times 5$ matrix such as
$$A=\pmatrix{1&2&0&4&5\\-1&-2&4&1&1\\0&0&4&8&16}$$
After the first row operation you had another matrix
$$B=\pmatrix{1&2&0&4&5\\0&0&4&5&6\\0&0&4&8&16}$$
You describe this operation as

The first row operation from part a was $R_1 + R_2$.

but that is not a complete description of a row operation; it describes how to make a new row (namely, take the sum of the first and second rows), but not what you do with that new row. You should have said

The first row operation was to replace $R_2$ with $R_1+R_2$.

The way the elementary matrix works is that it encodes your row operation as a matrix multiplication from the left:
$$E_1 A = B$$
(Write this out and compute the entires of the product matrix to see how it works!)
The reason it works is that the rows of the elementary matrix are all equal to the corresponding rows of the 3×3 identity matrix, except for the second row, which is the one your row operation modifies. Thus the other rows will be left unchanged by the operation. The second row of $E_1$ is $(1\;1\;0)$, which has ones in the first position and encodes how you make the new second row, namely as $R_1+R_2$, or a bit more verbosely, $1\cdot R_1+1\cdot R_2+0\cdot R_3$. Note how the coefficients here match the row from the elementary matrix exactly.
In the second row operation the row of $E_2$ that corresponds to the "new" row is $(0\;-1\;1)$, which means that we're replacing $R_3$ with $0\cdot R_1+(-1)\cdot R_2+1\cdot R_3$, which is the same as $R_3-R_2$. So we get
$$\pmatrix{1&2&0&4&5\\0&0&4&5&6\\0&0&0&3&10} = E_2B = E_2 E_1 A$$
