# Finding the characteristic function of a simple linear PDF

X is a random variable with a pdf of $$f(x) = \begin{cases} x/2, & 0 \le x \le 2 \\ 0, & \text{otherwise} \end{cases}$$

I tried finding the characteristic function of this but ended up with an expression where $$\phi(0)\neq 1$$ and I cant pinpoint why as I've followed the process exactly (Edited to implement gunes comment - still seem to have the same problem though):

$$\phi(t) = E[e^{itX}]$$

$$\qquad= \int_0^2 e^{itx}\cdot\frac{1}{2}x \quad dx$$

Integrate by parts: $$u = x, \quad u'=1,\quad v'=e^{itx},\quad v=\frac{e^{itx}}{it}$$

$$\phi(t)= \frac{1}{2} \Big( \Big[\frac{x}{it}e^{itx}\Big]_0^2 \quad -\quad \int_0^2 \frac{1}{it}e^{itx}dx \Big)$$

$$\qquad= \frac{1}{2} \Big( \frac{2}{it}e^{2it} \quad -\quad \Big[\frac{1}{(it)^2}e^{itx}\Big]_0^2 \quad \Big)$$

$$\qquad= \frac{1}{2} \Big( \frac{2}{it}e^{2it} \quad -\quad \Big(\frac{1}{(it)^2}e^{2it} - \frac{1}{(it)^2}\Big) \Big)$$

$$\qquad= \frac{1}{2} \Big( \frac{it\cdot2e^{2it}-e^{2it}+1}{(it)^2} \Big)$$

Edit2: Applying L'Hopital's Rule to verify $$\, \phi(0) = 1$$:

$$\lim\limits_{t \to 0} \frac{e^{2it}-2ite^{2it}-1}{2t^2} \quad=\quad \lim\limits_{t \to 0} \frac{2ie^{2it}-2ie^{2it}+4te^{2it}}{4t} \quad=\quad \lim\limits_{t \to 0}e^{2it} = 1$$

Thanks for the help =)

• Besides the error mentioned in the comments, your derivation assumes $t \neq 0$. That is why you get contradicting results. If you assume $t = 0$ it is pretty easy and $\phi(0) = \mathbb E[\exp(0)] = \mathbb E[1] = 1$. May 10, 2019 at 10:54
• Yep, I mainly use the $\phi(0)=1$ result as a check that my expansion is correct. As you pointed out it holds if you substitute it straight in but expanding the characteristic function will allow me to find $E[X]$ and $Var[X]$ next which is why I want to see why it no longer holds in the end May 10, 2019 at 13:04
• I think you got my point wrong. You did everything (besides the error correct). This, in fact, is a characteristic function and it is the characteristic function for your density. More clearly, the characteristic function for this density is defined as $$\phi(t) = \begin{cases} \frac{\exp(2it) - 2it\exp(2it) - 1}{2t^2} & \text{if t\neq 0 and} \\ 1 & \text{if t = 0} \end{cases}$$ May 10, 2019 at 13:56
• Although your expression for $\phi$ may be undefined, its value is not. You may obtain it either directly, by re-evaluating the integral with $t$ explicitly set to $0,$ or by applying L'Hopital's Rule.
– whuber
May 10, 2019 at 14:38

You should have calculated the integral: $$\phi(t)=E[e^{itX}]=\int_0^2 e^{itx}\frac{x}{2} dx$$
But, instead in the second line you assert that $$E[e^{itX}]=E[e^{itx/2}]$$, which is wrong, because in general: $$E[e^{itX}]\neq E[e^{itf(x)}]$$
Edit: Based on your correction, your final characteristic function seems OK. We just need to evaluate the limit when $$t\rightarrow 0$$, which can be done via L'Hopital Rule.
• @Maharero Looks like just a simple mix-up... second integral should be $v \hspace{1mm} u'$ May 10, 2019 at 13:26