Hi there!
To answer this question you want to make use of your handy Periodic Table.
When we look at the Periodic Table we can find the two elements in question Yttrium and Oxygen. Once you find them you want to see which column you find them in. We find Yttrium in the 3rd column from the right and this gives us a clue that Yttrium will have a +3 charge when it becomes an ion.
When you find Oxygen you see that it is found in the third column from the left and we know elements in that column typically have a -2 charge when they form ions.
Okay so Y3+ and O2-... well if we combine these two ions to form an ionic compound (which has to have an overall charge of zero) we would need 2 of the Yttrium ions to balance out 3 of the Oxygen atoms.
We sometimes call that criss-crossing to find the formula for an ionic compound!!
So to recap Y3+ and O2- make Y2O3!!
Best,
Biraaj :)