I wish to use the Gauss-Bonnet theorem to calculate $\int_{M_r} K dA$ for the surface $$M_r = \{ (x,y,z)\in\mathbb{R}^3 |z = \cos\sqrt{x^2 + y^2}, x^2 + y^2 < r^2, x,y, > 0 \}.$$ It feels natural to change to cylindrical coordinates $(\rho, \theta, z)$, so this is what I do. Namely, I set $x = \rho\cos \theta$, $y = \rho\cos\theta$ and $z = z$. Then $$M_r = \{ (\rho,\theta,z)\in\mathbb{R}^3 |z = \cos\rho, \rho < r, 0 < \theta < \pi/2 \}.$$
Then the surface looks like this (and forgive my terrible drawing skills):

The arrows indicate the direction I need to path-integrate in. The direction of the normal will be justified presently. This surface is a level set, so its normal is given by $N = \nabla(z - \cos\rho) = (\sin\rho, 0, 1)$. So the normal points as in the picture, namely 'up'.
I now wish to use $$\int_{M_r}K dA = \sum \alpha_i - (n-2)\pi - \int k_g ds,$$ where the $\alpha_i$s denote the angles between the curves $\gamma$, $n$ the number of angles, and the final integral the path-integral of the geodesic curvature along the curves $\gamma$. So, $$ \int_{M_r}K dA = \pi/2 - \int k_g ds ,$$ since all the angles are $\pi/2$.
Now, because of symmetry we have $$ \int_{\gamma_1} k_g ds = -\int_{\gamma_3} k_g ds, $$ and so we only need to parametrize $\gamma_2$. At $\gamma_2$ we have $r = \rho$ and so we may parametrize it by $$\gamma_2(\theta) = (r, \theta, \cos r),$$ which clearly is an arclength-parametrization. Indeed, we have $$ \gamma_2'(t) = (0, 1, 0), \\ \gamma_2''(t) = (0, 0, 0). $$ Calculating the geodesic curvature is therefore easy, it's just $k_g = 0$. This is where I feel like I've made some mistake. It doesn't seem reasonable that the geodesic curvature along $\gamma_2$ is identically zero. If it is, the answer is just $$\int_{M_r} = \pi/2,$$ independent on what value $r$ takes, which seems strange to me.
I would suggest spending some time unraveling what coordinate charts on surfaces are, and how curves on the parameter space correspond to curves on the surface.
– topolosaurus Oct 28 '21 at 15:15