5. Suppose a bag contains one red, one yellow, and one blue ball. Each time a ball is drawn from the bag (the probability of drawing a ball of any color is the same), its color is determined and then it is put back. This process continues until a red ball is drawn twice in a row. Let the number of draws at this point be $\xi$, then the mathematical expectation of $\xi$ is $\qquad$ .
Let the required expectation be $E$, and the expectations of the number of draws $\xi$ when the first ball drawn is red, yellow, or blue be $E(a)$, $E(b)$, and $E(c)$, respectively. According to the problem, $E(b)=E(c)$.
Since the probabilities of the first ball being red, yellow, or blue are the same, then
$$
E=\frac{E(a)+E(b)+E(c)}{3}=\frac{E(a)+2 E(b)}{3} ;
$$

First, consider the case where the first ball drawn is red. If the second ball drawn is also red, the operation ends; otherwise, the second ball is yellow or blue. Ignoring the first ball, the remaining drawing process can be considered a new drawing process where the first ball is yellow or blue, so $E(a)=\frac{1}{3} \times 2+\frac{2}{3}(1+E(b))$;
Next, consider the case where the first ball drawn is yellow or blue. Ignoring the first ball, the remaining drawing process can be considered a new drawing process, so $E(b)=1+E$.
Combining (1), (2), and (3), we get $E=12$. Therefore, the mathematical expectation of $\xi$ is 12.