# Hard integral

## Homework Statement

$$\int_{0}^{\pi/4} \exp \left(-\frac{1}{\cos^2x}\right)\mbox{d}x$$

## The Attempt at a Solution

Can someone give me a hint? I don't see a smart substitution nor a path via integration by parts...

Related Calculus and Beyond Homework Help News on Phys.org
Dick
Homework Helper
The value of the integral, whatever it is, is not going to have a simple form: The "[URL [Broken] value[/URL] is not recognized by http://bootes.math.uqam.ca/cgi-bin/ipcgi/lookup.pl?Submit=GO+&number=.227651878&lookup_type=browse".

Edit: I think I overestimated the capabilities of Plouffe's inverter, so maybe the solution is simple afterall.
You are right. Plouffe's inverter is not all powerful. It only knows about numbers it's happened to have heard about. But there is a reasonably simple expression. You do need the erf function. Write the integral as exp(-a*sec(x)^2). Find d/da of that. Now THAT function you can integrate dx from 0 to pi/4 (in terms of erf). You can in turn integrate that expression da. And you know the value if a=0. It's not terribly simple, to find the constant of integration you need to figure out things like lim a->0 erf(sqrt(a))/sqrt(a). But it can be done. You might want to put (pi/4)*(1-erf(1)^2) into Plouffe's inverter.

Last edited by a moderator:
Write the integral as exp(-a*sec(x)^2). Find d/da of that.
$$\frac{d}{da}\ \left[ \int_{0}^{\pi/4} \exp \left(-a \cdot \sec^2 (x) \right) \mbox{d}x \right ] = \int_{0}^{\pi/4} - \sec^2(x) \cdot \exp \left(-a \sec^2 x\ \right) \mbox{d}x$$

Now THAT function you can integrate dx from 0 to pi/4 (in terms of erf)..
hmmm...I don't see how because:

$$\operatorname{erf}(x) = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} dt.$$

Dick
Homework Helper
Be creative! You have to be. This whole problem is about trickyness. sec(x)^2=1+tan(x)^2. Now substitute t=sqrt(a)*tan(x). You know there is an answer. I sketched the route. I even gave you a really strong hint what the answer was. Try and figure out one or two of the non-obvious steps without the need for a hint.

Last edited:
$$\frac{dI}{da}=\int_{0}^{\pi/4} - \sec^2(x) \cdot \exp \left(-a \sec^2 x\ \right) \mbox{d}x = ( -e^{-a}) \cdot \int_0^{\pi /4} \sec^2(x) \cdot \exp (-a \tan^2 x )\ \mbox{dx}$$

Now with

$$t =\sqrt{a} \tan(x) \longrightarrow t^2 = a \tan^2(x)$$

and

$$dt = \sqrt{a} \sec^2(x)$$

I get:

$$\frac{dI}{da} = \frac{-e^{-a}}{ \sqrt{ a} } \cdot \int_0^{ \pi /4} e^{-t^2} \mbox{d}t =\frac{-e^{-a}}{ \sqrt{ a} } \cdot \mbox{erf} ( \pi /4)$$

Dick
Homework Helper
Not quite. The argument of the erf is t. t isn't equal to tan(x). Now keep going.

Not quite. The argument of the erf is t. t isn't equal to tan(x). Now keep going.
This isn't the most easy integral I tackled

