An alternating Turing machine combines existential (∃) and universal (∀) states, branching the computation tree along both dimensions. Computation accepts if the game tree evaluates to true (existential wins; universal loses). ATIME and ASPACE characterize the polynomial hierarchy: Σₖ(DTIME(n^k)) = ATIME(n^k) with k-1 alternations. ATMs provide a game-theoretic lens on complexity.
You already know that a nondeterministic Turing machine (NTM) branches its computation tree by making existential choices: the machine accepts if *some* branch reaches an accept state. You can think of this as a one-player game where the machine is trying to find a winning path. Alternating Turing machines generalize this by introducing a second type of branching. In an alternating Turing machine (ATM), each state is labeled as either existential (∃) or universal (∀). At an existential state the machine accepts if at least one successor branch accepts — just like an NTM. At a universal state, it accepts only if *every* successor branch accepts. This turns computation into a two-player game: an existential player trying to force acceptance, and a universal player trying to force rejection.
The acceptance condition for an ATM is defined recursively by evaluating this game tree. A leaf is accepting or rejecting as usual. An ∃-node accepts if some child accepts; a ∀-node accepts if all children accept. This game-tree evaluation is exactly how you evaluate a quantified Boolean formula (QBF): the first quantifier's player picks a truth assignment, then the second picks, and so on. This is not a coincidence — QBF is PSPACE-complete, and the connection between alternation and PSPACE is tight.
The power of alternation produces a beautiful theorem relating it to the complexity classes you already know. ATIME(t(n)) = ΣP(t(n))-like classes for polynomial t: specifically, k alternations in polynomial time captures the kth level of the polynomial hierarchy. Σₖ-languages (k-fold alternating existential-then-universal NP-style problems) are exactly ATIME(nᵖ) with k−1 alternations starting existentially. The full polynomial hierarchy collapses into ATIME with polynomially many alternations, which equals PSPACE. Formally: APTIME = PSPACE, and APSPACE = EXPTIME. Each swap between ∃ and ∀ in the computation tree corresponds to climbing one level in the hierarchy.
To build intuition: think of the ∃ player as the prover and the ∀ player as the adversary. A Σ₂ problem asks "does there exist a certificate such that *for all* adversarial challenges, the certificate is valid?" — two alternations. Π₂ adds one more flip. The polynomial hierarchy is precisely the tower of such nested quantifier blocks, and ATMs make this quantifier structure explicit as a machine model. This explains why the hierarchy is hard to collapse: collapsing Σₖ = Σₖ₊₁ would require that adding one more alternation buys nothing, which would propagate up to collapse the whole hierarchy into PSPACE.