# Plot the density function of a normal random variable knowing only the characteristic function in R

The characteristic function of a normal random variable with mean $\mu$ and standard deviation $\sigma$ is:

\begin{alignat*}{1} \hat{\phi}(t) & =e^{i\mu t}e^{-\frac{1}{2}\sigma^{2}t^{2}}\\ & =\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2}) \end{alignat*}

What I want to do is to plot the PDF of the normal random variable knowing only the characteristic function outlined above $\hat\phi(t)$. Ideally the solution to this problem would be to apply the Inverse Fourier Transform on $\hat\phi(t)$ and then plot the result for different values of $x$. Applying the Inverse Transform leads me to solve this integral to get the PDF of $x$:

\begin{alignat*}{1} f(x) & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt\\ & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2})\exp(- itx)dt\\ & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2}- itx)dt \end{alignat*}

The problem is that I do not know how to do it in R. I could use the integrate() function, but how do I treat the imaginary unit $i$?

• Can't you just read off the coefficients of $t$ and $t^2$ in the characteristic function in order to deduce the values of $\mu$ and $\sigma^2$? May 28, 2016 at 13:30

Just read off the coefficients of $t$ and $t^2$ in the characteristic function in order to deduce the values of $\mu$ and $\sigma^2$. If the characteristic function is not (or cannot be put) in the form $exp(a i t - b t^2)$, where $a$ is a real number and $b$ is a non-negative real number, then it is not the characteristic function of a Normal random variable. If it is of that form, then $\mu = a$ and $\sigma^2 = 2 b$. Now plot a Normal density with those parameters to your heart's content.
Your formula for the probability density function is incorrect. it should be \begin{alignat*}{1} f(x) & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt\\\end{alignat*}which lo and behold, comes out correct.
• Thank you for you answer Mark. Sorry for the error in the formula, I have updated the question. What do you mean with "read off the coefficients of $t$ and $t^2$ in the characteristic function"? Unfortunately I have been introduced to concepts like the Fourier Transform and the characteristic function without having the proper theoretical background to understand them (it's a long story...), and now I'm asked to do things which, apparently, I cannot do. May 28, 2016 at 20:04
• @MarkL.Stone Yes, I have the explicit characteristic function of the normal distribution, which is the following: $$\hat{\phi}(t) = \exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2})$$ And I need to plot the density function using the inverse Fourier transform: $$f(x) =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt$$ May 28, 2016 at 21:14