Derivation
The formula for the magic number is derived straightforwardly as follows. As before, at some particular point in the season let Team A have WA wins and LA losses. Suppose that at some later time, Team A has wA additional wins and lA additional losses, and define similarly WB, LB, wB, lB for Team B. The total number of wins that Team B needs to make up is thus given by (WA + wA) − (WB + wB). Team A clinches when this number exceeds the number of games Team B has remaining, since at that point Team B cannot make up the deficit even if Team A fails to win any more games. If there are a total of G games in the season, then the number of games remaining for Team B is given by G − (WB + wB + LB + lB). Thus the condition for Team A to clinch is that (WA + wA) − (WB + wB) = 1 + G − (WB + wB + LB + lB). Canceling the common terms, we obtain wA + lB = G + 1 − WA − LB, which establishes the magic number formula.
Read more about this topic: Magic Number (sports)