Solution for problem 6.
Solution for problem 16.