Simple mathematical models capable of walking or running are used to compare the merits of bipedal gaits. Stride length, duty factor (the fraction of the stride, for which the foot is on the ground) and the pattern of force on the ground are varied, and the optimum gait is deemed to be the one that minimizes the positive work that the muscles must perform, per unit distance travelled. Even the simplest model, whose legs have neither mass nor elastic compliance, predicts the changes of duty factor and force pattern that people make as they increase their speed of walking. It predicts a sudden change to running at a critical speed, but this is much faster than the speed at which people make the change. When elastic compliance is incorporated in the model, unnaturally fast walking becomes uncompetitive. However, a slow run with very brief foot contact becomes the optimum gait at low speeds, at which people would walk, unless severe energy dissipation occurs in the compliance. A model whose legs have mass as well as elastic compliance predicts well the relationship between speed and stride length in human walking.