The point of finding the row echelon form of a system of equations is doing certain operations that we are allowed to do (e. g. scalar multplication and adding/subtracting rows together) to rewrite the system into a form that we like.
The -2 is not something that followed from some formula or computation, but rather observation. Whoever solved the problem noticed that adding -2(row 1) to row 3, would get rid of the x term in the third row. Because we want the third row to not have a term with x on the left hand side, we decided that subtracting row 1 twice from the third row is a good idea because then the x from row 3 disappears.
So for a system like
3x-2y=2
4x+y=6
We could do something like multiply row 1 by -4 and multiply row 2 by 3 to get
-12x+8y=-8
12x+24y=18
Which after adding the first row to the second gives
-12x+8y=-8
0x+32y=10
Now divide the first row by - 12, and divide the second by 32 and you have succesfully rewritten the system into row echelon form
(arithmetic is not my strong suit so I might have messed up the example at some point. Hopefully you still get what I mean)