Emily solved a problem about the number of apples and pears in a box where the number of rotten pieces from each fruit must be equal. She defined a as the number of apples and p as the number of pears, then set up the equation a+p=total pieces of rotten fruit and solved it to find that the fraction of rotten fruit in the box is equal to the number of rotten apples divided by the total number of fruits.