In this paper, some flaws of Tatsuoka’s Q matrix theory (1991, 1995) are discussed, and some remedies are proposed, especially through a series of new algorithms. These algorithms are useful in the Rule Space Model and in the Attribute Hierarchy Model to construct a Q matrix when the reachability matrix is given, and are useful to calculate the ideal/expected response patterns without using the Boolean Descriptive Function. These algorithms demonstrate two facts: firstly, the reachability matrix is the most important tool in constructing a cognitive test, and could help increase the diagnosis accuracy; secondly, use of these algorithms can remedy the flaws in the Tatsuoka’s Q matrix theory. Furthermore, the new algorithms have other advantages, such as that they reduce computational burden for some complicated tasks requiring heavy numerical operations. Hence, the proposed methods in the paper may enrich the applications of the Q matrix theory