Firstly, you need to consider the type of problem we are dealing with. This is actually just a tree diagram type question. note that the sweets are not replaced.
Letting n = number of sweets in the bag. 6 are orange and n-6 are yellow. In the first selection, there are two possibilities, either yellow or orange, this is the same in the second selection. We are told that the probability of choosing two orange sweets in a row is 1/3.
From this we can set up an equation:
The probability of choosing an orange sweet on the first go is 6/n , as we have 6 orange sweets out of a total of n to pick from. This means that there are 5 orange sweets and n-1 sweets in total.
The probability of choosing another orange sweet the second time around will be 5/(n-1). Now, in a tree diagram, when considering two selections for an overall outcome, the probabilities of the outcomes are multiplied for the final probability, as we are already given this, we can set up the quadratic equation.
6/n * 5/(n-1) = 1/3
30/(n2-n)=1/3
90=n2-n
n2-n-90=0
factorising:
(n-10)(n+9)=0
n=10, n=-9
The number of sweets cant be negative, n>0 therefore the value for n is 10