exercise 4 without bonus. modified residual.m to fit both exercises (regarding c1)