How to calculate the mass of an element in a sample of a compound?

What calculations are needed to express the grams of an element from a compound dissolved in aqueous solution? For example, I have a $0.5\,\mathrm{M}$ glucose aqueous solution and I want to know how many grams of $\ce{O}$ are in there.


I have tried to calculate in this way:


* Molecular weight of glucose = $180.159 \mathrm{\frac{g}{mol}}$
* Atomic weight $\ce{C} = 72$; $\ce{H} = 12.09$; $\ce{O} = 96$;
* I am considering $0.5\,\mathrm{M}$, so in $1\,\mathrm{L}$ I have $90.08\,\mathrm{g}$ of glucose
* At this point I divide the molecular weight of glucose by the atomic weight of oxygen $\frac{90.08}{96}$, but I don't think it is correct.




As suggested in the comments, keep track of the units! If your answer doesn’t make physical sense, you made a mistake. 


A thorough approach to this problem is to:



> 
> 1. calculate how much glucose you have.
> 2. calculate the fraction of oxygen in glucose.
> 3. multiply the (unitless) fraction found in (3) by the total glucose calculated in (1).
> 
> 
> 


Using the values (and associated units) given in your problem: 



> 
> 1. $0.5 \pu{\frac{mol}{L}} \text{ glucose}\times \pu{1 L} \text{ glucose}\times \pu{180.16 \frac{g}{mol}}$ glucose = $\pu{90.08 g}$ glucose.
> 2. $\frac{\pu{96 g mol^-1} \ce{O}}{\pu{180.16 g mol^-1} \text{glucose}} = 0.533$
>  mole fraction of $\ce{O}$ / glucose.
> 3. $0.533 \times \pu{90.08 g}$ glucose = $\pu{48 g} ~\ce{O}$
> 
> 
> 


Of course there are many shortcuts you could take or even different approaches altogether, but I like to parse a problem like this down stepwise in a way that shows what you are doing and facilitates keeping track of units. This makes troubleshooting much easier and systematic if you find you've made a mistake or want to walk through it a second time to verify what you've done (as you definitely should!).


 2