Help with understanding how to find the area of part of sphere that lies inside a cylinder I really have a hard time understanding how to solve problems where you have two surfaces intersecting. The problem I'm stuck on now is the following:
Find the area of the part of the sphere $x^2+y^2+z^2=4a^2$ that lies inside the cylinder $x^2+y^2=2ay$.
This problem is stated in a chapter about surface integrals, so I must find the area element $dS$. But I don't understand how to find it, or where to start. The book has a solution to this problem, but I don't really understand what they do (see pictures below). Like what do they do in this when writing $2z (dz/dy)=-2x$ ?


 A: I've taken a couple of classes that cover surface integration, and it is often explained in a couple of different ways. I'll try and lay out what made most sense to me.
\begin{equation}
\iint_\mathbb{R}\,dS = \iint_\mathbb{R}\|\mathbf{n}\|\,dudv
\end{equation}
where $\mathbf{n}$ is a special normal vector. One way that we often find this vector is by solving for $z$ in terms of $x$ and $y$, so that we can parameterize the surface with $u = x$ and $v = y$. Because we make this substitution, our integral turns into:
\begin{equation}
\iint_\mathbb{R}\|\mathbf{n}\|\,dxdy
\end{equation}
Now we have to solve for $z$ in terms of $x$ and $y$.
\begin{equation}
\mathbf{r}(x,y) = \begin{bmatrix} x \\ y \\ \sqrt{4a^2 - x^2 - y^2} \end{bmatrix}
\end{equation}
Just a note, notice that for $-2a \lt x \lt 2a$ and $-2a \lt y \lt 2a$, plugging in any $x$, $y$ pair to $\mathbf{r}(x,y)$ will give you a point on this sphere! That's what a surface parameterization does. Alright, so, now that we have $\mathbf{r}(x,y)$, we need to compute $\mathbf{n}$, which is defined as:
\begin{equation}
\mathbf{n} = \frac{\partial \mathbf{r}}{\partial x} \times \frac{\partial \mathbf{r}}{\partial y} = 
\begin{bmatrix}
\hat{i} & \hat{j} & \hat{k} \\
\frac{\partial (x)}{\partial x} & \frac{\partial (y)}{\partial x} & \frac{\partial (\sqrt{4a^2 - x^2 - y^2})}{\partial x} \\
\frac{\partial (x)}{\partial y} & \frac{\partial (y)}{\partial y} & \frac{\partial (\sqrt{4a^2 - x^2 - y^2})}{\partial y} 
\end{bmatrix}
\end{equation}
\begin{equation}
\frac{\partial \:}{\partial \:x}\left(\sqrt{4a^2-x^2-y^2}\right) = \frac{1}{2\sqrt{4a^2-x^2-y^2}}\left(-2x\right) = -\frac{x}{\sqrt{4a^2-x^2-y^2}} = -\frac{x}{z}
\end{equation}
\begin{equation}
\frac{\partial \:}{\partial \:y}\left(\sqrt{4a^2-x^2-y^2}\right) = \frac{1}{2\sqrt{4a^2-x^2-y^2}}\left(-2y\right) = -\frac{y}{\sqrt{4a^2-x^2-y^2}} = \frac{-y}{z}
\end{equation}
\begin{equation}
\begin{bmatrix}
\hat{i} & \hat{j} & \hat{k} \\
1 & 0 & -\frac{x}{z} \\
0 & 1 & -\frac{y}{z}
\end{bmatrix} =
\begin{bmatrix}
\frac{x}{z} \\
\frac{x}{y} \\
1
\end{bmatrix}
\end{equation}
Since we need the magnitude, you don't have to worry about the sign, but in general this normal vector should always point outward from the surface.
\begin{equation}
\|\mathbf{n}\| = \sqrt{(\frac{x}{z})^2 + (\frac{y}{z})^2 + (1)^2} = \sqrt{1 + \frac{x^2 + y^2}{z^2}}
\end{equation}
Finally! We have the equation that is listed in your textbook for $dS$. The integral becomes:
\begin{equation}
\iint_\mathbb{R} \sqrt{1 + \frac{x^2 + y^2}{z^2}} \,dxdy
\end{equation}
Now just substitute in the equation for $z$ and we get the integral that they convert to polar coordinates. There's a lot of steps in the solution they provide that seem to come out of thin air. Hopefully this helps clear it up.
EDIT to answer:

But here I don't understand using dxdy works when the area does not
even lay in the xy-plane. I just really want to visualize how this
works.

One really helpful thing I was taught is to think of surface integration as projecting the surface area that you want to compute onto the plane that you want to integrate over. How does this end up giving you the surface area of the region that you are projecting? Through $\|\mathbf{n}\|$. Adding this to the inside of the integral scales every little piece of the integration in just the right way so that our normal area integration in the x-y plane actually gives us the surface area of the region above it. Here's a quick sketch:

