Actually Welcome to the Concept of the Similarities.
Since here, first figure is a Triangle, hence similarity of a triangle is given by ratio of it sides and make them equate,
hence for,
1.) 16/12 = x/9 ===> 4/3 = x/9 ===> x = 9*4/3 ==> x = 36/3
hence the value of x is 12 , ===> x = 12 .
2.) here,in the case of a Reactangle the relation is such that, length = 2* breadth,
hence we apply the relation,
x = 2*4.5 ===> x = 9 units.