This is done by reducing each number by a common factor for each formula.
C3H6O6- all can be divided by 3 -> CH3O3 (you don't have to put a 1 for C, only if your teacher requests it. It is generally understood if not written)
H2O2- all can be divided by 2 -> H1O1 (had to put the 1's bc of the unintended language)
C8H8S2- all can be divided by 2 -> C4H4S
P5O15- all can be divided by 5- PO3
*****it is important to note that all numbers in the molecular formula are divided by the same thing to reduce them. decimals are never used in empirical formulas, only whole numbers.*****