I came across the homework question that I attempted to do. After looking at the answers, and getting it wrong I didn't understand why.

I'm specifically lost at why we would get a fraction of 2/5 at the first two sentences. Could someone explain how we got this fraction, and what does it mean by 5 pieces?
If we share sweets in a ratio of 2-to-3 then for every 2 sweets that I get, you get three sweets.
Depending on the number of sweets, they could be shared out as:
Two to me and three to you, four to me and six to you, six to me and nine to you, etc.
Let's look at the first case: I get two sweets and you get three. There are five sweets altogether, so I get 2-out-of-5 and you get 3-out-of-5. As fractions these are $\frac{2}{5}$ of the sweets and $\frac{3}{5}$ of the sweets.
Let's look at the second case: I get four sweets and you get six. There are 10 sweets altogether, so I get 4-out-of-10 and you get 6-out-of-10. As fractions these are $\frac{4}{10}$ of the sweets and $\frac{6}{10}$ of the sweets. But look: $\frac{4}{10} = \frac{2}{5}$ and $\frac{6}{10} = \frac{3}{5}$.
Let's look at the third case: I get six sweets and you get nine. There are 15 sweets altogether, so I get 6-out-of-15 and you get 9-out-of-15. As fractions these are $\frac{6}{15}$ of the sweets and $\frac{9}{15}$ of the sweets. But look: $\frac{6}{15} = \frac{2}{5}$ and $\frac{9}{15} = \frac{3}{5}$.
Dude, you must know about ratio.