I wasn't able to intuitively understand how to mathematically derive this at first glance so I would like to add the explanation for this statement in case anyone faces the same issue:

Denoting $D_1$ as the first draw from the urns, the $P(X=1)$ shown above actually means $P(X=1|D_1=1)$. Using the Bayes's rule,
$P(X=1|D_1=1) = \dfrac{P(D_1|X=1)P(X=1)}{P(D_1|X=1)P(X=1)+P(D_1=1|X=2)P(X=2)}$
Since $P(X=1)=P(X=2)=0.5$, we simplify the equation:
$= \dfrac{P(D_1|X=1)}{P(D_1|X=1)+P(D_1=1|X=2)}=\dfrac{0.4}{0.4+0.3}=\dfrac{4}{7}$
Similarly, with $P(X=2|D_1=1) $, we will get $\dfrac{3}{7}$
I wasn't able to intuitively understand how to mathematically derive this at first glance so I would like to add the explanation for this statement in case anyone faces the same issue:

Denoting$D_1$ as the first draw from the urns, the $P(X=1)$ shown above actually means $P(X=1|D_1=1)$ . Using the Bayes's rule,
Since$P(X=1)=P(X=2)=0.5$ , we simplify the equation:
Similarly, with$P(X=2|D_1=1) $ , we will get $\dfrac{3}{7}$