# Using a smooth function to replace a coordinate on a manifold

I don't know very much about differential geometry, so this may be trivial but I will try to make this question as clear as I can.

Suppose I have a $$d$$ dimensional smooth manifold $$\mathcal{M}^d$$, with a smooth maximal atlas $$\mathcal{A}$$. In the neighborhood of a point $$m$$ I have a chart $$(U,\phi) \in \mathcal{A}$$ that gives some local coordinates for my manifold, say $$\phi(m) = (x^1(m), ..., x^d(m))$$ and $$\phi : U \subseteq \mathcal{M}^d \rightarrow \mathbb{R}^d$$ is a homeomorphism. Suppose also that I have a smooth function defined on my manifold, $$f: \mathcal{M}\rightarrow \mathbb{R}$$.

My question is the following: Are there any conditions that guarantee that the chart $$(V, \psi)$$, with $$m \in U \cap V$$, $$\psi = (x^1, ..., f)$$ is also in $$\mathcal{A}$$?

In other words, how can I be sure that I can replace one of my coordinates with the smooth function $$f$$?

The way the IFT is written there is that some local functions $$(f_1,\dots,f_n):U\to\mathbb R^n$$ define a coordinate chart around $$p\in U$$ iff there's a chart $$(x_1,\dots,x_n)$$ around $$p$$ such that $$\det\begin{bmatrix}\dfrac{\partial f_i}{\partial x^j}\end{bmatrix}\neq 0$$
So we get a sufficient a condition: $$(x_1,\dots,x_{n-1},f)$$ defines a chart if $$\det \begin{bmatrix} \dfrac{\partial x_1}{\partial x^1} &\cdots &\dfrac{\partial x_1}{\partial x^{n-1}}&\dfrac{\partial x_1}{\partial x^n}\\ \vdots & \ddots &\vdots & \vdots \\ \dfrac{\partial x_{n-1}}{\partial x^1} &\cdots &\dfrac{\partial x_{n-1}}{\partial x^{n-1}}&\dfrac{\partial x_{n-1}}{\partial x^n}\\ \dfrac{\partial f}{\partial x^1}&\cdots&\dfrac{\partial f}{\partial x^{n-1}}&\dfrac{\partial f}{\partial x^n} \end{bmatrix} = \det \begin{bmatrix} 1 & \cdots &0&0\\ \vdots & \ddots &\vdots & \vdots \\ 0 &\cdots &1&0\\ \dfrac{\partial f}{\partial x^1}&\cdots&\cdots&\dfrac{\partial f}{\partial x^n} \end{bmatrix} = \dfrac{\partial f}{\partial x^n} \neq 0.$$