Derivative of function defined on two different coordinate charts on each one. I'm reading Milnor's Lectures on h-cobordism and got stuck with part of proof of lemma 2.6 which reduces to folowing problem:
Let's consider some smooth manifold $M$ with boundary and two coordinate charts $(U, h), (U', h')$ intersecting themselves on $\partial M$ such that $h:p\mapsto (x_1(p),\ldots, x_n(p))$ $h':p\mapsto (x_1'(p),\ldots, x_n'(p))$ respectively maps $U,U'$ onto $D^n \cap \mathbb{R}_+^n$. If $f,f':M \to \mathbb{R}$ are such that $f=\pi_n \circ h, f'=\pi_n \circ h'$ ($\pi_n$ states for projection on $n$-th coordinate) then for $p \in \partial M \cap U \cap U'$ one has $\frac{\partial f}{\partial x_n}(p)=1$ and $\frac{\partial f'}{\partial x_n}(p)>0$.
The first part is clear for me because  $\frac{\partial f}{\partial x_n}(p)=\frac{\partial x_n}{\partial x_n}(p)=1$ but I cannot come up with formal proof of the inequality. I'm not really familiar with such reasonings so I'd like to see formal proof with explanation. Thanks in advance.
 A: First, I believe that you need that $U \cap U'$ not only intersects $\partial M$, but that it does so in an nontrivial way, so that $h' \circ h^{-1}$, which is defined on 
$$
V = h(U \cap U') \subset D^n \cap \mathbb R^n_{+}
$$
has the property that $V$ contains 
$$
W \cap  \mathbb R^n_{+}
$$
where $W$ is an open set in $\mathbb R^n_{+}$ that intersects the hyperplane $H = \{ (a_1, \ldots, a_n) | a_n = 0 \}$ in an open set in that hyperplane. Informally, $h(v)$ contains a "substantial piece" of boundary rather than just a single point. Maybe this is a consequence of your assumptions...but I'm not certain of that. 
Once you have this, the rest isn't too bad: 
Let $p \in \partial M$, and let $q$ and $q'$ denote the images of $p$ under $h$ and $h'$, respectively, with $q \in W$. 
The map $g = h' \circ h^{-1}$ on $W$ is required, as a chart, to be a diffeomorphism, and to send the hyperplane $H$ to the hyperplane $H$. Consider the action of $dg$ on the vectors $e_1, \ldots, e_n$ at $q$.  
For $i = 1, \ldots, n-1$, the curve $\gamma: [-1, 1] \to \mathbb R^n: t \mapsto q + te_i$ lies in $H$, so $g \circ \gamma$ is a curve in $H$, with $(g \circ \gamma)(0) = q'$. [You should verify this, just to be sure you've got the notation down.] The derivative of $g$ at $q$ therefore takes the vector $e_i$ to a vector $e'_i$ at $q'$, and $e'_i$ lies in $H$. 
Since $dg$ is a diffeomorphism, $dg(q)$ must be an isomorphism of vector spaces, so 
$$
e_n' = dg(q)[e_n]
$$
must be a vector at $q'$ that's not in the span of $e'_1, e'_2, \ldots, e'_{n-1}$, which is $H$ (why?). It's therefore got a nonzero component in the $n$ coordinate direction. Furthermore, since $\pi_n(g(q)) = 0$, but $\pi_n(g(s)) \ge 0$ for every $s$, this nonzero coordinate must be positive.
Now...let's look at $f'(s) = \pi_n \circ h'(s) $. The definition of 
$$
\frac{\partial f'}{\partial x_n}(p)
$$
is that it's the derivative of 
$$
f' \circ h^{-1}(a_1, \ldots, a_n)
$$
with respect to $a_n$ at the point $q$, or equivalently, it's 
$$
d(f' \circ h^{-1})(q)[e_n],
$$
the derivative of the map at $q$ (which is a linear transformation on vectors) applied to the vector $e_n$. 
Let's rewrite that function: 
$$
f' \circ h^{-1} =  (\pi_n \circ h') \circ h^{-1} = \pi_n \circ g
$$
Now $g$ and $\pi_n$ are both maps of Euclidean space, so the chain rule applies: 
\begin{align}
d(\pi_n \circ g)(q) &= d\pi_n(g(q)) \cdot dg(q)
\end{align}
The first factor here is just the linear map that extracts the $n$th coordinate, i.e, I'm saying that 
$$
d\pi_n(g(q)) = \pi_n
$$
(which is generally true for linear maps). 
So now we have
\begin{align}
d(\pi_n \circ g)(q)[e_n] 
&= \pi_n (  dg(q)[e_n] ).
\end{align}
But the argument to $\pi_n$ is a vector that we just showed earlier has a nonzero and indeed positive $n$th component, so this expression is $> 0$, as required. 
