The problem of lateral vibrations of footbridges due to the synchronization of the pedestrians' motion with that of the supporting structure is analyzed by means of a 3D discrete time model. The map is linear in the mechanical part, and nonlinear in the synchronization part. A very simple and predictive formula is obtained for the critical number of pedestrians, which also takes into account the imperfect resonance between the pedestrians' natural frequencies and the bridge frequency. It is shown that the underlying mechanism triggering the sudden appearance of swaying bridge motion is a perturbation of a pitchfork bifurcation. The results presented in this paper are not related to a specific real case and are based on a quite reasonable hypothesis, and therefore it is expected that they have general validity.