Triangular nanoflake growth patterns have been commonly observed in synthesis of transition metal dichalcogenide sheets and their hybrid structures. Triangular nanoflakes not only show exceptional properties, but also can serve as building blocks for two or three dimensional structures. In this study, taking the MoS2 system as a test case, we propose a Matrix method to understand the mechanism of such unique growth pattern. Nanoflakes with different edge types are mathematically described with configuration matrices, and the total formation energy is calculated as the sum of the edge formation energies and the chemical potentials of sulfur and molybdenum. Based on energetics, we find that three triangular patterns with the different edge configurations are energetically more favorable in different ranges of the chemical potential of sulfur, which are in good agreement with experimental observations. Our algorithm has high efficiency and can deal with nanoflakes in microns which are beyond the ability of ab-initio method. This study not only elucidates the mechanism of triangular nanoflake growth patterns in experiment, but also provides a clue to control the geometric configurations in synthesis.