# Closed-form solution for $\int_{0}^{\pi/4} e^{-(n^2\sec^2x)/2}\,dx$

Is there a closed form solution for the following integral

$$\int_{0}^{\pi/4} e^{-(n^2\sec^2x)/2}\,dx$$ for $$n>0$$ ?

• Why do you think that there should be one? – mrtaurho May 12 at 19:37

It's not that hard. We have the error function: $$\int e^{-x^2/2}dx=\sqrt{\frac{\pi}{2}}\operatorname{erf}\left(\frac{x}{\sqrt 2}\right)+C$$
Differentiate under the integral sign after putting $$\tan x=t$$
$$f(n)=\int_{0}^{\pi/4} \exp\left({-\frac{n^2\sec^2x}{2}}\right)dx=\int_0^1 \frac{\exp\left({-\frac{n^2(t^2+1)}{2}}\right)}{t^2+1}dt$$
$$f'(n)=-n \int_0^1 \exp\left({-\frac{n^2(t^2+1)}{2}}\right)dt=-\sqrt{\frac{\pi}{2}}e^{-n^2/2}\operatorname{erf}\left(\frac{n}{\sqrt 2}\right)$$ Now integrate back using $$f(0)=\frac{\pi}{4}$$ $$f(n)=\frac{\pi}{4}-\sqrt{\frac{\pi}{2}}\int_0^ne^{-x^2/2}\operatorname{erf}\left(\frac{x}{\sqrt 2}\right)dx=\frac{\pi}{4}\left(1-{\operatorname{erf}}^2\left(\frac{n}{\sqrt 2}\right)\right)$$