A variational problem arising in economics