Need to calculate P(aa). these two following approaches are obviously not the same, and the second one is wrong but I do not understand why:
1: P(aa) = P(aa|b)P(b)+P(aa|!b)P(!b) = P(a|b)P(a|b)P(b)+P(a|!b)P(a|!b)P(!b)
2: P(aa) = P(a)P(a) = (P(a|b)P(b)+P(a|!b)P(!b))^2
what's wrong with the second approach?
I'm assuming that when you write $P(aa)$ you mean the probability that $X_1=a$ and $X_2=a$, where $X_1$ and $X_2$ are random variables. Similarly, I'm assuming that $b$ is the outcome of another random variable $Y$.
Regarding your first equation:
It is true that $$P(X_1=a, X_2=a) =\\ P(X_1=a, X_2=a |Y=b)P(Y=b) + P(X_1=a, X_2=a | Y\neq b)P(Y\neq b),$$
(this is what you have in the first part of point 1 which follows from the law of total probability). However, the second part of point 1 is not necessarily correct, unless you are assuming that $X_1$ and $X_2$ are conditionally independent.
Regarding your second equation:
In general you can't assume that $P(X_1=a, X_2=a) = P(X_1=a)P(X_2=a)$, unless you are assuming that $X_1$ and $X_2$ are independent random variables.