ProgrammingAssignment2 for CourseraR

Comments about the functions and the code of the functions are added