From the payoff matrix to the replicator equation