Commuting vector fields with common first integrals Let $M$ be a $n-$dimensional smooth manifold and $X\in\chi(M)$ be a smooth vector field defined on it. Let $f_1,...,f_{n-2}:M\rightarrow \mathbb{R}$ be functionally independent first integrals of $X$, i.e.
$$ L_{X}f_i=0,\quad \forall i=1,2,...,n-2. $$
Moreover, suppose there exists another vector field $Y\in\chi(M)$, independent from $X$, which is commuting with it, namely
$$ \mathcal{L}_X Y = [X,Y]=0. $$
Is there some known general condition that $Y$ must satisfy in order to share the first integrals with $X$?
I tried saying that for any $i=1,...,n-2$ since $XY=YX$, then we have
$$ 0=YX(f_i) = XY(f_i) $$
and hence the functions $g_i=Y(f_i)\in\mathcal{C}^{\infty}(M)$ are first integrals of $X$. Namely, when is it true that then $\mathcal{L}_{Y}f_i=0$ for all the $i'$s? 
But at this point, I am stuck because I can't think about some reasonable condition on $Y$ in order to be sure that $Y(f_i)=0$.
My ideas are to use the fact that we can have at most $(n-1)$ independent first integrals of both $X$ and $Y$, and moreover at most $n$ linearly independent vectors on $T_mM$ for any $m\in M$, but I don't actually know how to proceed.
 A: Let $M=\mathbb{R}^n$ and $f_i:=\langle x,e_i\rangle$ for $i=1,\ldots n-2$. Then $\partial_{n-1}f_i=0$ for any $i=2,\ldots,n-1$.
The submanifold $N:=\bigcap_{i=1}^{n-2}\{f_i=0\}=\text{span}(e_{n-1},e_n)$ is where the integral lines of $Y$ (starting from $N$) must lie if one wants that $\mathcal{L}_Yf_i=0$ for any $i=1,\ldots,n-2$.
Now obiviously any vectorfield of the type $\partial_v$ where $v\in\mathbb{R}^n$ is a fixed vector we have $[\partial_v,\partial_{n-1}]=0$.
The last line shows that there is no relation between the commutation of $\partial_v$ and $\partial_{n-1}$ and the fact that the integral lines (with starting points in $N$) of $\partial_v$ are contained in $N$.
Now let's discuss more about what you want. By Whitney's theorem let's assume $M$ is a smooth manifold embedded in $\mathbb{R}^{2n+1}$ and that $X$ is tangent to the submanifolds $N$ of $M$ given by $\bigcap_{i=1}^{n-2}f^{-1}_i(0)$. The manifold $N$ has dimension $2$ and thus if $Y$ is tangent to $N$ and linearly independent on $X$ you have just one choice for $Y$: it must be the vectorfield tangent to $N$ and orthogonal to $X$.
