Solved problem 6
Added explanation to soluton 5