The quantity of water in a beaker does not matter in determining the temperature change because the beaker is a good conductor of heat and has a much larger thermal mass than the water. Therefore, any heat energy that is transferred to or from the water will be quickly absorbed or released by the beaker, resulting in a negligible change in temperature of the beaker itself.
On the other hand, the quantity of water in a polystyrene cup does matter because the polystyrene cup is a poor conductor of heat and has a much smaller thermal mass than the water. Therefore, any heat energy that is transferred to or from the water will have a much greater effect on the temperature of the water. The particle theory of matter explains that heat energy is transferred by the movement of particles. When the water and the cup are in thermal equilibrium, the particles of the water and the cup have the same average kinetic energy. As a result, the temperature of the water and the cup are the same.
In summary, the quantity of water in the polystyrene cup matters because it has a smaller thermal mass and is a poor conductor of heat, so any heat energy transferred to or from the water has a greater effect on the temperature of the water. Conversely, the quantity of water in a beaker does not matter because the beaker is a good conductor of heat and has a much larger thermal mass than the water, so any heat energy transferred to or from the water is absorbed or released by the beaker, resulting in a negligible change in temperature.