# Calculating Solid angle for a sphere in space

How can I calculate the solid angle that a sphere of radius R subtends at a point P? I would expect the result to be a function of the radius and the distance (which I'll call d) between the center of the sphere and P. I would also expect this angle to be 4π when d < R, and 2π when d = R, and less than 2π when d > R.

I think what I really need is some pointers on how to solve the integral (taken from wikipedia) $\Omega = \iint_S \frac { \vec{r} \cdot \hat{n} \,dS }{r^3}$ given a parameterization of a sphere. I don't know how to start to set this up so any and all help is appreciated!

Ideally I would like to derive the answer from this surface integral, not geometrically, because there are other parametric surfaces I would like to know the solid angle for, which might be difficult if not impossible to solve without integration.

*I reposted this from mathoverflow because this isn't a research-level question.

-
This is too simple a situation to apply calculus to. You know that the area (solid angle) of a circular cap of (angular) radius $\rho$ is $2\pi(1-\cos\rho)$, and you know that your ball of radius $R$, at a distance $d$ has an angular radius of $\rho=\arcsin(R/d)$ as seen from your point $P$. The proper formula falls out, valid only when $R\le d$.
You do realize, I hope, that what you need to parametrize is, in the words of the Wikipedia entry, “the projection of the surface $S$ to the unit sphere with center $P$”, and not anything on your ball of radius $R$. This projection is always a circular cap, as I say above; for a more complicated surface in space, it may be harder to describe the projection on the unit sphere.