I am reading Cao and Chen's paper "On Bach-flat gradient shrinking Ricci solitons". A complete Riemannian manifold $(M^n,g_{ij})$ is called a gradient shrinking Ricci soliton if there exists a smooth function $f$ such that the Ricci tensor $R_{ij}$ of the metric $g_{ij}$ satisfies $$R_{ij}+\nabla_i\nabla_j f=\rho g_{ij}$$ for some constant $\rho>0$.

In the proof, it asserts that (P.1164): Suppose $|\nabla f|^2=0$ on some nonempty open set of $M$. Since any gradient shrinking Ricci soliton is analytic in harmonic coordinates, it follows that $|\nabla f|^2=0$ on $M$.

I would like to understand why "any gradient shrinking Ricci soliton is analytic in harmonic coordinates". Also, I don't understand why "any gradient shrinking Ricci soliton is analytic in harmonic coordinates" would imply that $|\nabla f|^2=0$ on $M$. I have asked this question in math.stackexchange before, but I did not get an answer. Thank you very much.

A sketch of a proof of the real analyticity of the metric and potential in harmonic coordinates for the related gradient Einstein solitons can be found in the paper http://cvgmt.sns.it/media/doc/paper/2197/GRADIENT@EINSTEIN@SHRINKERS_24gen.pdf on page 5 and 6. Once you know that f is real analyic, it follows by analytic continuation that the vanishing of the derivative $\nabla f$ on an open set $U\subset M$ implies that $\nabla f=0$ on all of $M,$ provided $M$ is connected.
The analyticity of Ricci solitons (not necessarily gradient) was first obtained, up to my knowledge, by Thomas Ivey in the paper Local existence of Ricci solitons, published in $1996.$ (see http://link.springer.com/article/10.1007%2FBF02567946?LI=true). You can get the paper following the link http://iveyt.people.cofc.edu/papers/locnew.pdf