# How to recognize "no solution" and "infinite solution"

Hi, everyone!
I want to know how to recognize “no solution” and “infinite solution” with code.My code skip steps to discuss this two situation and the result is still right

You must examine the augmented matrix after row reduction:

No Solution: If a row in the matrix shows all zeros in the coefficients but a non-zero in the augmented part, then there is no solution.

Infinite Solutions: If you have at least one row with all zeros and the rank of the coefficient matrix is less than the number of variables, then there are infinite solutions (there are more variables than independent equations).

Hope this helps! Feel free to ask if you need further assistance.

1 Like

This is an interesting point that I had never noticed before. It turns out that the instructions really go too far here: the code is not expected to the discriminate the various cases that can occur when the coefficient matrix is singular. Notice that in the template code for `row_echelon_form`, they just give us the code that takes the determinant and returns “Singular system” if the determinant is zero. So with that in place, it would be a bit messy to write the code in `gaussian_elimination` to make this distinction.

Notice that the “docstring” for the function also makes it sound like we are expected to do the analysis of the sub-cases:

``````Returns:
numpy.array or str: The solution vector if a unique solution exists, or a string indicating the type of solution.
``````

You can also easily prove to yourself that the grader test cases and the test cases in the notebook do not check the behavior of `gaussian_elimination` in the singular case.

I will file an enhancement request in the hopes that they can clarify the instructions and beef up the test cases to help with the clarification.

1 Like