Rayleigh-Ritz variational approximation and symmetry nonrestoration