Homework #2 for optimization