text: how to invent chemical formula? how to invent formulas & if we have something how we could know that what elements does it contain a "regular joe" can almost never know unless it is printed on the label.  you could also google the name of the substance, and maybe you'll get lucky.  as for scientists, we use gcms which stands for gas chromatography / mass spectroscopy.  we can also use nmr or nuclear magnetic resonanace.    super heat the substance to a vapor and then pass light through a sample.  the amount of light absorbed is often an indicator of amounts and types of elements.  bombard a substance with electrons and watch for light emitted.  when eletrons hit a particular molecule, they give off vey specific energy in the form of light or heat.  these are often indicators of the amount and type of elements.