def row_subtract(matrix, row1, row2, factor):
    """
    Subtracts a multiple of one row from another
    :param matrix: list of lists of equal length containing numbers
    :param row1: index of a row
    :param row2: index of a row
    :param factor: multiplication factor of row1
    :return: list of lists of equal length containing numbers
    """
    matrix[row2] = [matrix[row2][i] - (matrix[row1][i] * factor) for i in range(len(matrix[0]))]
    return matrix