The two triangles pictured - the one made by the bottom line, and the one made but the middle line - are similar, which means that the ratios of the corresponding lengths are equal. The length of the left line of the bigger triangle is 40 + 5 = 45 cm, and the length of the left line on the smaller triangle is 5 cm, so the ratio between their lengths is 45/5 = 9.
On the right side, the bigger triangle has the length 2x + 10 + 3 = 2x + 13 cm, while the smaller one has a length of 3 cm, making the ratio between their lengths (2x + 13)/3.
Setting those two ratios equal, we have
9 = (2x + 13)/3
Multiplying both sides by 3 to cancel the denominator on the right, we get
27 = 2x + 13
Subtracting away the 13:
14 = 2x
And dividing away the 2 coefficient:
7 = x
So, we find that x = 7.