Added code,visualization,and explanation for question 3