Do covariant derivatives commute? Let $M$ be a differentiable manifold, let $f:M\rightarrow\mathbb{R}$ be smooth and let $v,w$ be vector fields in $M$. Must it be true that $\nabla_w(\nabla_vf) = \nabla_v(\nabla_wf)$ where $\nabla$ denotes the covariant derivative? If so I would like a proof and if not a counter example. Also, to motivate this question, it seems to me that one can ask this independently of picking a riemannian metric. Because of this, if one had a counter example, then one should be able to put any metric on the space (in particular a flat metric) which would give rise to non commuting derivatives for a smooth function in $\mathbb{R}^n$ which never happens. Because of this I suspect this equality must hold, however I am still unsure.
To clarify, the reason I think one can ask this equality without picking a metric is that to my understanding $\nabla_vf$ is defined independently of the metric and results in a function from $M\rightarrow\mathbb{R}$. That is to say, the covariant derivative of a function from the manifold to the reals with respect to a vector field is itself a function from the manifold to the reals and this is defined independently of the metric.
Here is why I think the covariant derivative is defined independently of the metric. Say you have a vector field $v$ and real valued function $f$ on the manifold. To get the covariant derivative at a point $p$ we take the vector of the vector field $v$ at $p$ (call this vector $v_p$) and we consider some function from $\phi:\mathbb{R}\rightarrow M$ such that $\frac{d}{dt}\phi(t) = v_p$. Then the covariant derivative is defined as $\frac{d}{dt} f(\phi(t))$ which is a real because $f\circ\phi$ is a map from $\mathbb{R}$ to $\mathbb{R}$. At no point is the metric required in this definition. Also, I don't think use of the metric is hiding in the definition of the derivative of a map from the reals to the manifold because a tangent vector can be defined as an equivalence class of functions from the reals to the manifold that all have the same derivative when passed through some chart of the smooth manifold.
It is quite likely my confusion stems from some miss understanding which is present in my above explanation in which case please point this out to me. Thanks for taking the time to read this post.
 A: It is false: take $M=\mathbb{R}^2$, $v(x,y)=-y\frac{\partial}{\partial x}+x\frac{\partial}{\partial y}$, $w(x,y)=\frac{\partial}{\partial x}$ and $f(x,y)=x^2+y^2$. Then:
$$\nabla_vf(x,y)=-2yx+2xy=0$$
and thus
$$\nabla_w(\nabla_vf)(x,y)=0,$$
but
$$\nabla_wf(x,y)=2x$$
and
$$\nabla_v(\nabla_wf)(x,y)=-2y\neq 0$$
for $y\neq 0$.
As you expected,  this has nothing to do with a metric: the link between covariant derivative and usual derivation is, once you start with an affine connection on your manifold, it induces connections on all tensor bundles checking some properties regarding the connection you started with. One of these properties is that it coincides with usual derivation on the $(0,0)$-forms, which exactly says that on functions we have $\nabla_vf=vf=df(v)$ (pick your favorite notation here).
A: Covariant derivatives commute on $M$ if and only if the curvature is vanishing.
You are right when you say that, a priori, this has nothing to do with metric. But then, when you mention a "flat metric", you are already setting some connection between the affine structure (curvature) and the metric structure of the manifold, for instance you require the affine connection to be metric compatible. So, either you have that the curvature is somehow related to the metric and then you cannot just "pick up" a metric, or, the curvature is not related, then the words "flat metric" are meaningless.
A: It'll help to use some index notation. A vector field $u^a$ satisfies $[\nabla_a,\,\nabla_b]u_c=R_{abcd}u^d$, with $R_{abcd}$ the Riemann curvature tensor. (The commutator on a higher-ranked tensor includes one such term for each index, e.g. $[\nabla_a,\,\nabla_b]T_{ce}=R_{abcd}T^d_{\:e}+R_{abc}^{\quad e}T_{ed}$.) So$$\begin{align}[\nabla_v,\,\nabla_w]u_c&=[v^a\nabla_a,\,w^b\nabla_b]u_c\\&=(v^a\nabla_aw^b)\nabla_bu_c-(w^b\nabla_bv^a)\nabla_au_c+v^aw^b[\nabla_a,\,\nabla_b]u_c\\&=(v^a\nabla_aw^b-w^a\nabla_av^b)\nabla_bu_c+v^aw^bR_{abcd}u^d\\&=\nabla_{£_vw}u_c+v^aw^bR_{abcd}u^d.\end{align}$$
