some lecture notes from the University of Waterloo.