Coin toss game - Probability of winning Question:
Two players A and B, alternatively toss a fair coin (A tosses the coin first, then B, than A again, etc.). The sequence of heads and tails is recorded and if there is head followed by a tail (HT subsequence), the game ends and the person who tosses the tail wins. What is the probability that A wins the game?
Solution:
I was told the following solution. If $P(A),P(B)$ are the probabilities that A, B win, then we can write:
$$P(A) = P(A\mid H)P(H)+P(A\mid T)P(T)$$
where $P(H)=P(T)=1/2$ are the probabilites that A gets H, T in the first toss respectively. Then $$P(A\mid T)=P(B)=1-P(A)\tag{1}$$ and $$P(A\mid H)=1/2\cdot 0+1/2\cdot (1-P(A\mid H))\tag{2}$$
which gives $P(A)=4/9$.

I am trying to understand equation (1),(2). I understand that if A gets T then the game essentially starts over with B being the first player. But since we want to know the probability of A winning, then shouldn't we have $P(A\mid T)=1-P(B)$? As for (2) I have not been able to find a starting point. Would somebody be able to explain their derivation?

If the first toss is $T$, then $B$ cannot win on the second toss;
their chance to win after this are the same as $A$'s chance to win
was at the start of the game.
That is, after this $T$ toss the game essentially starts over,
except that now $B$ has the first toss instead of $A$;
the roles are reversed, so $A$'s chance to win ($P(A \mid T)$)
is the same as $B$'s chance to win the original game ($P(B)$).
If the first toss is $H$, there is a $\frac12$ chance of tails, in which
case $A$ loses immediately (hence the $\frac12 \cdot 0$ term
in the formula for $P(A \mid H)$),
and a $\frac12$ chance of heads, in which case
$A$ is now in the position that $B$ was in after the first head,
so $A$'s chance to win after two heads is $1$ minus their chance to win
after one head, hence the $\frac12 \cdot (1 - P(A \mid H)$ term,
