residual output and problem 2