a)
If the triangles are similar, the corresponding sides vary on the same proportion, so the ratios between the corresponding sides are equal.
For

To solve for x you have to multiply both sides of the expression by 20

b)
Following the same logic, the ratio between x and 20 is the same as the ratio between 6 and 8

6/8 can be simplifies as 3/4. Then multiply both sides by 20 to determine the value of x.

As mentioned above, when two triangles are similar, the corresponding sides are always in the same ratio, that is why the results in a and b are the same.