I'm trying to solve the following exercise on M. Audin's book $\textit{Morse Theory and Floer Homology}$ p.18. Here is the problem :
Let $M$ be a smooth manifold and let $g : M \to \Bbb{R}$ be a smooth function. Show that the bilinear form $(d^2g)_x$ is well-defined on the vector subspace $ \text{Ker}(dg)_x \subset T_xM$, for any $x\in M$.
The bilinear form $(d^2g)_x : T_xM \times T_xM \to \Bbb{R}$ initially only defined on a critical point $x$ as $(d^2g)_x (X,Y):= X (\widetilde{Y}g)$, for any $X,Y \in T_xM$, and $\widetilde{Y}$ is a local extension of $Y$ around $x$. For critical points, it is easy to see that $d^2g_x$ well defined. As i understand, now the problem ask us to verify that the restriction $$ d^2g_x : \text{Ker}(dg_x) \times \text{Ker}(dg_x) \to \Bbb{R} $$ (where $\widetilde{Y}$ is a local extension of $Y$) is also well-defined on any point $x \in M$.
To show that $d^2g_x$ well-defined on the kernel, we have to show that $d^2g_x(X,Y)$ independent of the extension $\widetilde{Y}$ of $Y$. That is if $\widetilde{Y}_1,\widetilde{Y}_2$ are any two extension of $Y$, then we have to show that $$ X(\widetilde{Y}_1g) - X(\widetilde{Y}_2g)=0 $$ Unfortunately after a while, i have no idea how to do this, or even just showing that $d^2g_x$ is symmetric. After a while i think i came up with (probably) a counterexample.
Let $M = \Bbb{R}^3$ and consider $g : M \to \Bbb{R}$ be a projection $g(x,y,z) = z$. Choose $x = (0,0,0)$, $X = \partial/\partial x|_x, Y= \partial/\partial y|_x \in T_xM = T_{(0,0,0)}M$. Now since $dg_x = (0 \, 0\, 1)$, then $dg_x(v) = dg_x(v_x,v_y,v_z) = v_z$. So $X,Y$ are in the kernel of $dg_x$.
Choose extension $$ \widetilde{Y} = \frac{\partial}{\partial y} + kx \frac{\partial}{\partial z}, $$ for some nonzero $k \in \Bbb{R}$. Now $d^2g_x(X,Y) = $ $$ X(\widetilde{Y}g) =\frac{\partial}{\partial x}\Big|_x \Big( \frac{\partial}{\partial y} + kx \frac{\partial}{\partial z}\Big)g(x,y,z) = \frac{\partial}{\partial x}\Big|_x \Big( \frac{\partial}{\partial y} + kx \frac{\partial}{\partial z}\Big)z = \frac{\partial}{\partial x}\Big|_x kx = k. $$ Which is shows that $(d^2g)_x(X,Y)$ depends on the extension (by choosing $k$ differently).
Is my counterexample correct ? Or am i missing something ? Any help will be appreciated. Thank you.