Straightforward integration…

  • Context: High School 
  • Thread starter Thread starter Guineafowl
  • Start date Start date
Guineafowl
Messages
891
Reaction score
413
TL;DR
…keeps coming out wrong, despite each step being seemingly right, as checked on an online integral calculator. It may simply be a silly mistake with algebra. Self study.
Solving the integral for a wave function:
$$1 = |C|^2 \int_0^\infty \frac{x^2}{a^2} e^{-2x/a} dx$$

Shunting out the ##\frac{1}{a^2}## term, I went for integration by parts, a couple of times, first one being:##u=x^2, \frac {du}{dx}=2x, \frac {dv}{dx}=e^{-2x/a}, v=\frac {-ae^{-2x/a}}{2}##

Now, I come up with:
$$\frac {-ax^2e^{-2x/a}}{2} - \frac {2a^2 xe^{-2x/a}+a^3e^{-2x/a}}{4}$$

Multiplying through by the ##\frac{1}{a^2}## term, and simplifying (ignoring the ##|C|^2## term and definite integral for now):
$$\frac {-(2x^2-2ax+a^2)e^{-2x/a}}{4a}$$

The right answer has a ##+2ax## instead of the ##-2ax## and I can’t find where it’s coming from, despite checking each integration step individually on the integral calculator. If someone could point out my idiocy, I’d be grateful.

Also, some guidance on evaluating the integral between 0 and ##\infty##, which I’m not familiar with, would be appreciated.
 
Last edited:
Physics news on Phys.org
Guineafowl said:
TL;DR: …keeps coming out wrong, despite each step being seemingly right, as checked on an online integral calculator. It may simply be a silly mistake with algebra. Self study.

Solving the integral for a wave function:
$$1 = |C|^2 \int_0^\infty \frac{x^2}{a^2} e^{-2x/a} dx$$

Shunting out the ##\frac{1}{a^2}## term, I went for integration by parts, a couple of times, first one being:##u=x^2, \frac {du}{dx}=2x, \frac {dv}{dx}=e^{-2x/a}, v=\frac {-ae^{-2x/a}}{2}##

Now, I come up with:
$$\frac {-ax^2e^{-2x/a}}{2} - \frac {2a^2 xe^{-2x/a}+a^3e^{-2x/a}}{4}$$

Multiplying through by the ##\frac{1}{a^2}## term, and simplifying (ignoring the ##|C|^2## term and definite integral for now):
$$\frac {-(2x^2-2ax+a^2)e^{-2x/a}}{4a}$$

The right answer has a ##+2ax## instead of the ##-2ax## and I can’t find where it’s coming from, despite checking each integration step individually on the integral calculator. If someone could point out my idiocy, I’d be grateful.

Also, some guidance on evaluating the integral between 0 and ##\infty##, which I’m not familiar with, would be appreciated.
I'm struggling to see what you are doing with integration by parts. I applied parts twice, with the initial tern vanishing at both end points in both cases, and the remaining integrands being:
$$\frac x a e^{-\frac{2x}{a}}$$And$$\frac 1 2 e^{-\frac{2x}{a}}$$
 
Ok, how about simplifying to:
$$\int x^2e^{-2x/a}dx$$

Using the integration by parts as above, ie ##u=x^2, \frac {du}{dx}=2x, \frac {dv}{dx}=e^{-2x/a}, v=\frac {-ae^{-2x/a}}{2}##
The IBP formula ##uv-\int v\frac{du}{dx}dx## gives me:
$$\frac {-ax^2e^{-2x/a}}{2} - \int -ae^{-2x/a} x dx$$

Call this {equation 1}.

I can’t use the preview, so let’s see what you think of that, maybe?
 
Last edited:
Tackling:
$$\int -ae^{-2x/a} x dx$$
$$-a \int xe^{-2x/a}dx$$

IBP again: ##u=x, \frac {du}{dx}=1, \frac {dv}{dx}=e^{-2x/a}, v=\frac {-ae^{-2x/a}}{2}##

$$-a[\frac{-axe^{-2x/a}}{2}-(\frac {-a}{2}\frac{-ae^{-2x/a}}{2})]$$

$$ \frac{2a^2xe^{-2x/a} + a^3e^{-2x/a}{4} $$
 
Guineafowl said:
Ok, how about simplifying to:
$$\int x^2e^{-2x/a}dx$$

Using the integration by parts as above, ie ##u=x^2, \frac {du}{dx}=2x, \frac {dv}{dx}=e^{-2x/a}, v=\frac {-ae^{-2x/a}}{2}##
The IBP formula ##uv-\int v\frac{du}{dx}dx## gives me:
$$\frac {-ax^2e^{-2x/a}}{2} - \int -ae^{-2x/a} x dx$$

I can’t use the preview, so let’s see what you think of that, maybe?
I'm not sure why you are calculating an indefinite integral. The first rule of mathematical physics is that the first term in a parts expansion always vanishes!
 
  • Like
Likes   Reactions: Guineafowl
PeroK said:
I'm not sure why you are calculating an indefinite integral. The first rule of mathematical physics is that the first term in a parts expansion always vanishes!
Beyond my pay grade, I think ;)
 
