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,
if A throws the coin and get the tail then its prob to win in first throw is 1/2                          

if A does not get a tail so B flips and say it gets a tail then we have 1/2*1/2

if now B does not get a tail then A flips back and say it gets a tail then we have 1/2*1/2*1/2

so proceeding in this way the probability for A to win is 1/2+(1/2*1/2*1/2)+(1/2*1/2*1/2*1/2*1/2)+......... =2/3

so probability for B to win is 1-(2/3)=1/3