see Lecture 7  Ch 5 and 6