Orthogonal smooth vector field on a Riemannian manifold Consider a compact Riemannian manifold $M$ with a smooth metric, and a smooth vector field $X$ on $M$. My question is, when can we construct another smooth vector field $Y$ on $M$ such that $Y$ is orthogonal to $X$ at all points?
Locally we are surely able to do that, but I am not sure how to (or if one can at all) do it globally (I suspect that there should be some global topological restrictions). Any help is appreciated, thanks!
Edit: The question of existence has been addressed in the comments below, namely, obstructions arising from characteristic classes.
I would further like to ask if there is some constructive way of getting $Y$? For example, is there some general concept of "rotating $X$ by $90^\circ$ anticlockwise (say on an orientable manifold)? Intuitively it seems to me that on a surface, this should be doable, or am I mistaken?
 A: Assuming you mean non-vanishing tangent vector fields, as people in the comments said, there is an obstruction to doing this given by the Euler class of the quotient by the tangent bundle of $M$ by the span of $X$.  In David's example, this is the fact that he is using (the Euler class in this case is the Poincare dual of $2[S^1]$).
As also mentioned in the comments, there are some special structures that let you do this, the most obvious being an almost complex structure, which is exactly a "notion of rotating by 90 degrees." But most manifolds don't have these, in particular odd dimensional manifolds never do (some simple linear algebra shows you can't have a "notion of rotating by 90 degrees" in a consistent way on an odd dimensional manifold; think about trying to do this in 3 dimensions).
Beyond this, it's pretty unclear from your answer what you are looking for; there is, of course, no fully general construction since on many manifolds it is impossible.
A: I'll get things started with a simple example to see that the answer is not always yes: $S^1 \times S^2$ has a nonvanishing vector field pointing in the $S^1$ direction. But, if we had a nonvanishing vector field orthogonal to that one, its restriction to $(\text{point}) \times S^2$ would be a nonvanishing vector field on the sphere, contradicting the hairy-ball theorem.
