implementing createMatrix function
implementing solve method