The purpose of this paper is to determine in an analytic fashion whether or not we can achieve input-output decoupling of a nonlinear control system via dynamic precompensation. The solution of this problem is based on an algorithm which determines at each step the maximal number of input-output channels that can be decoupled. We also discuss some interesting relations with differential geometric methods and we show that for systems with two inputs and two outputs our necessary and sufficient conditions can also be formulated and proved in a geometric way.