Question 1207003
## Analyzing the Problem and Defining Indicator Variables
We're considering a scenario where n children of each hat color are randomly seated in n chairs of each color. The random variable X_n counts the number of color matches.

To simplify the analysis, we can define indicator variables:

* **I_i:** This equals 1 if the ith child is seated in a chair of the same color as their hat, and 0 otherwise.

So, X_n = I_1 + I_2 + ... + I_3n.

## (a) Largest Possible Value and Probability
The largest possible value of X_n is **n**. This occurs when all children are seated in chairs of their respective colors.

To calculate the probability of this happening, consider the first red-hatted child. They have n choices of red chairs. The second red-hatted child has n-1 choices, and so on. Thus, the total number of ways to seat the red-hatted children in red chairs is n!. Similarly, for green and blue-hatted children.

The total number of ways to seat all 3n children is (3n)!.

Therefore, the probability of X_n = n is:

P(X_n = n) = (n!)^3 / (3n)!

## (b) Expected Value of X_n
We can use the linearity of expectation to find E(X_n):

E(X_n) = E(I_1 + I_2 + ... + I_3n)
= E(I_1) + E(I_2) + ... + E(I_3n)

For any i, P(I_i = 1) = 1/3 (since there's a 1/3 chance of a color match). 
Therefore, E(I_i) = 1/3.

So, E(X_n) = 3n * (1/3) = n.

## (c) Variance of X_n
To find the variance, we'll use the formula Var(X) = E(X^2) - (E(X))^2.

First, let's find E(X^2):

E(X^2) = E[(I_1 + I_2 + ... + I_3n)^2]
= E[ΣI_i^2 + 2ΣΣI_iIj] (where i ≠ j)

Now, E(I_i^2) = E(I_i) = 1/3.

For E(I_iIj), we consider two cases:
1. **i and j are of the same color:** 
   * If i and j are both red, for instance, there are n ways to seat the first, n-1 ways to seat the second, and (3n-2)! ways to seat the rest. So, the probability is n(n-1)/(3n(3n-1)).
2. **i and j are of different colors:**
   * This is similar to the previous case, but with slightly different counting. The probability here is also n(n-1)/(3n(3n-1)).

Thus, E(I_iIj) = n(n-1)/(3n(3n-1)) for all i ≠ j.

Putting it all together:

E(X^2) = 3n * (1/3) + 3n(3n-1) * n(n-1)/(3n(3n-1))
= n + n(n-1) = n^2

Now, Var(X_n) = E(X^2) - (E(X))^2 = n^2 - n^2 = (2n^2)/(3n-1).