Ok, so the boundaries are wrong (that's what you meant in your last post, right Dick?)

$$\frac{dI}{da} = \frac{-e^{-a}}{ \sqrt{ a} } \cdot \int_0^{ \sqrt{a}} e^{-t^2} \mbox{d}t =\frac{-e^{-a}}{ \sqrt{ a} } \cdot \mbox{erf} ( \sqrt{a})$$

right?

Dick
Homework Helper
You are getting there. There's also a 2/sqrt(pi) in the erf definition. What happened to that?

You are getting there. There's also a 2/sqrt(pi) in the erf definition. What happened to that?
$$\frac{dI}{da} = \frac{-e^{-a}}{ \sqrt{ a} } \cdot \int_0^{ \sqrt{a}} e^{-t^2} \mbox{d}t = \left( \frac{ \sqrt{ \pi}}{2} \right) \left( \frac{-e^{-a}}{ \sqrt{ a} } \right) \cdot \mbox{erf} ( \sqrt{a})$$

Dick
Homework Helper
Good. Now can you integrate that da? It's creative time. It's not NEARLY as hard as it looks. Think u substitution.

Now with $$u=\sqrt{a}$$

I get:

$$\int \left( \frac{ \sqrt{ \pi}}{2} \right) \left( \frac{-e^{-a}}{ \sqrt{ a} } \right) \cdot \mbox{erf} ( \sqrt{a}) \mbox{d}a =\int (-\sqrt{ \pi}) \cdot e^{-u^2} \cdot \mbox{erf} (u)\ \mbox{d}u = C \cdot \int \int e^{u^2-t^2}\ \mbox{d}t \mbox{d}u$$

This is getting nasty...

Dick
Homework Helper
If u=erf(sqrt(a)), what's du? Or since you've already done that u substitution for sqrt(a), if v=erf(u), what's dv?

If u=erf(sqrt(a)), what's du? Or since you've already done that u substitution for sqrt(a), if v=erf(u), what's dv?
Of course! The derative of erf(v) is e-v2 !

But then

$$\int \left( \frac{ \sqrt{ \pi}}{2} \right) \left( \frac{-e^{-a}}{ \sqrt{ a} } \right) \cdot \mbox{erf} ( \sqrt{a}) \mbox{d}a =\int (-\sqrt{ \pi}) \cdot e^{-u^2} \cdot \mbox{erf} (u)\ \mbox{d}u = C_1 \cdot \mbox{erf} (u) + C_2$$

With the very important integration constant C2, right?

Dick
Homework Helper
Of course! The derative of erf(v) is e-v2 !
Dead right, but don't forget the sqrt(pi) and 2 parts of the erf definition. That's why it's actually an easy integral. But doing the v=erf(u) substitution turns the integral into v*dv, right? What's that? And there's no 'integration constant' C1. You know what C1 is. C2 is important, yes.

Dead right, but don't forget the sqrt(pi) and 2 parts of the erf definition. That's why it's actually an easy integral. But doing the v=erf(u) substitution turns the integral into v*dv, right? What's that?
Right, I'll try again:

$$\int \left( \frac{ \sqrt{ \pi}}{2} \right) \left( \frac{-e^{-a}}{ \sqrt{ a} } \right) \cdot \mbox{erf} ( \sqrt{a}) \mbox{d}a =\int (-\sqrt{ \pi}) \cdot e^{-u^2} \cdot \mbox{erf} (u)\ \mbox{d}u = (\sqrt{ \pi}) \frac{ \sqrt{\pi} }{2} \int v\ \mbox{d}v = \frac{1}{4} \pi v^2 +C_0$$

I previously used C_1 to 'hide' all constants but I didn't specify that, C_0 is here the constant of integration multiplied by some factor. Is this correct, Dick?

Dick
Homework Helper
You forgot the minus sign. So you've got -pi*erf(sqrt(a))^2/4+C. Now how to determine C?

If a = 0 then

$$\int_{0}^{\pi/4} \exp \left(-\frac{a}{ \cos^2x}\right)\mbox{d}x = \frac{ \pi}{4}$$

So I conclude that:

$$\frac{\pi}{4} = \left( \frac{- \sqrt{\pi}}{2} \right) \cdot \lim_{a \rightarrow 0} \int e^{-a} \cdot \frac{ \mbox{erf} (\sqrt{a}) }{\sqrt{a}}\ \mbox{d}a$$

gabbagabbahey
Homework Helper
Gold Member
If a = 0 then

$$\int_{0}^{\pi/4} \exp \left(-\frac{a}{ \cos^2x}\right)\mbox{d}x = \frac{ \pi}{4}$$
Right, but for all $a$ you just showed

$$\int_{0}^{\pi/4} \exp \left(-\frac{a}{ \cos^2x}\right)\mbox{d}x = \frac{1}{4} \pi \mbox{erf}(\sqrt{a})^2 +C_0$$

So I conclude that:

$$\frac{\pi}{4} = \left( \frac{- \sqrt{\pi}}{2} \right) \cdot \lim_{a \rightarrow 0} \int e^{-a} \cdot \frac{ \mbox{erf} (\sqrt{a}) }{\sqrt{a}}\ \mbox{d}a$$
Not a very useful conclusion; try solving for $C_0$ instead.

What is $$\frac{1}{4} \pi \mbox{erf}(\sqrt{a})^2 +C_0$$ for a=0?

So $$C_0 =0$$

Dick
Homework Helper
So $$C_0 =0$$
Not at all. Reread gabbagabbahey's post and pay attention this time. You know what erf(0) is.

$$C_0 = \frac{ \pi}{4}$$

So I conclude that:

$$\int_{0}^{\pi/4} \exp \left(-\frac{1}{ \cos^2x}\right)\mbox{d}x = \frac{ \pi}{4} ( \mbox{-erf(1)^2+1} )$$

Last edited:
Dick