The walking of humanoid robots is dependent on the precise tracking of their center of gravity and foot trajectories. Trajectory tracking is achieved by mobilizing their joints to achieve the correct trajectory. Errors occur because of assumptions on tracking the center of gravity and the foot trajectories. In this study, a numerical algorithm was developed that produces an exact and single kinematic solution in which the center of gravity and foot trajectories can be tracked with the desired precision. The effectiveness of this algorithm was examined with a dynamic simulation and compared with a method given in the literature. The main highlight of this study, using the presented algorithm, is that the robot could walk even if the position of its center of gravity was lower than its hips, resulting in a tracking error that was smaller than that reported in the literature.