trust region method for optimization problems given gradient and hessian matrix