# How do I calculate a double integral if the limits of one integral depend on the other variable?

I came up with this question thinking about calculating the surface area of some strip around a sphere of radius $$a$$. If the strip has constant width (determined by the angles $$\alpha$$ and $$\beta$$) then one can easily determine that the surface area of said sphere is:

$$S=2\pi a^2 (\cos\alpha - \cos \beta)$$

Now, what if the width of the strip varies as you move around the azimuthal coordinate $$\varphi$$? That is, $$\alpha = \alpha (\varphi)$$ (let's keep $$\beta$$ constant for simplicity). Now one limit of the colatitude variable $$\theta$$ depends on $$\varphi$$. How can we solve this problem? I guess you need to parametrize it in some way, but I'm not sure how.

• In the first example, is your strip “horizontal?” I mean, are $\alpha$ and $\beta$ the limits of $\phi$? Commented Aug 8, 2023 at 18:00
• I'm using the notation common in physics, that is, $\theta$ represents the colatitude and $\phi$ the azimuthal angle. $\alpha$ and $\beta$ are the limits of $\theta$. Commented Aug 8, 2023 at 18:01
• I see. So indeed we are using opposite names for the coordinates. Commented Aug 8, 2023 at 18:12
• When the limits of an inner integral depend on a variable from an outer integral, sometimes you'd like to swap the order of integration. To do this you can apply the handy trick of introducing an indicator function. E.g., you could replace the integral of $f(x,y)$ from $x = a(y)$ to $b(y)$ with the integral of $f(x,y) I[a(y) \le x \le b(y)]$ from $x = -\infty$ to $\infty$, where $I[a(y) \le x \le b(y)]$ is $1$ when $a(y) \le x \le b(y)$ and $0$ otherwise. You may then swap the order of integration to evaluate the integral over $y$ first. (Caveat: dominated convergence required to swap.) Commented Aug 8, 2023 at 18:38

## 1 Answer

The first integral, the one you easily determined, is $$\int_0^{2\pi} \int_\beta^\alpha a^2 \sin\theta\,d\theta\,d\phi = 2\pi a^2 \left(\cos\alpha - \cos\beta\right)$$ If the strip has variable width, such that $$\alpha$$ depends on $$\phi$$, then the surface area is $$\int_0^{2\pi} \int_\beta^{\alpha(\phi)} a^2 \sin\theta\,d\theta\,d\phi$$ The innermost integral is with respect to the variable $$\theta$$, while the upper limit depends on $$\phi$$. Therefore this integral is a function of $$\phi$$. The integral of that function from $$0$$ to $$2\pi$$ is the surface area.