see Lecture  5 ppt