And I don't exactly get what you are trying to ask hit me back up though
Mg3(PO4)2 - the molar mass would be 262g/mol, which is 100%
Atomic mass of Mg is 24, since we have 3Mg we multiply by 3 and get a mass of 72
262 : 100% = 72 : x%
x = 72*100 / 262
x = 27.5%
And do that for every element — get the molar mass of P and multiply by 2, use a ratio, and get the molar mass of O and multiply by 8 and use ratios :)
X is the answer that we do not know yet!!:)