Combining the result in post #4, which for some reason isn’t displaying, with Equation 1 of post #3:

$$\frac{-ax^2 e^{-2x/a}}{2} - \frac {2a^2xe^{-2x/a} + a^3e^{-2x/a}}{4}$$

Which gives the extra minus sign that’s causing all the trouble.
 
Guineafowl said:
Combining the result in post #4, which for some reason isn’t displaying, with Equation 1 of post #3:

$$\frac{-ax^2 e^{-2x/a}}{2} - \frac {2a^2xe^{-2x/a} + a^3e^{-2x/a}}{4}$$

Which gives the extra minus sign that’s causing all the trouble.
Why do you think that's wrong?
 
PeroK said:
Why do you think that's wrong?
The integral-calculator.com has it like this:
$$-\frac{\left(2x^{2} + 2ax + a^{2}\right) \mathrm{e}^{-\frac{2x}{a}}}{4a}$$

Versus my answer:
$$-\frac {(2x^2-2ax+a^2)e^{-2x/a}}{4a}$$

And when asked to do the definite integral, it’s correct: ##|C|^2\frac {a}{4}=1## according to the notes, (J Cresser, Quantum Physics Notes).
 
  • #10
Guineafowl said:
The integral-calculator.com has it like this:
$$-\frac{\left(2x^{2} + 2ax + a^{2}\right) \mathrm{e}^{-\frac{2x}{a}}}{4a}$$

Versus my answer:
$$-\frac {(2x^2-2ax+a^2)e^{-2x/a}}{4a}$$
What you posted in post #7 is consistent with the integral calculator answer. It looks like you got a minus sign confused in the final step.
 
  • Like
Likes   Reactions: Guineafowl
  • #11
PeroK said:
What you posted in post #7 is consistent with the integral calculator answer. It looks like you got a minus sign confused in the final step.
Strewth, are we back to basics again? You may remember me from such threads as:

Or, could have blanked from your mind the experience of dragging a biologist through simple algebra and calculus. I’ll have another look later; cheers for now.
 
  • #12
Guineafowl said:
Combining the result in post #4, which for some reason isn’t displaying, with Equation 1 of post #3:

$$\frac{-ax^2 e^{-2x/a}}{2} - \frac {2a^2xe^{-2x/a} + a^3e^{-2x/a}}{4}$$

Which gives the extra minus sign that’s causing all the trouble.
All three terms have minus signs there, when you expand it out.
 
  • Like
Likes   Reactions: Guineafowl
  • #13
Using the bounds on the definite integral is important in these cases, as it simplifies things considerably. For example, you could try to show (as an advanced exercise?!) that:
$$\int_0^\infty x^n e^{-\lambda x} dx = \frac{n!}{\lambda^{n+1}} \ \ (\lambda > 0)$$Where ##n## is a positive integer.

I would tend to keep that in a list of useful standard definite integrals.

In this case, ##n = 2## and ##\lambda = \frac 2 a##, hence:
$$\int_0^\infty x^2 e^{-2x/a} dx = \frac{a^3}{4}$$
 
  • #14
PeroK said:
All three terms have minus signs there, when you expand it out.
I see. I assumed the wrong sign must have crept in during the difficult integration bit, not the easy final bit.

Putting my water wings back on for the top line, quoted in post #12:

$$-(2ax^2e^{-2x/a})-(2a^2xe^{-2x/a}+a^3e^{-2x/a})$$
$$-2ax^2e^{-2x/a}-2a^2xe^{-2x/a}-a^3e^{-2x/a}$$
$$-(2ax^2+2a^2x+a^3)e^{-2x/a}$$

I’ll have a think about your question ^. You are an optimist.
 
  • Like
Likes   Reactions: PeroK
  • #15
Right, I tried to knock your question into bits, and accidentally found something called the Gamma function.

First, the origin of the ##\lambda ^{n+1}## term. How did it get underneath, and why n+1?

If I substitute ##u=\lambda x, x=\frac{u}{\lambda}, dx=\frac {du}{\lambda}##, I get:
$$\int_0^\infty (\frac {u}{\lambda})^n e^{-u}\frac{du}{\lambda}$$

So I can see, for every power of ##n## there is an inverse power of ##\lambda##, plus an extra from the ##\frac{du}{\lambda}##.
 
  • #16
Stripping away the ##\lambda##, researching examples of the type:
$$\int_0^\infty u^n e^{-u} du$$

