Walking of humanoid robots is dependent on precise tracking of the center of gravity and foot trajectories. Trajectory tracking is achieved by mobilizing the robot joints to produce the correct trajectory. Errors are being occurred because of assumptions on tracking the center of gravity and the foot trajectories. In this study, a numerical algorithm has been 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 the algorithm was examined with a dynamic simulation and compared with the method given in the literature The main highlight of this study, using the presented algorithm, the robot can walk even if the position of its center of gravity is lower than its hips, resulting tracking error was smaller than reported in the literature.