When creating a post, please add:

For this last function I am calling back_substitution when it matches the same type

{ moderator edit – code removed }
I am not sure which line I had placed wrong , can you please suggest

The solution value that you return is simply the return value from the back_substitution function, in the case that the system is non-singular.

Why do you need that last line to select the last column? That should not be necessary.

Yes , thanks for pointing out