A new mathematical approach for encoding internal states in synchronous sequential machines is developed. The relationship between transition matrices and the corresponding matrices of the isometric group is studied. An algorithm to a priori determine the null cost assignment is proposed. The cycle lengths which appear for each n are analysed. The results obtained for the D or SR flip-flop can be extended to JK and GL