# Help computing the following integral

• docnet
I get $$\int e^{w}dw=\int e^{-r^2}(-2rdr)$$ when I use substitution, the integral becomes $$\int e^{w}dw=\int e^{w}(-2dw)=-2\int e^{w}dw=-2e^{w}$$In summary, the conversation discusses the use of substitutions and polar coordinates to evaluate a challenging integral involving the Gaussian function. The expert summarizer provides a detailed solution attempt, addressing any errors made along the way. However, upon re-evaluating the inner integral, it is determined that the integral cannot be solved in closed form.f

#### docnet

Homework Statement
Can this gaussian integral be solved?
Relevant Equations
$$\int^{\frac{x}{\sqrt{t}}}_0e^{-\frac{s^2}{4}}ds+d$$
Solution attempt:

we make the substitution ##\frac{s}{2}=u## and ##ds=2du## to compute
$$\Big(2\int^{\frac{2x}{\sqrt{t}}}_0e^{-u^2}du\Big)^2=2\int^{\frac{2x}{\sqrt{t}}}_0e^{-u^2}du2\int^{\frac{2x}{\sqrt{t}}}_0e^{-v^2}dv=4\int^{\frac{2x}{\sqrt{t}}}_0\int^{\frac{2x}{\sqrt{t}}}_0e^{-(u^2+v^2)}dudv$$we consider the function ##e^{-r^2}## on the plane ##R^2## and compute the integral

$$4\int\int_{[0,{\frac{2x}{\sqrt{t}}}]\times[0,{\frac{2x}{\sqrt{t}}}]}e^{-r^2}rdrd\theta$$

Nice work to convert to polar coordinates! That's often the best first thing to try for Gaussian integrals.

You should be able to calculate the indefinite integral for the inner integral.

Next you need to convert your integration limits to polar coordinates.

The r integration interval will have lower limit 0.
Since the integration area lies in the first quadrant, the theta integral will have limits ##0,\pi/2## but you can use symmetry of the area around the line ##v=u## to integrate for ##\theta\in[0,\pi/4]## and double the result.
It remains to calculate the upper limit for the r integral, as a function of ##\theta##. Drawing a diagram of the integration area will help there.

After that you will have an integral over ##\theta## to perform, which hopefully is not too hard - but can't be sure without first doing the above.

docnet
Solution attempt:

we make the substitution ##\frac{s}{2}=u## and ##ds=2du## to compute
$$\Big(2\int^{\frac{2x}{\sqrt{t}}}_0e^{-u^2}du\Big)^2=2\int^{\frac{2x}{\sqrt{t}}}_0e^{-u^2}du2\int^{\frac{2x}{\sqrt{t}}}_0e^{-v^2}dv=4\int^{\frac{2x}{\sqrt{t}}}_0\int^{\frac{2x}{\sqrt{t}}}_0e^{-(u^2+v^2)}dudv$$we consider the function ##e^{-r^2}## on the plane ##R^2## and compute the integral

$$4\int\int_{[0,{\frac{2x}{\sqrt{t}}}]\times[0,{\frac{2x}{\sqrt{t}}}]}e^{-r^2}rdrd\theta$$
we set the boundaries of the integral using ##\theta\in[0,\frac{\pi}{4}]## and ##r\in[0,\frac{2\pi}{\sqrt{t}cos\theta}]## and put a 2 before the integral
$$8\int_0^{\frac{\pi}{4}}\int_0^{\frac{2\pi}{\sqrt{t}cos\theta}} re^{-r^2}drd\theta$$ we make exchanges using ##\clubsuit=-r^2## and ##d\clubsuit=-2rdr## to evaluate the inner integral

$$-\frac{1}{2}\int e^{\clubsuit}d\clubsuit=-\frac{e^\clubsuit}{2}\Rightarrow-\frac{e^{-r^2}}{2}\Rightarrow \frac{1}{2}-\frac{e^{-\frac{4\pi^2}{tcos^2\theta}}}{2}$$giving
$$8\int_0^{\pi/4}\Big[\frac{1}{2}-\frac{e^{-\frac{4\pi^2}{tcos^2\theta}}}{2}\Big]d\theta=\pi+4\int_0^{\pi/4}e^{-\frac{4\pi^2}{tcos^2\theta}}d\theta$$

