The problem and its solution is given below:
But I could not understand which proof the writer is taking about and how he get the third line in the proof. Could anyone explain this for me please?
And is there a mistake in the proof of the second part? or do we used that the derivative is merely the inclusion map?
Edit:
Here is another solution which I found:
But I do not understand why $f\circ i$ is a diffeomorphism and why $T_{x}(W)$ is the preimage of $T_{f(x)}(Z)$, could anyone explain this for me please?


Let $x\in W=f^{-1}(Z)$ and $f(x)\in Y$ and let $l$ be the codimension of $Z$ in $Y$. Then, by problem 4 on page 25, let $V\subset Y$ be an open subset of $Y$ around $f(x)$ and let $g:V\to\mathbb{R}^l$ ($g=(g_1,\dots,g_l)$ independent functions) so that $Z\cap V=g^{-1}(0)$. Then choose $U$ around $x$, open in $X$, so that $U\cap W=(g\circ f)^{-1}(0)$.
Then, by the proposition, $U\cap W$ is the preimage of a regular value $0\in\mathbb{R}^l$ under the smooth map $g\circ f$. Thus the kernel of the derivative $d(g\circ f)_x$ is precisely the tangent space to $U\cap W$, $T_x(W)$.
The third line in the solution that you found is simply unpacking what $\ker d(g\circ f)_x$ is.