How is the differential of a function on a manifold defined if $f(x)$ and $f(x+h)$ cannot be compared? I'm self-teaching differential geometry, and a friend perplexed me saying that it's not correct to take a derivative of a function $M \rightarrow \mathbb R$ on a manifold $M$ because the two terms of the difference quotient (say, $f(x)$ and $f(x+h)$) lay in different spaces, which just in ordinary calculus are implicitly identified to the same space (the $y$-axis).
This seemed weird to me because the concept of directional derivative of a function applies regularly to manifolds too...but what if also in this case there's an implicit identification at work?
 A: Your friend is wrong, or you misinterpreted him. You can differentiate functions fine, what you friend probably meant are tensor fields (or in general, sections of non-trivial vector bundles).
In case, of for example, a vector field $X$, its value at $p$ lies in $T_pM$, while it's value at $q$ lies in $T_qM$, so they can't be compared. For functions, $f(p)\in\mathbb{R}$ and $f(q)\in\mathbb{R}$.
There is another issue however, that while directional derivatives are defined fine for functions, the case of a total derivative is a bit more subtle than on $\mathbb{R}^n$.
You can either regard a function's total derivative at $p$ as the local linearization of the function at $p$, so $df_p:T_pM\rightarrow\mathbb{R}$, $df_p(X)=Xf$ ($df_p$ is clearly a linear map), or you can regard the total derivative as the equivalence class of all functions that share the same first order behaviour at $p$. This can be formalized by letting $I_p$ be the ideal of smooth functions vanishing at $p$, and looking at the quotient space $I_p/I_p^2$. It can be shown that $I_p/I_p^2\simeq T^*_pM$, and then $df_p=[f-f(p)]$, where $[]$ is the quotient projection $I_p\rightarrow I_p/I_p^2$ that maps a function to the equivalence class containing the function.
Edit: And yeah, as Arthur pointed out, if $x$ is a point on a manifold, $x+h$ makes no sense. Directional derivatives can be defined via curves. If $\gamma:\mathbb{R}\rightarrow M$ is a smooth (well, I think $C^1$ is sufficient) curve, for which $p=\gamma(0)$, then the directional derivative of $f$ at $p$ along $\gamma$ is $$\left.\frac{d}{dt}(f\circ\gamma)\right|_{t=0}.$$
It can be shown, that if two curves have the same first-order contact at $p$ (essentially, for any chart $(U,\psi)$, $\psi\circ\gamma$ and $\psi\circ\eta$ have the same derivatives at the parameter values corresponding to $\psi(p)$), then the directional derivative will be the same. A vector then can be identified with the equivalence class of curves having the same first-order contact at $p$, so this directional derivative is actually taken with respect to a vector too.
