The derivation of ratios for plotting on Pearce element-ratio diagrams is facilitated by casting the problem in terms of linear algebra. Two types of systems of linear equations result: systems of homogeneous equations and systems of non-homogeneous equations. Systems of homogeneous equations with a rank less than the number of chemical elements in the ratios lead to diagrams that can test whether chemical variations in a suite of rocks can be explained by sorting of a particular assemblage of minerals. Systems of nonhomogeneous equations with ranks less than or equal to the number of elements in the ratios lead to diagrams that can test whether an individual mineral in a postulated assemblage is required to explain the chemical variations in a suite of rocks. The method of choice for finding the solutions to the systems of equations, which are the coefficients of the chemical elements in the ratios, is singular-value decomposition.