Solution attempt:

we make the substitution ##\frac{s}{2}=u## and ##ds=2du## to compute
$$\Big(2\int^{\frac{2x}{\sqrt{t}}}_0e^{-u^2}du\Big)^2=2\int^{\frac{2x}{\sqrt{t}}}_0e^{-u^2}du2\int^{\frac{2x}{\sqrt{t}}}_0e^{-v^2}dv=4\int^{\frac{2x}{\sqrt{t}}}_0\int^{\frac{2x}{\sqrt{t}}}_0e^{-(u^2+v^2)}dudv$$we consider the function ##e^{-r^2}## on the plane ##R^2## and compute the integral

$$4\int\int_{[0,{\frac{2x}{\sqrt{t}}}]\times[0,{\frac{2x}{\sqrt{t}}}]}e^{-r^2}rdrd\theta$$
we set the boundaries of the integral using ##\theta\in[0,\frac{\pi}{4}]## and ##r\in[0,\frac{2\pi}{\sqrt{t}cos\theta}]## and put a 2 before the integral
$$8\int_0^{\frac{\pi}{4}}\int_0^{\frac{2\pi}{\sqrt{t}cos\theta}} re^{-r^2}drd\theta$$ we make exchanges using ##\clubsuit=-r^2## and ##d\clubsuit=-2rdr## to evaluate the inner integral
Why not just use an ordinary letter instead of a card suit?
docnet said:
$$-\frac{1}{2}\int e^{\clubsuit}d\clubsuit=-\frac{e^\clubsuit}{2}\Rightarrow-\frac{e^{-r^2}}{2}\Rightarrow \frac{1}{2}-\frac{e^{-\frac{4\pi^2}{tcos^2\theta}}}{2}$$giving
$$8\int_0^{\pi/4}\Big[\frac{1}{2}-\frac{e^{-\frac{4\pi^2}{tcos^2\theta}}}{2}\Big]d\theta=\pi+4\int_0^{\pi/4}e^{-\frac{4\pi^2}{tcos^2\theta}}d\theta$$

Delta2 and docnet
I found an error in the boundary of the inner integral. I am re-evaluating my work now

Why not just use an ordinary letter instead of a card suit?
I was being unreasonable. i will change it to the letter w in the next attempt.

I cannot get the upper boundary for the inner integral, because i have $$rcos\theta=\frac{2x}{\sqrt{t}}\Rightarrow r=\frac{2rcos\theta}{\sqrt{t}cos\theta}\Rightarrow 1=\frac{2}{\sqrt{t}}$$ so there is a mistake in my work leading up to this point the beginning integral. I will search.

If I'm not mistaken, the Gaussian integral, which is a scaled version of the normal distribution function, can not be integrated in closed form, except when the upper limit is ## + \infty ##. That is why look up tables are used when these integrals appear in statistical calculations.

docnet
I was being unreasonable. i will change it to the letter w in the next attempt.

I cannot get the upper boundary for the inner integral, because i have $$rcos\theta=\frac{2x}{\sqrt{t}}\Rightarrow r=\frac{2rcos\theta}{\sqrt{t}cos\theta}\Rightarrow 1=\frac{2}{\sqrt{t}}$$ so there is a mistake in my work leading up to this point the beginning integral. I will search.
another mistake in post #6 : ##x \neq rcos\theta## because ##u=rcos\theta##. my original work was correct except the upper bounds are ##\frac{x}{2\sqrt{t}}## and I don't know why I made up ##\pi##. maybe i was hungry for pie.

Solution attempt:

