TITLE: The homology of the torus.
QUESTION [6 upvotes]: I am reading "Riemann surface" by Donaldson.
On page 68, the calculation of the first homology of the torus $T$ is given but there are several steps that I don't understand.
Here is the calculation.

Consider the torus $T$ and take standard angular co-ordinates $\theta, \phi \in [0, 2\pi]$.
  Let $\gamma_1, \gamma_2 \subset T$ be the standard embedded circles corresponding to $\theta=0, \phi=0$, respectively.
  Then the map
  $$\alpha \mapsto \bigg( \int_{\gamma_1} \alpha, \int_{\gamma_2} \alpha\bigg)$$
  induces a linear map from $H^1(T)$ to $\mathbb{R}^2$, since the integral of $df$ around the $\gamma_i$ vanishes for any function $f$ on $T$.
  The forms $d\theta$ and $d\phi$ show that this map is surjective.
  We claim that the map is also injective, so $H^1(T)=\mathbb{R}^2$.
  For, if $\alpha=P d\theta +Q d\phi$ is a closed 1-form with integral $0$ around $\gamma_2$, then for any fixed $\phi$ we have, by Stokes' Theorem,
  $$ (1) \int_0^{2\pi} P(\theta, \phi)d\theta=0.$$
  This means that the indefinite integral
  $$f(\theta, \phi)=\int_0^{\theta} P(u, \phi)du$$
  defines a smooth function on $T$ with $\partial f / \partial \theta=P$.
  Thus $\tilde{\alpha}=\alpha -df$ is a closed 1-form of the form $\tilde Q d \phi$. 
  But the closed condition implies that $Q$ is constant and, if the integral around $\gamma_1$ is zero, this constant must be zero and $\alpha=df$.

Questions:
1. The first thing I want to understand is how to get (1). How do I useStokes' Theorem here? For which surface and boundary do I use Stokes' Theorem?
2.Why does (1) mean $f(\theta, \phi)$ denies a smooth function on $T$?
I appreciate any help.

REPLY [4 votes]: Ad 1: First, observe that
$$
 \int_0^{2\pi} P(\theta,\phi) d\theta = \int_{\gamma[\phi]} \alpha,
$$
where $\gamma[\phi]$ is the circle parametrised by $t \mapsto (t,\phi)$, e.g., $\gamma[0] = \gamma_2$. Now, let $S$ be the closed annulus in $T$ corresponding to $(\theta,\phi) \in [0,2\pi] \times [0,\phi]$, so that $\partial S = \gamma[\phi] - \gamma_2$. Then, since $\alpha$ is closed and
$$
 \int_{\gamma_2} \alpha = 0,
$$
it follows by Stokes's theorem that
$$
 0 = \int_S d\alpha = \int_{\partial S} \alpha = \int_{\gamma[\phi]} \alpha - \int_{\gamma_2} \alpha = \int_0^{2\pi} P(\theta,\phi)d\theta,
$$
as required.
Ad 2: A priori, $f$ is a smooth function on $[0,2\pi]^2$, so for it to define a smooth function on $T$, it and all its partial derivatives must satisfy periodic boundary conditions, i.e.,
$$
 \partial^m_\theta \partial^n_\phi f(0,\phi) = \partial^m_\theta \partial^n_\phi f(2\pi,\phi), \quad \partial^m_\theta \partial^n_\phi f(\theta,0) = \partial^m_\theta \partial^n_\phi f(\theta,2\pi)
$$
for all $m$, $n \geq 0$. However, by the fundamental theorem of calculus, we have that for all $m$, $n \geq 0$,
$$
 \partial^n_\phi f(\theta,\phi) = \int_0^\theta \partial^n_\phi P(u,\phi)du, \quad \partial_\theta^{m+1}\partial_\phi^nf(\theta,\phi) = \partial^m_\theta \partial^n_\phi P(\theta,\phi),
$$
so that since $P$ is already a smooth function on $T$, it suffices to check that for all $n \geq 0$,
$$
 \partial^n_\phi f(0,\phi) = \partial^n_\phi f(2\pi,\phi), \quad \partial^n_\phi f(\theta,0) = \partial^n_\phi f(\theta,2\pi).
$$
Then, on the one hand, since $P$ itself is a smooth function on $T$, it follows that
$$
 \quad \partial^n_\phi f(\theta,0) = \int_0^\theta \partial^n_\phi P(u,0)du = \int_0^\theta \partial^n_\phi P(u,2\pi)du = \partial^n_\phi f(\theta,2\pi),
$$
whilst on the other hand, by (1),
$$
 \partial^n_\phi f(0,\phi) = \int_0^0 \partial^n_\phi P(u,\phi)du = 0 = \partial^n_\phi \int_0^{2\pi} P(u,\phi)du = \int_0^{2\pi} \partial^n_\phi P(u,\phi)du = \partial^n_\phi f(2\pi,\phi).
$$
Thus, $f$ does indeed define a smooth function on $T$.