Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 2.65 KB

README.md

File metadata and controls

38 lines (28 loc) · 2.65 KB

Matrix-to-RREF

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.

Pre-Requisites

Application

  • VS Code or Python IDLE

Knowledge

  • 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.

Intuition and Approach

Converting to RREF

  • 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.

Finding nullspace

  • The list pivot created in rref function is used to classify all columns into column space and nullspace

Finding solution

  • The solutions are then calculated using the nullspace, free variables, and pivots calculated.
  • It is then represented in parametric form (x1v1+x2v2+x3v3+....).

Input format

The coefficient matrix is given as input as a nested list by entering the rows and columns as given.

Output format

The output consists of the rref of the matrix and the parametric vector form, which is in the form of a string.

Alternate method

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.