It has nothing to do with the fact that the triangles are right triangles.
It has to do with the fact that they are similar.
Triangle ABC is similar to triangle DEC
Therefore AB is to BC as DE is to EC


From the figure we see that
AB = x, BC = BE+EC = 2+x, DE = 1, EC = x
Substituting,


Cross multiply:




Factor the left side:


x-2 = 0; x+1 = 0
x = 2; x = -1
Ignore the negative answer.
Solution x = 2.
So the figure is
Edwin