Determining empirical formula and balancing equations