What is the percentage of oxygen in____?

Mg(OH)2

Does it say percentage by mass or percentage of atoms or what?

I will assume percentage of mass.
Now O atoms have a mass of about 16 grams per about 6*10^23 of them (Avagadro's number, sort of like 12 is a dozen, 6*10^23 is a mole)
So in a mole of this stuff we have 32 grams of O
H atoms have a mass of about 1 gram per 6^10^23 of them so in a mole of this stuff we have 2 grams of H
Mg has a mass of about 24.3 grams per mole so we have about 24.3 grams of MG
so in total we have
O = 32 grams
H = 2 grams
Mg = 24.3 grams
so the total mass of a mole or 6*10^23 molecules = 58.3 grams
so
percent O = (32/58.3) 100 = 54.9 %
Now I was not careful about significant figures or arithmetic here so use your periodic table and do all that more carefully.

To find the percentage of oxygen in Mg(OH)2, we first need to determine the molar mass of the compound.

The molar mass of Mg(OH)2 can be calculated by adding up the atomic masses of all the atoms in the compound.

Mg: The atomic mass of Magnesium (Mg) is 24.31 grams/mol.
O: The atomic mass of Oxygen (O) is 16.00 grams/mol.
H: The atomic mass of Hydrogen (H) is 1.01 grams/mol.

Next, let's calculate the molar mass of Mg(OH)2:
Mg: 1 atom x 24.31 g/mol = 24.31 g/mol
O: 2 atoms x 16.00 g/mol = 32.00 g/mol
H: 2 atoms x 1.01 g/mol = 2.02 g/mol

Adding up the masses of each element gives us:
Molar mass of Mg(OH)2 = 24.31 g/mol + 32.00 g/mol + 2.02 g/mol = 58.33 g/mol

Now, let's find the percentage of oxygen in the compound. The percentage of oxygen can be calculated using the following formula:

Percentage of Oxygen = (Mass of Oxygen / Molar mass of Mg(OH)2) x 100

Since there are 2 oxygen atoms in Mg(OH)2, the mass of oxygen is 2 x 16.00 g/mol = 32.00 g/mol.

Plugging in the values into the formula:
Percentage of Oxygen = (32.00 g/mol / 58.33 g/mol) x 100 = 54.88%

Therefore, the percentage of oxygen in Mg(OH)2 is approximately 54.88%.