Optimization in one and several variables with applications in Economics