the ratio of tomatoes to red apples is

this ratio must be the same when you have 20 tomatoes, this means that:

where x is the (unknow) number of apples. Hence, we have:

then, we need to divide 20 into 2/5. We can do that by applying the "sandwich law":

therefore, if there are 20 tomatoes, we have 50 apples.