The main problem is counting the different selfavoiding layouts that can be produced using the four tiles of the following figure:
An admissible layout begins with $A$, ends with $B$, and contains $4$ $L/R$ tiles. We may assume that the first such tile is an $L$ (and multiply by $2$ at the end). There are $8$ $L/R$ words of length $4$ beginning with $L$, namely
$$LLLL, LLLR, LLRL, LLRR,LRLL, LRLR,LRRL,LRRRR\ .$$
These words have to be decorated with $A$, $B$ and six letters $S$, whereby certain $S$ are compulsory. We then obtain the following $8$ patterns, whereby at the dots optional letters $S$ may be filled in:
$$\eqalign{p_1:\quad&A\cdot LS\cdot LS\cdot LS\cdot L\cdot B \cr
p_2:\quad&A\cdot LS\cdot LS\cdot L\cdot R\cdot B \cr
p_3:\quad&A\cdot LS\cdot L\cdot R\cdot L\cdot B \cr
p_4:\quad&A\cdot LS\cdot L\cdot RS\cdot R\cdot B \cr
p_5:\quad&A\cdot L\cdot R\cdot LS\cdot L\cdot B \cr
p_6:\quad&A\cdot L\cdot R\cdot L\cdot R\cdot B \cr
p_7:\quad&A\cdot L\cdot RS\cdot R\cdot L\cdot B \cr
p_8:\quad&A\cdot L\cdot RS\cdot RS\cdot R\cdot B \cr}$$
These $8$ patterns fall into three types:
(i) The pattern $p_1$ contains four consecutive equal turns, and has to be treated using a case analysis in order to ensure selfavoiding.
(ii) The two patterns $p_2$ and $p_7$ contain three consecutive equal turns, and have to be treated using a case analysis in order to ensure selfavoiding. (Note that $p_7$ is equivalent to $p_2$.)
(iii) The remaining patterns are selfavoiding however we fill in the optional letters $S$. The number of ways to do this is a stars and bars problem for each $p_k$, depending on the number of compulsory letters $S$ in $p_k$.
Assume that the total number $N$ of selfavoiding layouts has been determined. We then have to distribute the picture tiles on these layouts. The number $M$ of possibilities is the same for all layouts. Concerning the two pictures occurring twice assume that they are "secretly" different, and divide by $2\cdot2$ at the end. In this way we obtain
$$M={6!\> 2^6\>4!\over2\cdot2}=276\,480\ .$$
For illustration, imagine the same problem but with a five element set: {A,B,C,D,E}.
Part 1:
As @lulu mentioned, there are two choices that determine the other two choices. Therefore, you can have: AB,AC,BC,AD,BD,CD,AE,BE,CE,DE as the pairs of two choices. If order mattered, then we would be able to count the 4-sequences for each pairing, ex: AABB,ABAB,ABBA,BABA,BAAB,BBAA for pairing AB. Since order doesn't matter, these are all equivalent to the subset {A,A,B,B}. Based on the question's use of "chosen", I am left to assume the sequence does not matter, only the set. In this case, there are ${5 \choose 2 } = 10$ possible sets, as we enumerated above.
Part 2:
Since we are choosing sets, sequences do not matter. In this choice, we still choose two elements that determine the set. If order mattered, we would have sequences like AAAB,AABA,ABAA,BAAA for choice AB. Since order doesn't matter, these are all equivalent to the subset {A,A,A,B} and the answer is still the same: ${5 \choose 2 } = 10$ possible sets. However, as pointed out in the comment below, {B,B,B,A} is the other possible subset, so we multiply by two to arrive at 20 possible sets.
Therefore, from the {A,B,C,D,E,F,G,H,I}, your answers are ${9 \choose 2 } = 36$ possible sets for part 1 and ${9 \choose 2 }\times 2=72$ for part 2, and the unique parings come from two choices: AB,AC,BC,AD,BD,CD,AE,BE,CE,DE,AF,BF,CF,DF,EF,AG,BG,CG,DG,EG,FG,AH,BH,CH,DH,EH,FH,GH,AI,BI,CI,DI,EI,FI,GI,HI.
Bonus: if order did matter, and we are now talking about sequences:
Part 1: Use the multiplication principle. We have four locations, and choose two, the other two are determined from the constraint: ${4 \choose 2 } = 6$. Then, to fill the two chosen locations, we may choose ${5 \choose 2 } = 10$ different pairs. Therefore, the number of sequences is ${4 \choose 2 } {5 \choose 2 } = 6\times 10 = 60$, which can be written out and verified.
Part 2: Same idea, except now we choose 3 or equivalently, 1: ${4 \choose 3 } = {4 \choose 1 } = 4$ and the number of sequences is ${4 \choose 3 } {5 \choose 2 } = 4\times 10 = 40$. As in the choice problem, since we could have {A,A,A,B} or {B,B,B,A} from choice AB, we multiply by two again, to arrive at 80 sequences.
Therefore, for your question:
- ${4 \choose 2 } {9 \choose 2 } = 6\times 36 = 216$
- ${4 \choose 3 } {9 \choose 2 }\times 2 = 4\times 36 \times 2 = 288$
Best Answer
How would you get a two-element subset? You draw one tile from the bag and then another one; if it is the same as the first tile, discard it and draw another one; repeat until you get a different one.
You'd obtain the same if you discard repeated tiles from the beginning.
Since the distinct letters are eight
C O M P
OS I TIONSyou get …