Let $\Omega$ be an open set in $\Bbb R^d$. Let $\{\Omega_j\}_{j=1}^{N}$ be a finite collection of open disjoint subsets of $\Omega$ such that $\overline\Omega=\cup_{j=1}^{N}\overline\Omega_j$. Suppose a function $v$ satisfies $v\in C^0(\Omega)$ and $v|_{\Omega_j} \in H^1(\Omega_j)$ for $j=1,2,...,N$. (Here $v|_{\Omega_j}$ denotes the restriction of $v$ to $\Omega_j$). Prove that $v \in H^1(\Omega)$.
This is my homework problem, I have absolutely no ideas from what to start with, so will be thankful for hints or sketches of the proof. (I am not asking for the complete proof, want to work it out on my own).
You have to show that the weak derivative of $v$ coincides with the weak derivative of $v|_{\Omega_j}$ on the subsets $\Omega_j$. To show this, you just have to prove the integration-by-parts formula. You start with $$\int_\Omega v \, \partial_i \psi \, dx = \sum_j \int_{\Omega_j} v \, \partial_i \psi \, dx$$ for $\psi \in C_0^\infty(\Omega)$. Now, use integration by parts on the subdomains.