I found that this is the gamma function for n+1: ##\Gamma (n+1)=n!##

Obviously, if ##\lambda <0## in the original equation then we will no longer have ##e^{-\lambda u}## but ##e^{+\lambda u}## and so will lose that property.

Seems a bit of a cheat, but I didn’t realise I was going to find it. The might of my GCSE maths was no match for stumbling upon things on the internet.
 
  • Like
Likes   Reactions: PeroK
  • #17
Guineafowl said:
Stripping away the ##\lambda##, researching examples of the type:
$$\int_0^\infty u^n e^{-u} du$$

I found that this is the gamma function for n+1: ##\Gamma (n+1)=n!##

Obviously, if ##\lambda <0## in the original equation then we will no longer have ##e^{-\lambda u}## but ##e^{+\lambda u}## and so will lose that property.

Seems a bit of a cheat, but I didn’t realise I was going to find it. The might of my GCSE maths was no match for stumbling upon things on the internet.
The equation I posted can be shown by induction on ##n##. What you stumbled on is an interesting idea for how to generalise the factorial beyond positive integers. Namely, the gamma function. First, we note that for positive integers ##n## we have:
$$n! = \int_0^\infty u^n e^{-u} du$$Then, we notice that the integral can be evaluated for other values of ##n##. And, this can become a generalisation of the factorial.

That, however, is a side issue. The main point is that it's generally a step in the wrong direction to drop the bounds for a definite integrals, in cases like this, and attempt the indefinite integral. Instead, keeping the bounds can simplify things. In fact, in many cases, there is no closed form antiderivative.
 
  • #18
PeroK said:
The main point is that it's generally a step in the wrong direction to drop the bounds for a definite integrals, in cases like this, and attempt the indefinite integral.
Now, at my stage, the way I know to solve a definite integral is do exactly this. In the real world, are you saying this isn’t always possible? If so, how is it done without dropping the bounds?
 
  • #19
Guineafowl said:
Now, at my stage, the way I know to solve a definite integral is do exactly this. In the real world, are you saying this isn’t always possible? If so, how is it done without dropping the bounds?
Integration by parts is valid for a definite integral. That allows you in this case to simplify the integral to a known standard form. Also, my style is to use parameters extensively, as I find I make fewer algebraic errors that way. In this case, I would take ##\lambda = \frac 2 a## and proceed as follows:
$$\int_0^\infty x^2 e^{-\lambda x} dx = \bigg [x^2(-\frac 1 \lambda)e^{-\lambda x} \bigg ]_0^\infty - \int_0^\infty 2x (-\frac 1 \lambda) e^{-\lambda x} dx$$$$= \frac 2 \lambda \int_0^\infty x e^{-\lambda x} dx$$$$= \frac 2 \lambda \bigg [x(-\frac 1 \lambda)e^{-\lambda x} \bigg ]_0^\infty - \frac 2 \lambda \int_0^\infty (-\frac 1 \lambda) e^{-\lambda x} dx$$$$=\frac 2 {\lambda^2} \int_0^\infty e^{-\lambda x} dx$$$$= \frac 2 {\lambda^2} \bigg [(-\frac 1 \lambda)e^{-\lambda x} \bigg ]_0^\infty$$$$=\frac 2 {\lambda^3}$$Note: I used parts twice, and in both cases the initial term vanished at both endpoints. And I used the same standard integral for an exponential throughout.

Not only can you finish this particular problem, but you also have a useful standard integral for any ##\lambda## that you should keep a note of.

Also, as I mentioned earlier, I would have spotted the inductive pattern and done that more general integral for ##x^n##, and kept a note of that as well.

This is how I build my repertoire of mathematical techniques.

PS I also like to declutter by taking out the ##\frac{|C|^2}{a^2}## while I calculate the critical part of the integral.
 
  • Like
Likes   Reactions: Guineafowl
  • #20
PeroK said:
Integration by parts is valid for a definite integral. That allows you in this case to simplify the integral to a known standard form. Also, my style is to use parameters extensively, as I find I make fewer algebraic errors that way. In this case, I would take ##\lambda = \frac 2 a## and proceed as follows:
$$\int_0^\infty x^2 e^{-\lambda x} dx = \bigg [x^2(-\frac 1 \lambda)e^{-\lambda x} \bigg ]_0^\infty - \int_0^\infty 2x (-\frac 1 \lambda) e^{-\lambda x} dx$$$$= \frac 2 \lambda \int_0^\infty x e^{-\lambda x} dx$$$$= \frac 2 \lambda \bigg [x(-\frac 1 \lambda)e^{-\lambda x} \bigg ]_0^\infty - \frac 2 \lambda \int_0^\infty (-\frac 1 \lambda) e^{-\lambda x} dx$$$$=\frac 2 {\lambda^2} \int_0^\infty e^{-\lambda x} dx$$$$= \frac 2 {\lambda^2} \bigg [(-\frac 1 \lambda)e^{-\lambda x} \bigg ]_0^\infty$$$$=\frac 2 {\lambda^3}$$Note: I used parts twice, and in both cases the initial term vanished at both endpoints. And I used the same standard integral for an exponential throughout.

