public static String assertRationalMatrix(double[][] matrix) {

		if (matrix == null) {

			return "The matrix is null";

		}

		int rows = matrix.length;

		if (rows <= 1) {

			return "The matrix does not have more than one row:" + NEWLINE
					+ representMatrix(matrix, 3);

		}

		double[] firstRow = matrix[0];

		if (firstRow == null) {

			return "The first row of the matrix is null:" + NEWLINE
					+ representMatrix(matrix, 3);

		}

		int columns = firstRow.length;

		if (columns <= 1) {

			return "The first row of the matrix does not have more than one column:"
					+ NEWLINE + representMatrix(matrix, 3);

		}

		if (rows != columns) {

			return "The matrix does not have an equal number of rows and columns:"
					+ NEWLINE + representMatrix(matrix, 3);

		}

		for (int row = 1; row < rows; row++) {

			double[] currentRow = matrix[row];

			if (currentRow == null) {

				return "Row " + (row + 1) + " of the matrix is null:" + NEWLINE
						+ representMatrix(matrix, 3);

			}

			int rowColumns = currentRow.length;

			if (rowColumns != columns) {

				return "Row "
						+ (row + 1)
						+ " of the matrix does not have the same number of columns as the first row:"
						+ NEWLINE + representMatrix(matrix, 3);

			}

		}

		return null;

	}