wrote reduce_problem method
tested reduce_problem method