Finding a specific Global Smooth Function Any help with this problem would be appreciated. Thanks
Suppose $(M^3,g)$ is a smooth compact Riemannian manifold with smooth boundary and $\gamma$ is a simple smooth orientable curve in $M$. Does there exist a global smooth function $f:M \to \mathbb{R}$ such that $df(X)|_{\gamma} \neq 0$ along $\gamma$ and $|df|_g \neq 0 $ in $M$. ($X$ denotes the unit tangent vector on $\gamma$.)  
in plain words does there exist a smooth function f whose level sets are never tangent to $\gamma$.
 A: $f$ will decrease or increase along $\gamma$, so $\gamma$ cannot be closed. But if $\gamma$ is embedded and not closed, then a suitable diffeomorphism will take $\gamma$ into a coordinate ball, so some $f$ exists near $\gamma$. But globally, even with boundary, we might have no function without critical points. Edit: as Sebastian Goette points out, if every component has nonempty boundary, then there are smooth functions without critical points. Still, we need to know more about this $\gamma$.
A: Edit. Surely $f$ has at least two critical points if $M$ is closed, so we cannot have $|df|_g\ne 0$ everywhere in that case. This arguments fails if we assume that each component of $M$ has a nonempty boundary. To the contrary, now one can assume that $f$ is generic (after a $C^1$-small perturbation, which would not destroy $df(X)|_\gamma>0$ - this definitely works if $\gamma$ is proper, e.g., connects two points on $\partial M$) and hence has only finite many critical points. Because $\dim M=3>2$, we can connect these critical points with the boundary by a family of disjoint paths that do not intersect $\gamma$. Then using an isotopy of $M\cup_{\partial M}\mathrm\partial M\times[0,\varepsilon)$, we can pull out each critical point of $f$ and find the desired function if we started with a function satisfying $df(X)|_\gamma>0$.
Together with Ben's answer, this solves your problem when $\gamma$ is a proper embedding. I am not sure if that condition is necessary. However, whenever you have two sequences $s_i$, $t_i$ with distinct limit points in $\overline{\mathbb R}=\mathbb R\cup\{\pm\infty\}$, such that $\gamma(s_i)$ and $\gamma(t_i)$ converge to the same point in $M$, then such a function $f$ cannot exist.
