I am doing exercise 2, chapter 2, section 3 from Guillemin and Pollack's ''Differential Topology''. Part of the excercise is to prove that given a compact manifold $Y \subset \mathbb{R}^m$, and a pont $w \in \mathbb{R}^m$, there exist a point (not necessarily unique) $y \in Y$ closest to $w$. This part I have done, the next part is to prove that $w-y \in N_y(Y)$.
($N_y(Y)$ is the orthogonal complement of $T_yY$)
I followed the hint, and since any element in $T_yY$ is the velocity vector of a curve $c$ in $Y$ such that $c(0)=y$, then all i got to prove is that $(w-y) \cdot \dot{c(0)}=0$ for all of these curves.
Since the function $ g(t) =\mid w-c(t) \mid^2 = \sum_{i=1}^m w_i^2+c(t)_i^2 $ has a minimum at $0$, deriving you get:
$0=g'(0)= 2\sum_{i=1}^m c(0)_ic'(0)_i = y\cdot \dot{c(0)}$, which would mean that $y$ is in $N_y(Y)$. Which is in many cases false.
What is my error here?
Note that $\displaystyle\lVert w-c(t)\rVert^2=\sum_{i=1}^m{w_i}^2-2w_ic_i(t)+{c_i}^2(t)$. It looks like you forgot the middle term.