
An integral with a couple lessons - douche
http://www.johndcook.com/blog/2016/12/07/gaussian-integral/
======
wiz21c
To me the polar coordinate trick show why maths are hard for me.

When I've seen this integral for the first time, I was indeed clueless. But
then there's this trick. The problem is that, when I look at the integral,
with the math I know when I encounter it for the first time, it's very hard to
infer that the trick is possible by just looking at the integral.

But maybe I don't know enough math to have the "bag of tricks" ready in my
mind.

~~~
jgrahamc
I did quite a lot of mathematics and your last line is correct. There are lots
of hard concepts in maths that you end up getting your head around but then
you end up with a toolbox of things to work with.

~~~
k__
This often eluded me in university.

I had the feeling before uni, these "tools" were shortcuts for a bit more
complicated processes. But the magnitude of "complicated" got risen rather
high in uni.

In highschool I could simply cobble together the solution while working on it
at an exam, but this "cobbling" often would take a few days for higher math.

Math went from a "get rules"-subject to a "memorize all the shortcuts"-subject

So university math was suddendly the same as highschool history, which I
hated, and less like highschool math, which I loved.

~~~
pif
> Math went from a "get rules"-subject to a "memorize all the
> shortcuts"-subject

I'm sincerely sorry for you, you clearly had no luck in the choice of
uni/prof. It must have been painful.

~~~
k__
It was. It's a miracle that I got through it somehow.

Calculus was especially hard.

Linear Algebra was rather nice.

------
tomahunt
Another example of the main point in this post is a simpler integral 0 to 2*pi
of (sin x)^2 or (cos x)^2. By noting that both integrals will be the same and
looking at the integral of their sum.

The Gaussian integral in the post is on of the most useful out there.

I highly recommend the Wikipedia page:

[https://en.m.wikipedia.org/wiki/Gaussian_integral](https://en.m.wikipedia.org/wiki/Gaussian_integral)

Quantum Field Theory in a Nutshell by Zee bases a couple of chapters on this
integral.

~~~
n4r9
When I was preparing for the UK STEP examinations, one of the questions had
you evaluate an integral I by carefully choosing another integral J such that
I+J and I-J were both very easy to evaluate. From there it's just a matter of
simultaneous equations.

I've never seen this trick replicated elsewhere in research or teaching, but
it's stuck with me as an incredibly elegant method.

------
ohazi
It's been ages since I took complex analysis, but I distinctly remember the
first time I used contour integration to solve a convoluted definite integral
and being absolutely floored that I got the right answer. The technique looks
like super hand-wavey bullshit, and the algebra usually ends up being way
easier than you think is reasonable for a given problem.

I'm still amazed that it works.

Example:
[https://en.wikipedia.org/wiki/Residue_theorem](https://en.wikipedia.org/wiki/Residue_theorem)

~~~
chestervonwinch
For the integral in the post, it's not so straight-forward to use complex
contour integration [1]. Though, I agree with you -- for many other similarly
intimidating integrals, complex integration can work wonders.

[1]:
[http://www.jstor.org/stable/2588989?seq=1#page_scan_tab_cont...](http://www.jstor.org/stable/2588989?seq=1#page_scan_tab_contents)

------
yummyfajitas
One very practical place I've seen where this is a problem is in monte carlo
simulation.

A lot of people think of the problem in terms of the monte carlo simulation.
As a result, they forget that the monte carlo simulation is actually an
approximation of an integral.

If you remember this fact, there's a lot of tricks you can do. You can
analytically evaluate parts of the integral. You can replace monte carlo with
a more accurate quadrature rule; e.g. Simpson's rule in low dimensions,
quasimonte carlo in high.

But you'll never do any of that if you don't distinguish between the
integration technique (anti-derivative trick, monte carlo, etc) and the
integral itself.

------
todd8
For those interested in math and particularly in learning how to attack
challenging (definite) integrals, I can recommend this book by Paul Nahin:
_Inside Interesting Integrals_ [1]. It's well reviewed on Amazon and I enjoyed
the writing.

[1]
[https://www.amazon.com/gp/product/1493912763/ref=oh_aui_sear...](https://www.amazon.com/gp/product/1493912763/ref=oh_aui_search_detailpage?ie=UTF8&psc=1)

------
taneq
When I saw the title I immediately wondered if it was the integral of
e^-(x^2). I spent months in high school wrangling with this one, convinced
that it had to be possible somehow. Obviously I never quite made it happen,
but some good times were had nonetheless.

------
klodolph
Only in a certain sense does that antiderivative not exist.

~~~
kmill
Do you mean something other than the sense the author mentions, that it can't
be given in terms of elementary functions?

~~~
oxymoron
Can't be given in terms of elementary functions, with a finite number of
terms. Seems a bit arbitrary though -- neither can exp(x) or ln(x) or sin(x),
so introducing erf(x) and defining it using an integral seems more par the
course than cheating.

~~~
kmill
Yeah, I meant finitely many terms. To me, things like "infinite sums" are
special operations since they don't always converge.

In case and exp, ln, sin seem special: they are solutions to simple linear
differential equations x'-x=0, tx'=1, and x''-x=0. Though, erf comes from
x''+2tx'=0, so I can't say I really understand what makes a function
"elementary." Without knowing more, I'd exclude logarithms, and then say that
elementary functions are solutions to homogeneous linear differential
equations with constant coefficients.

Edit: looking at MathWorld, it seems the definition has the set of elementary
functions closed under inverses, which is why logarithms are included.

~~~
OscarCunningham
I don't know a precise definition of "elementary", but one thing about the
elementary functions (exp,log,sin,cos,arcsin,arccos,+,x,-,/) is that they
interact with each other in nice ways:

log(ab)=log(a)+log(b)

cos(a+b)=cos(a)cos(b)-sin(a)sin(b)

sin(log(x))=(x^-i - x^i)i/2

etc.

This means that if your integral yields and answer in terms of log, exp or
trigonometric functions then there is a good chance that any further algebra
you have to do will work out nicely. But erf satisfies no such relations and
so an answer in terms of it is often an algebraic dead end.

