See lecture 6 attached