This project was done as a part of the MTH101 (Linear Algebra)
course offered in the first semester. The aim of the project was to solve a homogenous system of linear equationa of the form Ax=0
where A is a coffecient matrix and x is a vector of variables. The input is the coefficient matrix, and the code converts it into its Reduced Row Echelon Form
or RREF and presents the solution in parametric vector form.
- VS Code or Python IDLE
- Coefficient Matrix
- RREF properties
- Steps to convert a matrix to its RREF
- Nullspace
- How to find nullspace
- Finding parametric solutions using nullspace and free variables.
- The augmented matrix is passed as a parameter through the
rref
function. The function searches for the first non-zero integer in the first column and swaps it with the first row. This process is iteratively repeated for all the columns, swapping the desired row with the second row, third row, and so on. This is done to simplify calculations by shifting the zeroes to the bottom of the matrix and shifting the non-zero rows to the top of the matrix. - Each row is then simplified by dividing the entire row with an integer such that the pivot of each row is 1. The pivots are simultaneously stored in a list
pivot
, which is used in the next function to evaluate the nullspace. - Further row operations are performed to set all the integers, below the pivot column of a row, to 0.
- The list
pivot
created inrref
function is used to classify all columns intocolumn space
andnullspace
- The solutions are then calculated using the nullspace, free variables, and pivots calculated.
- It is then represented in parametric form
(x1v1 x2v2 x3v3 ....)
.
The coefficient matrix is given as input as a nested list by entering the rows and columns as given.
The output consists of the rref of the matrix and the parametric vector form, which is in the form of a string.
The same can be done alternatively by using numpy
library. The matrix can be converted to an array
, and in-built libraries can be used to perform each step of the calculation.