The smaller triangle is similar to the larger triangle, which means corresponding sides occur in a fixed ratio. In particular, this means
2x/(x + 9) = (length of shortest leg in smaller triangle)/(2 times the same length)
since in the larger triangle, the shortest leg is twice as long as the shortest leg in the smaller triangle. (The ticks on the line segments mean they are congruent and have the same length.)
So
2x/(x + 9) = 1/2
4x = x + 9
3x = 9
x = 3