# Find mean and variance using characteristic function

Consider a random variable with characteristic function $$\phi(t)=\frac{3\sin(t)}{t^3}-\frac{3\cos(t)}{t^2}, \ \text{when} \ t \neq0$$

How can I compute the $$E(X)$$ and $$Var(X)$$ by using this characteristic function? I'm stuck because if I differentiate I got $$\phi'(t)=\frac{3t^2\sin(t)+9t\cos(t)-9\sin(t)}{t^4}$$ which is undefined at $$t=0$$.

Do I need to use Taylor expansion to approximate sin and cos ?

By using the theory of Fourier Transforms we can easily determine what the corresponding density is. But here is an elementary calculation relying only on definitions.

The complex exponential is defined by the power series

$$\cos(t) + i\sin(t) = \exp(it) = 1 + \frac{it}{1!} + \frac{(it)^2}{2!} + \cdots + \frac{(it)^n}{n!} + \cdots.$$

Separating the real and imaginary parts, using the defining fact that $$i^2=-1,$$ and dividing by the powers of $$t$$ appearing in the question give

$$\frac{\sin(t)}{t^3} = \frac{t}{1!}\left(t^{-3}\right) - \frac{t^3}{3!}\left(t^{-3}\right) + \frac{t^5}{5!}\left(t^{-3}\right) + \cdots$$

and

$$\frac{\cos(t)}{t^2} = 1\left(t^{-2}\right) - \frac{t^2}{2!}\left(t^{-2}\right) + \frac{t^4}{4!}\left(t^{-2}\right) - \cdots.$$

Taking the requisite linear combination term by term (which is justified because the exponential power series converges absolutely for all complex numbers $$t$$) yields

\begin{aligned} \frac{3\sin(t)}{t^3} - \frac{3\cos(t)}{t^2} &= 3\left[\left(\frac{t^{-2}}{1!} - t^{-2}\right) - \left(\frac{t^{0}}{3!} - \frac{t^0}{2!}\right) + \left(\frac{t^{2}}{5!} - \frac{t^2}{4!}\right) - \cdots \right]\\ &=1 + 2!\left(-\frac{3}{5!} + \frac{3}{4!}\right)\left(\frac{-t^2}{2!}\right) \color{gray}{+ 4!\left(-\frac{3}{6!} + \frac{3}{5!}\right)\left(\frac{t^4}{4!}\right) }- \cdots, \end{aligned}

from which you may read off all the moments directly in the usual fashion. (I did too much work here -- you only need the terms through $$t^2$$ -- in order to show the pattern.)

The key point is that the singularities cancel in the initial term $$t^{-2}/1! - t^{-2} = 0,$$ leaving a function without any poles.

This clearly is a legitimate characteristic function because it is bounded in absolute value by $$1,$$ equals $$1$$ at the origin, and is analytic (which is more than needed to demonstrate something is a c.f.). Moreover, because it is real and even (it involves only powers of $$t^2$$), it must be the c.f. of a symmetric distribution around zero. In particular, the moments appearing in this power series will be the central moments: the expectation is necessarily zero and the coefficient of $$-t^2/2!$$ will be the variance.

In general, if power-series expansion holds for the characteristic function of a random variable $$X$$, which is the case of this $$\varphi(t)$$ (because power-series expansions for $$\sin t$$ and $$\cos t$$ hold and the negative exponent terms cancelled each other, as will be shown in the derivation below), the moments of $$X$$ can be read off from it (for a rigorous proof, see Probability and Measure by Patrick Billingsley, pp. 342 -- 345): \begin{align} \varphi^{(k)}(0) = i^kE[X^k]. \tag{1} \end{align}

$$(1)$$ is analogous to the relationship $$E[X^k] = m^{(k)}(0)$$ between moments and the moment generating function, which is perhaps more familiar to statisticians.

Therefore, to determine $$E[X]$$ and $$\operatorname{Var}(X)$$, it is sufficient to evaluate $$\varphi'(0)$$ and $$\varphi''(0)$$, to which you can apply L'Hopital's rule for multiple times (which is more verbose). First, because $$\sin t - t\cos t \to 0$$ as $$t \to 0$$, \begin{align} \lim_{t \to 0}\varphi(t) = 3\lim_{t \to 0}\frac{\sin t - t\cos t}{t^3} = 3\lim_{t \to 0}\frac{\cos t - (\cos t - t\sin t)}{3t^2} = \lim_{t \to 0} \frac{\sin t}{t} = 1, \end{align} which lends us the legitimacy of using L'Hopital rule for evaluating \begin{align} \varphi'(0) &= \lim_{t \to 0}\frac{\varphi(t) - \varphi(0)}{t} \\ &= \lim_{t \to 0} \varphi'(t) \\ &= 3\lim_{t \to 0}\frac{t^4\sin t - 3t^2(\sin t - t\cos t)}{t^6} \\ &= 3\lim_{t \to 0}\frac{t^2\sin t - 3\sin t + 3t\cos t}{t^4} \\ &= 3\lim_{t \to 0}\frac{2t\sin t + t^2\cos t - 3\cos t + 3\cos t - 3t\sin t}{4t^3} \\ &= \frac{3}{4}\lim_{t \to 0}\frac{t\cos t - \sin t}{t^2} \\ &= \frac{3}{4}\lim_{t \to 0}\frac{\cos t - t\sin t - \cos t}{2t} = 0. \end{align} I will leave the task of getting $$\varphi''(0)$$ in this way back to you.

Alternatively, a direct power-series expansion method (which I highly recommend as the first option for general limit evaluation tasks) has been mentioned in whuber's answer and my previous comments. In detail, it follows by (see, for example, Eq. (23) and Eq. (6) in this link) \begin{align} & \sin t = t - \frac{1}{3!}t^3 + \frac{1}{5!}t^5 + O(t^7), \\ & \cos t = 1 - \frac{1}{2}t^2 + \frac{1}{4!}t^4 + O(t^6) \end{align} that \begin{align} & \varphi(t) = 3t^{-3}\sin t - 3t^{-2}\cos t \\ =& 3t^{-3}\left(t - \frac{1}{3!}t^3 + \frac{1}{5!}t^5 + O(t^7)\right) - 3t^{-2}\left(1 - \frac{1}{2}t^2 + \frac{1}{4!}t^4 + O(t^6)\right) \\ =& 1 + \frac{1}{40}t^2 - \frac{1}{8}t^2 + O(t^4) \\ =& 1 - \frac{1}{10}t^2 + O(t^4). \end{align} From which it is immediate to conclude \begin{align} \varphi(0) = 1, \; \varphi'(0) = 0, \; \varphi''(0) = -\frac{1}{5}. \end{align} It then follows by $$(1)$$ that \begin{align} E[X] = -i\varphi'(0) = 0, \; E[X^2] = -\varphi''(0) = \frac{1}{5}. \end{align} Therefore, $$E[X] = 0, \operatorname{Var}(X) = \frac{1}{5}$$.