# function to solve the matrix "augmented" by guassian elimination with modular arithematic and return the guass jordan form as the final "matrix"

function final = guass_elim(augmented)
		final = augmented;
		n = size(final,1);						# n stores the number of rows in final
		for i = 1 : n
		    if (final(i,i)!=1)												
		        
        # for loop to make i,i position 1 by row operations

			    for a = i : n
				    if (final(a,i) == 1)
					    final(i,:) = mod((final(i,:) + final(a,:)),2);
					    break;
				    endif
			    endfor
			 endif

	 	# for loop to make all elements of column i 0 except i,i

			for a = 1 : n
				if (final(a,i) == 1 && a!=i)
					final(a,:) = mod((final(i,:) + final(a,:)),2);
				endif
			endfor
		endfor
endfunction