For a compact Riemannian Manifold $(M,g)$ without boundary. $R$ as the scalar curvature. And $d\mu$ is the Riemannian volume form.
So we can define the average of the scalar curvature $r:= \frac{\int_{M} R d\mu}{\int_{M} d\mu}$
When consider the equation $$\Delta f = R-r$$ I was told that $f$ must exist due to the fact that $$\int_M R-r d\mu =0 \quad (1)$$
But I cant prove this as true. I current idea is try to use the Elliptic PDE theory, but of what from the theory? I think Fredholm Theory is a choice but I don't know how to connect the fact (1) to there.
Any help will be appreciated .
This is a specific case and a easy corollary of the Hodge Decomposition Theorem.
Define the following: For differential $p-$form $\gamma, \eta \in \Omega^p(M)$, define the $L^2$ inner product as $$(\gamma, \eta) := \int_{M^n} \langle \gamma,\eta \rangle d\mu := \int_{M^n} p!g^{i_1j_1}...g^{i_pj_p}\gamma_{i_1...i_p}\eta_{j_1...j_p} d\mu $$
Define Hodge star operator$\ast : \bigwedge^p T^*M \to \bigwedge^{n-p}T^*M $ defined by $$\langle \gamma,\eta \rangle d\mu =\gamma \wedge \ast \eta$$
Define the adjoint operator of exterior derivative $d$ as $\delta:\Omega^p(M) \to \Omega^{p-1}(M)$ $$(\delta \alpha)_{i_1...i_{p-1}}=-pg^{jk}\nabla_j \alpha_{ki_1...i_{p-1}}$$
Moreover, we define the Hodge laplacian as the following $$\Delta_d:=-(d\delta+\delta d)$$
Define a space of harmonic p-forms $H^p$ as kernel of $\Delta_d$ $$H^p = \{ \alpha \in \Omega^p(M) : \Delta_d \alpha =0\}$$
We are going to state the Hodge Decomposition Theorem. For $(M^n,g)$ is a closed Riemannian Manifold.\ For $\gamma \in \Omega^p(M)$ , $\Delta_d \alpha =\gamma$ has a solution if and only if $$(\gamma, \beta) =0 \quad \forall \beta$$ In particular, $$\Omega^p(M)= \Delta_d(\Omega^p(M)) \oplus H^p$$
The important consequence we need is : If $(M^n,g)$ is a closed Riemannian Manifold if $f: M \to \mathbb{R}$ is smooth and $\int_{M}f d\mu =0$ . Then there exist a smooth $u: M \to \mathbb{R}$ such that $\Delta u =f$ , where $u$ is unique up to addition of constant function.
The proof of corollary : Here we only need to consider the 0-forms :$\Omega^0(M) = C^{\infty}(M, \mathbb{R})$ In this case $H^0$ is just a space of constant functions,so if we have $\int_M f d\mu =0$. If satisfies the condition of Hodge decomposition theorem. There exists solution $u$ satisfies $$\Delta_d u = \Delta u = f$$ And by the decomposition, we see $u$ is unique up to addition of constant.
p.s
This is a long road to show such theorem if you are just doing Riemannian Geometry, Ricci Flow and happens to need this result. For more details of the theorem, please check chapter one of this Hodge Theory book .
And personally I find soley relying on PDE results(my comment above) to get existence and take every thing back to charts for regularity is still doable (because even you consider in charts, there are just 2nd order elliptic!). Actually it is just book keeping exercise and it will be so satisfying after write everything out.