Not only can you finish this particular problem, but you also have a useful standard integral for any ##\lambda## that you should keep a note of.

Also, as I mentioned earlier, I would have spotted the inductive pattern and done that more general integral for ##x^n##, and kept a note of that as well.

This is how I build my repertoire of mathematical techniques.

PS I also like to declutter by taking out the ##\frac{|C|^2}{a^2}## while I calculate the critical part of the integral.
I thought the comment about initial terms vanishing was a maths/physics in joke, but there it is made real.

Your method is a lot quicker and simpler than mine, which in turn was simpler than the integral calculator, which used u-sub in a very long-winded fashion.

If you’d been my maths teacher, I would have probably continued the subject further in life. Sadly, mine was afflicted with the curse of knowledge, and would trot out his knowledge rather than teach. Thankfully, my physics teacher was excellent and responsible for my continued interest. A quote: “physics is the best subject. What could be more interesting than learning how the universe works?!”
 
  • Like
Likes   Reactions: PeroK
  • #21
Another thing - I didn’t know you could evaluate the ##uv## part of IBP between the limits, as you have done in the square brackets. I haven’t seen that in any guide to integration, internet or book-based.
 
  • #22
Guineafowl said:
Another thing - I didn’t know you could evaluate the ##uv## part of IBP between the limits, as you have done in the square brackets. I haven’t seen that in any guide to integration, internet or book-based.
Parts is really the inverse product rule. Start with the product rule for differentiation:
$$\frac{d}{dx}\big (f(x)g(x)\big ) = f'(x)g(x) + f(x)g'(x)$$Then integrate this equationbetween any two limits:
$$\int_a^b \frac{d}{dx}\big (f(x)g(x)\big ) dx = \int_a^b f'(x)g(x) dx + \int_a^b f(x)g'(x) dx$$ Then apply the fundamental theorem to the left-hand side:
$$\big [f(x)g(x) \big ]_a^b = \int_a^b f'(x)g(x) dx + \int_a^b f(x)g'(x) dx$$And finally, move one of the integrals to the other side:
$$\int_a^b f(x)g'(x) dx = \big [f(x)g(x) \big ]_a^b - \int_a^b f'(x)g(x) dx$$There is an equivalent formulation involving indefinite integrals:
$$\int f(x)g'(x) dx = f(x)g(x) - \int f'(x)g(x) dx$$
 
  • Like
Likes   Reactions: Guineafowl
  • #23
PS I don't understand why parts isn't taught this way. I never really got the point of that weird "uv" thing!
 
  • #24
PeroK said:
PS I don't understand why parts isn't taught this way. I never really got the point of that weird "uv" thing!
Thanks, that all makes sense. All I will say for the ##uv## version is, it’s briefer, and for the integral bits, there’s a pleasing symmetry to:

$$\int u\frac{dv}{dx}…\int v\frac{du}{dx}$$

All those ##(x)## bits look a bit messy to me:smile:
 
  • #25
PeroK said:
$$\int f(x)g'(x) dx = f(x)g(x) - \int f'(x)g(x) dx$$

PeroK said:
PS I don't understand why parts isn't taught this way. I never really got the point of that weird "uv" thing!
It's just the replacement of f(x) by u (i.e., u(x)) and of g(x) by v (i.e., v(x)).
Then g'(x)dx = dg(x) = dv and f'(x)dx = df(x) = du. The integral in the first quote is nothing more than ##\int u~dv = uv - \int dv ~u##, with the latter integral usually written as ##\int u~dv##.
 
  • Like
Likes   Reactions: weirdoguy
  • #26
Mark44 said:
It's just the replacement of f(x) by u (i.e., u(x)) and of g(x) by v (i.e., v(x)).
Then g'(x)dx = dg(x) = dv and f'(x)dx = df(x) = du. The integral in the first quote is nothing more than ##\int u~dv = uv - \int dv ~u##, with the latter integral usually written as ##\int u~dv##.
What you've written isn't right at all. I understand what you are trying to do. I just don't see the point of making it look like a new magic formula that bears little relation to the product rule. The ##u## and ##v## substitutions look unnecessary to me. In a specific problem like this, we have integrable and differentiable functions of ##x## - why introduce two unnecessary variables and muddy the waters?
 
  • #27
I’ve also seen it written:
$$\int fg’ \,dx = fg - \int f’g \,dx$$

Maybe you could preface with ‘f and g are functions of x’ and save all the (x)s.
 
  • Like
Likes   Reactions: PeroK

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K