Let $\{U\_\lambda\}\_{\lambda\in\Lambda}$ be an open covering of $\mathbb{R}^n$.
Given a family of functions $f\_\lambda:U\_\lambda\rightarrow \mathbb{R}\,(\lambda\in\Lambda)$ such that $f\_\lambda-f\_\mu: U\_\lambda\cap U\_\mu\rightarrow\mathbb{R}$ is constant for any $\lambda,\mu\in\Lambda$, is there a function $f:\mathbb{R}^n\rightarrow \mathbb{R}$ such that for each $\lambda\in\Lambda$, the function $f-f\_\lambda$ is constant on $U\_\lambda$?


It seems like that this assertion is true, but I don't have any proof.



Existence of a function on the Euclidean space which differs by constants from locally defined functions
This doesn't work if the $U\_\lambda$ are not connected, for example we can take $U\_1=(-\infty,0)\cup(1,\infty)$, $U\_2=(-1,1)$ and $U\_3=(0,2)$ and the functions $f\_1$ defined by $f\_1(x)=x$ if $x<0$ and $x+1$ if $x>0$, and $f\_2(x)=f\_3(x)=x$.


But if the $U\_\lambda$ are connected, it is true. The relationship of this with homology can be seen using homology of small simplices (Hatcher proposition 2.21).


As in Hatcher's book let $C\_n(\mathbb{R}^n)$ be the group of $n$-chains in $\mathbb{R}^n$ generated by the singular $n$-simplices. Now we can take the cover $\mathcal{U}=\{U\_\lambda\}\_\lambda$ and let $C\_n^\mathcal{U}(\mathbb{R}^n)$ be the subgroup of $C\_n(\mathbb{R}^n)$ generated by simplices which are contained in some element of $\mathcal{U}$.


We can define a homomorphism $\alpha:C\_1^\mathcal{U}(\mathbb{R}^n)\to\mathbb{R}$ which assigns to each $1$-simplex $\gamma:[0,1]\to\mathbb{R}^n$ the value $f\_\lambda(\gamma(1))-f\_\lambda(\gamma(0))$, for some $\lambda$ such that $\gamma([0,1])\subseteq U\_\lambda$.


This is well defined and it is $0$ in boundaries (as the $2$-simplices are also contained in some $U\_\lambda$), so it gives you a homomorphism $\overline{\alpha}:H\_1^\mathcal{U}(\mathbb{R}^n)\to\mathbb{R}$. But by Hatcher proposition 2.21, $H\_1^\mathcal{U}(\mathbb{R}^n)\cong H\_1(\mathbb{R}^n)=0$, so $\alpha$ is $0$ in cycles.


So you can define your function $f$ by $f(0)=0$, and for any other $x\in\mathbb{R}^n$, $f(x)=\alpha(\gamma)$, where $\gamma$ is a path (sum of small segments) from $0$ to $x$. By the previous paragraph, $f$ is well defined, and $f-f\_\lambda$ is constant because for $x,y\in U\_\lambda$, we can take a sequence of segments $[x\_0,x\_1],[x\_1,x\_2],\dots,[x\_{n-1},x\_n]$ contained in $U\_\lambda$ going from $x=x\_0$ to $y=x\_n$, so that $f\_\lambda(y)-f\_\lambda(x)=\sum\_{i=1}^n(f\_\lambda(x\_i)-f\_\lambda(x\_{i-1}))$, which also coincides with $f(y)-f(x)$.


