Its not really that hard to figure out.To put it in simple terms. Actually I cant.( i just looked at it & knew( MAth wiz but dont ask me to explain).
The red triangle is 1 bolck higher than the green& longer than the green. So when you swap them you need to move the yellow one down, to compensate. Obvously you will have one space( you put 3 blocks over 2 you will obviously have one space.
Dont think to hard.