I have constructed a class library to perform different operations with matrices. I was inspired by my university course of Linear Algebra. This library is still beta, so don’t wonder if you encounter a problem.

In mathematics, a matrix is a rectangular table of numbers. Instead of using integers only, I have used my fraction class to represent numbers in the matrix. You can sum matrices, multiply them, determine their determinant and their rang, inverse & transpose them.

Initialization & General Usage

Here is a simple example of the usage of this library. I want to remark something: when you access an element of the matrix, you use a row & a column index. This indexes are not zero-based!

Multiplication of two matrices

If you want to multiply two matrices, the number of columns of the first one must be equal to the number of rows the second one. Here is the algorithm of multiplication of two matrices.

And here is the simple usage.

Solving a Matrix Equation

A matrix equation is an equation like Ax=b, where A, b and x are matrices. To solve such an equation, you have to find a matrix and when you multiply A by this matrix to get b. Solving a matrix equation uses the Gauss elimination method.

Matrix Equation

Other Features

You can invert a matrix (if it can be inverted), transpose a matrix, use the identity and zero matrices. Here are a few examples, which demonstrate that features.