Abstract. In this paper, we propose an efficient numerical scheme to compute sparse matrix inversions for Implicit Differential Algebraic Equations of large-scale nonlinear mechanical systems. We first formulate mechanical systems with constraints by Dirac structures and associated Lagrangian systems. Second, we show how to allocate input-output relations to the variables in kinematical and dynamical relations appearing in DAEs by introducing an oriented bipartite graph. Then, we also show that the matrix inversion of Jacobian matrix associated to the kinematical and dynamical relations can be carried out by using the input-output relations and we explain solvability of the sparse Jacobian matrix inversion by using the bipartite graph. Finally, we propose an efficient symbolic generation algorithm to compute the sparse matrix inversion of the Jacobian matrix, and we demonstrate the validity in numerical efficiency by an example of the stanford manipulator.