Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just came across the following curiosity and I'm not sure whether it's a bug or just me missing something. Here's a minimal example: I defined the following "function"

In[1]:= S[x_, y_, z_] := DiracDelta[x^2 + y^2 + z^2 - 1];

which is supposed to parametrize the surface of a unit sphere. However, when I integrate over the entire space (x,y,z $\in$ [-2,2] should do) I get $2\pi$ as a result

In[2]:= Integrate[S[x, y, z], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]

Out[2]:= 2 Pi

Shouldn't this be rather 4$\pi$?

share|improve this question
up vote 4 down vote accepted

I think Mathematica is correct here:

$$\int_{-2}^2 \delta(x^2+y^2+z^2-1)~ dx dy dz = \int_0^\infty dr \int_0^\pi d\theta \int_0^{2\pi}d\phi ~r^2\sin\theta~ \delta(r^2-1)$$ $$= \frac{1}{2}\int_0^\infty d(r^2) \int_0^\pi d\theta \int_0^{2\pi}d\phi ~r\sin\theta~ \delta(r^2-1) = \frac{1}{2}\int_0^\pi d\theta \int_0^{2\pi}d\phi ~ \sin\theta= 2\pi$$

share|improve this answer
Hmpf... you beat me to it ;) +1 – sebhofer Feb 6 '14 at 9:23
I think it would be nice to replace the integration region in the first integral by R^3 though. – sebhofer Feb 6 '14 at 9:25
Damn, you are absolutely right! In order to get 4*Pi I would have to replace the argument of the delta"function" by (Sqrt[x^2+y^2+z^2]-1). Cheers! – André Feb 6 '14 at 9:39
Unexpected but true. Here's a Generalisation: In[175]:= Integrate[ DiracDelta[(x^2 + y^2 + z^2)^a - 1], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity, Infinity}] Out[175]= (2*Pi)/Abs[a] – Dr. Wolfgang Hintze Aug 17 '14 at 20:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.