Relationship between Tangent bundle and Tangent sheaf $\newcommand{\Spec}{\mathrm{Spec}\,}$Let $X=\Spec A$ be a variety over $k$, then we have the definition of the tangent bundle $\hom_k(\Spec k[\varepsilon]/(\varepsilon^2),X)$ (note that this has the structure of a variety). On the other hand, we have the definition of a tangent sheaf $\hom_{\mathscr{O}_X}(\Omega_{X/k},\mathscr{O}_X)$. What is the relationship between the two? Also, when $X$ is an arbitrary scheme (not necessarily affine), then does the relationship still hold?
 A: The following is related to your first question:
Suppose that $A$ and $B$ are $R$-algebras ($R$-rings, whatever you want to call them) and that $\sigma: A\to B$ is a homomorphism of $R$-algebras. We can consider the $\mathrm{Der}(A,B)$ as the set of derivations of $\sigma$. There are several characterizations of this set:
$$\mathrm{Der}(A,B)\leftrightarrow \mathrm{Ring}_R(A,D_1(B))$$
Where $\leftrightarrow$ denotes bijection and $D_1(B) = B[\epsilon]$ with $\epsilon^2=0$ is the dual ring. We should note that the map needs to agree with $\sigma$ on the first component: that is the composition $A\to B[\varepsilon]\to B$ (where the last map is the canonical quotient map) agrees with the composition. Similarly we have 
$$\mathrm{Der}(A,B) \leftrightarrow \mathrm{Mod}_R(\Omega_{A/R},B).$$
In general nonsense speak: The functor from rings to sets $A \to \mathrm{Der}_R(A,-)$ is represented by $\Omega_{A/R}$ in the category of modules and co-represented by $D_1(B)$ in the category of rings (I'm not sure if co-represented is the correct object). In this sets the functors $A\to \Omega_{A/R}$ and $B\mapsto D_1(B)$ are adjoint functors since
$$ \mathrm{Ring}_R(A,D_1(B)) = \mathrm{Mod}_R(\Omega_{A/R},B)$$
A remark about the previous answers/question
1. I don't think it's easy to ``note that $\mathrm{Scheme}(\mathrm{Spec}(D_1(k),X)$'' has the structure of a scheme unless this is something we already knew before reading this.


*

*The comment above is an exercise in Hartshorne so you don't need to go to EGA if you don't want to (The same chapter where they do the sheaf Spec and the symmetric algebra I think --- the construction is definitely an ugly gluing thing --- I looked it up it's II.5.18). The setup is general for vector bundles (the schemes whose sections give you locally free sheaves) and locally free sheaves. 


We should also give a warning: There are two conventions running around, there is the Grothendieck/Hartshorne convention where when you build the bundle from the sheaf (using the sheaf spec of the symmetric algebra) the sheaf of sections is isomorphic to the dual of the sheaf you started with. Mumford does this association with a different convention in his red book (see chapter three the section 2 on coherent sheaves).  
If the question is ``When does the tangent bundle (which as a set should be in bijection with $\mathrm{Scheme}(\mathrm{Spec}(D_1(k),X) $) exists as a scheme?'' Then I would say it is sufficient that the sheaf of derivations be locally free so that one can apply the bundle construction procedure outline in Hartshorne or Mumford. Maybe there is some weaker hypotheses you can find impose on $X$ which is found in EGA which gives general conditions on a scheme $X$ for when $\mathrm{Scheme}(\mathrm{Spec}(A),X)$ for an artinian ring $A$ has the structure of a scheme! idk
A: I think the important distinction appears when you ask if $X$ is smooth, rather than asking if it is affine or a variety.  In the smooth case (and some slightly more general cases), the tangent sheaf is locally free, and you can apply the construction in EGA2 Section 1.7 to get the associated vector bundle.  The construction uses the symmetric algebra functor followed by relative Spec.
If your variety is sufficiently singular, you will not get a vector bundle.
A: You can always apply the "vector bundle" construction to $\Omega:=\Omega_{X/k}$ (locally free or not). What you get is a scheme $T=\mathrm{Spec\ Sym}(\Omega)\to X$ which deserves to be called "tangent bundle" (albeit not locally trivial); in particular its $k$-points are what you want and, more generally, if, say, $Z=\mathrm{Spec}\ C$ is an affine $k$-scheme, then $T(C)$ is just $\mathrm{Hom}_k (\mathrm{Spec}\ C[\varepsilon]/\varepsilon^2, X)$.
On the other hand consider the ${\cal O}_X$-dual  ${\cal T}:={\Omega}^\vee$. For every $X$-scheme $y:Y\to X$ there is a canonical map $\Gamma(Y,y^*\mathcal{T})\to \mathrm{Hom}_X(Y,T)$. If $Y$ is an open subset of $X$ this is bijective. But if $y$ is a point of $X$, then the LHS is $\Omega^\vee \otimes \kappa(y)$ while the RHS is the $\kappa(y)$-dual of $\Omega\otimes \kappa(y)$. Clearly the image consists of those tangent vectors at $y$ which extend to vector fields in a neighbourhood. The computation when $X$ is the union of the two axes in the plane is a good exercise; if $y$ is the origin the above map is zero.
[EDIT] after seeing Unknown's answer (BTW, there are some problems with TeX there). The above argument shows that the "tangent bundle" is always a scheme, if you define it right. Another way of seeing this is that it's just an instance of Weil restriction: if $R$ is a finite-dimensional  $k$-algebra you can define the functor $\underline{\mathrm{Hom}}_k (\mathrm{Spec}(R),X)$ in a similar way. This is always an algebraic space, and it is a scheme if $X$ is quasiprojective. But it is also a scheme if $R$ is local, which is the case here with $R=D_1(k)$. The reason is that if you cover $X$ by affines $U_i$, every morphism frome a local scheme to $X$ factors through one of the $U_i$'s, so we can construct the Weil restriction of $X$ by gluing those of the $U_i$'s.
