Space of global sections for a smooth projective curve of genus $g$ Let $X$ be a smooth projective curve of genus $g$, $T_{X}$ its tangent bundle and $H^{0}(X,T_{X})$ the space of global sections for $X$.

What is $\dim H^{0}(X,T_{X})$ and why?

 A: Let $X$ be defined over an algebraically closed field. Denote $h^0(\mathscr L) = \dim_K(H^0(X,\mathscr L))$ for any line bundle $\mathscr L$ on $X$. By duality, $h^0(\mathscr T_X) = h^1(\omega_X\otimes\mathscr T_X^{-1}) = h^1(\omega_X^2)$ where $\omega_X$ is the canonical line bundle $\omega_X = \Omega_X$ on $X$.
Now $\deg(\omega_X^2) = 2\deg(\omega_X) = 2(2g-2)>2g-2$ if $g\ge 2$. By Example I.3.4 of Hartshorne, this implies that $\omega_X^2$ is nonspecial, i.e., $h^1(\omega_X^2) = 0$. Thus, $h^0(\mathscr T_X) = 0$ if $g\ge 2$.
If $g=0$, then we know that $X$ is rational, thus isomorphic to $\mathbb P^1$, which implies that $h^1(\omega_X^2) = h^1(\omega_{\mathbb P^1}^2) = h^1(\mathscr O_{\mathbb P^1}(-4))$ since $\omega_{\mathbb P^1} = \mathscr O_{\mathbb P^1}(-2)$, which equals $h^0(\mathscr O_{\mathbb P^1}(-2+4)) = h^0(\mathscr O_{\mathbb P^1}(2)) = 3$ by duality. Thus, for $g=0$, we have $h^0(\mathscr T_X) = 3$.
If $g=1$, then $\omega_X = \mathscr O_X$ is trivial, so we have $h^1(\omega_X^2) = h^1(\mathscr O_X) = h^0(\omega_X\otimes\mathscr O_X) = h^0(\mathscr O_X) = 1$ since $X$ is projective. Thus, $h^0(\mathscr T_X) = 1$ if $g=1$.
Second attempt:
Since $\mathscr T_X = \Omega_X^{-1} = \omega_X^{-1}$, we compute $h^0(\mathscr T_X)$ directly as $h^0(\mathscr O_X(2))=3$ if $g=0$ and $h^0(\mathscr O_X) = 1$ if $g=1$.
Let $g\ge 2$. Riemann-Roch implies $h^0(\omega_X)\ge 2g-2 + 1-g = g-1>0$, which implies that $\omega_X$ is effective, and thus $\omega_X^{-1}$ cannot be effective, so $h^0(\omega_X^{-1})=0$.
A: If $X$ is a smooth projective curve of genus $g$, then $dimH^{1}(X,TX)=3g-3$. The best (but maybe most strange way) to see this is deformation theory. By Serre duality, $dimH^{1}(X,TX)=dimH^{0}(X,\omega^{\otimes 2})$. Now this latter space can be shown to be the tanget space of $M_{g}$, the moduli space of curves at the point $X$ which is known to be $3g-3$(=dim$M_{g}$). Maybe this is not as detailed as you need , but I just wanted to mention the importance of the space $H^{0}(X,\omega^{\otimes 2})$ in the deformation theory of curves. 
