This is the law of total expectation (the tower rule): averaging the conditional mean of $X$ over all values of $Y$ gives the overall mean, $E[E[X \mid Y]] = E[X]$.
More Conditional expectation and variance questions
GATE 2024 DA Q36– A fair six-sided die (with faces numbered 1, 2, 3, 4, 5, 6) is repeatedly thrown…
GATE 2024 DA Q59– Consider a joint probability density function of two random variables X and Y: f X,Y(x, y)…
GATE 2026 DA Q44– Let X and Y be two independent random variables. X follows Bernoulli(p = 0.3) distribution…