we make the substitution ##\frac{s}{2}=u## and ##ds=2du## to compute
$$\Big(2\int^{\frac{x}{2\sqrt{t}}}_0e^{-u^2}du\Big)^2=2\int^{\frac{x}{2\sqrt{t}}}_0e^{-u^2}du2\int^{\frac{2x}{\sqrt{t}}}_0e^{-v^2}dv=4\int^{\frac{x}{2\sqrt{t}}}_0\int^{\frac{x}{2\sqrt{t}}}_0e^{-(u^2+v^2)}dudv$$we consider the function ##e^{-r^2}## on the plane ##R^2## and compute the integral

$$4\int\int_{[0,{\frac{x}{2\sqrt{t}}}]\times[0,{\frac{x}{2\sqrt{t}}}]}e^{-r^2}rdrd\theta$$
we set the boundaries of the integral using ##\theta\in[0,\frac{\pi}{4}]## and ##r\in[0,\frac{x}{2\sqrt{t}cos\theta}]## and put a 2 before the integral
$$8\int_0^{\frac{\pi}{4}}\int_0^{\frac{x}{2\sqrt{t}cos\theta}} re^{-r^2}drd\theta$$ we make exchanges using ##w=-r^2## and ##dw=-2rdr## to evaluate the inner integral

$$-\frac{1}{2}\int e^{w}dw=-\frac{e^w}{2}\Rightarrow-\frac{e^{-r^2}}{2}\Rightarrow \frac{1}{2}-\frac{e^{-\frac{x^2}{4tcos^2\theta}}}{2}$$giving
$$8\int_0^{\pi/4}\Big[\frac{1}{2}-\frac{e^{-\frac{x^2}{4tcos^2\theta}}}{2}\Big]d\theta=\pi+4\int_0^{\pi/4}e^{-\frac{x^2}{4tcos^2\theta}}d\theta\Rightarrow \boxed{\text{unable to evaluate}}$$

Last edited:
If I'm not mistaken, the Gaussian integral, which is a scaled version of the normal distribution function, can not be integrated in closed form, except when the upper limit is ## + \infty ##. That is why look up tables are used when these integrals appear in statistical calculations.
I did not know this. Is this true?

I did not know this. Is this true?
I think so, at least according to Wolfram Alpha

I need to find the right integral... commencing search for target.. after i eat this cookie

Delta2
Okay, the correct integral is $$\int^\infty_{-\infty}\frac{1}{2\sqrt{\pi t}}exp(-\frac{(x-y)^2}{4t})y^2dy$$
which is an integral over all of ##R## so this guy is a proper Gaussian integral.

$$x^2+2t$$

What do you people think? What kinds of tips and tricks are there for this one, if any?

Question: can I integrate this definite integral by "integration by parts" and evaluate the integral (*) over ##R## before substitution?

$$\int_R exp\Big(-\frac{(x-y)^2}{4t}\Big)y^2dy$$
integration by parts
$$u=y^2$$
$$du=2y$$
$$dv=exp\Big(-\frac{(x-y)^2}{4t}\Big)$$
(*)$$v=\int_R exp\Big(-\frac{(x-y)^2}{4t}\Big)dy$$
$$uv-\int vdu\Rightarrow y^2\int_R exp\Big(-\frac{(x-y)^2}{4t}\Big)dy-\int\Big[2y\int_R exp\Big(-\frac{(x-y)^2}{4t}\Big)dy\Big]dy$$

errrr.. maybe no? no.

Last edited:
The original integral is by definition related to the error function
$$\operatorname{erf}(x) = \frac{2}{\sqrt \pi} \int_0^x e^{-t^2} dt.$$
There is no closed form solution in terms of elementary functions.

@Orodruin See post 12. The OP has now changed the original problem. This one I think can now be readily computed.

Delta2 and docnet
Oh, I missed the updated integral. Yes, it is essentially the solution of the 1D heat equation with initial distribution ##x^2##. It can be relatively easily computed with Feynman's trick, i.e., start by writing down the integral
$$I(x) = \frac{1}{\sqrt{4\pi t}}\int_{\mathbb R} e^{-\frac{(x-y)^2}{4t}} dy = 1.$$
Compute the integral expression for ##I''(x) = 0##. This should result in an expression that contains the sought integral with all other integrals being solvable. The result is indeed ##x^2 + 2t##.

