Understanding phase transition in statistical mechanics