The first thing to recognise about this probability question, is the probability of eating an orange sweet from the bag. When she first puts her hand in the bag, there are a total of n sweets in the bag, and 6 of them are orange. So the probability of eating an orange sweet when chosen at random, is 6/n. Now, there is one less sweet in the bag after Hannah has eaten her first orange sweet. This is important as it changes the chances of picking an orange sweet. Now there are a total of n-1 sweets in the bag, 5 of which are orange. So the probability of choosing an orange sweet at random now, is 5/(n-1). Multiplying these together as independent probabilities, we get that the probability of eating two orange sweets from the bag is: 6/n * 5/(n-1) , in the question, we are told that this is 1/3. So, 30/n(n-1) = 1/3. Multiplying both sides of this equation by 3n(n-1), gives: 90 = n(n-1). Expanding the bracket on the right hand side of the equation and we are left with: 90 = n^2 - n, or, n^2 - n -90 = 0.
That's the first part of the question done with. Now we need to solve this equation to find n. We should try and factorise n^2 - n - 90. Thinking of factors of -90 that have a sum of -1, and you should be able to come up with -10 and 9. So, now we can write: n^2 - n - 90 = (n+9)(n-10) = 0. Usually with an equation like this you get to answers, n=-9 and n=10, as either of these satisfy the equation. But we know that in real life, you can't ever have -9 sweets, so n must be equal to 10.