problem set 3, defining funcs