An easier way to arrive at the result is to start from the heat equation itself:
$$u_t(x,t) - u_{xx}(x,t) = 0$$
with initial condition ##u(x,0) = x^2##. Since this means that ##u_{xx}(x,0) = 2##, it follows that ##u_t(x,0) = 2## for all ##x## and therefore ##u## grows at the same rate everywhere, meaning that the shape, and therefore ##u_{xx}## is preserved for all times ##t##, leading to ##u_t(x,t) = 2## and therefore ##u(x,t) = 2t + u(x,0) = 2t + x^2##.

Interestingly, the result can be generalised to any number of dimensions as long as the initial condition has constant second derivative ##\nabla^2 u = \lambda## for some ##\lambda## (in this case, ##\lambda = 2##).

Oh, I missed the updated integral. Yes, it is essentially the solution of the 1D heat equation with initial distribution ##x^2##. It can be relatively easily computed with Feynman's trick, i.e., start by writing down the integral
$$I(x) = \frac{1}{\sqrt{4\pi t}}\int_{\mathbb R} e^{-\frac{(x-y)^2}{4t}} dy = 1.$$
Compute the integral expression for ##I''(x) = 0##. This should result in an expression that contains the sought integral with all other integrals being solvable. The result is indeed ##x^2 + 2t##.

Always awes me when someone in PF knows a problem by heart. Thanks! I will impress the TA's with "my" newly acquired knowledge.

Delta2
Always awes me when someone in PF knows a problem by heart.
Oh, the integral was not by heart ... but Feynman's trick is often very very useful for stuff like this.
I have just seen integral kernel solutions to the heat equation a number of times after teaching it in various forms over a decade and writing a textbook on the subject.

Oh, I missed the updated integral. Yes, it is essentially the solution of the 1D heat equation with initial distribution ##x^2##. It can be relatively easily computed with Feynman's trick, i.e., start by writing down the integral
$$I(x) = \frac{1}{\sqrt{4\pi t}}\int_{\mathbb R} e^{-\frac{(x-y)^2}{4t}} dy = 1.$$
Compute the integral expression for ##I''(x) = 0##. This should result in an expression that contains the sought integral with all other integrals being solvable. The result is indeed ##x^2 + 2t##.
not to test your knowledge, but hoping to benefit from it... i'll shamelessly burden you with questions.

how does one know you can derive

$$\frac{1}{\sqrt{4\pi t}}\int_{\mathbb R} e^{-\frac{(x-y)^2}{4t}}y^2 dy$$

by differentiating a seemingly random, but similar equation

$$I(x) = \frac{1}{\sqrt{4\pi t}}\int_{\mathbb R} e^{-\frac{(x-y)^2}{4t}} dy = 1.$$

w.r.t the variable ##y##?

why does ##I(x)## have to be set to zero, equal to 1 and what is an "integral kernal solution?"

First, note that the differentiation is with respect to ##x##. The variable ##y## is only a dummy variable and cannot be differentiated with respect to.

I am not setting the integral to one, it is a gaussian standard integral that is equal to one (it can be computed similarly to how you described at first - by squaring the integral and changing to polar coordinates).

How I see that Feynman’s trick might work in some form: The integrand has only the exponential factor that depends on ##x## so differentiating it twice is going to spit out the inner derivative ##(x-y)/2t## twice (plus one term where the inner derivative is differentiated). The square of ##x-y## contains ##y^2## and the expression for ##I''(x)## will therefore contain the sought integral.

Last edited:
etotheipi, Charles Link, Delta2 and 1 other person
@Orodruin mentioned it previously above, and if I'm not mistaken, this gaussian integral is a convolution function for linear response of the way the heat redistributes itself in one dimension, where the ##y^2 ## following the gaussian can be any initial distribution. When that ## y ^2 ## is set instead to unity, (uniform distribution), the heat doesn't redistribute itself but stays at ## I(x,t)=1 ## everywhere for all time ## t ##.

This method for the heat problem was new to me until @Orodruin mentioned it yesterday, after which I googled the topic to read a little more about it.

docnet