I am not sure whether my question counts as homework and exercises or not, because I already know the answer. The problem is, I find Zettili answer rather unsatisfactory.
Problem 1.11 (a) Find the Fourier transform for $\phi(k)=A(a-|k|),~~|k|\leq a~$ where $a$ is a positive parameter and $A$ is a normalization factor to be found. (b) Calculate the uncertainties $\Delta x$ and $\Delta p$ and check whether they satisfy the uncertainty principle.
There are many ways to calculate $\Delta x$ from wave function. One can find it from $\phi(k)$ or $\psi(x)$ (wave function in position space) etc. The easiest way in my opinion is obtaining it from $\phi(k)$. Note that $\psi (x)=\frac{4}{x^2}\sin^2\left(\frac{ax}{2}\right)$ according to Zettili. So in momentum space we have: $$\hat{x}=i\frac{d}{dk}~~~\text{and}~~~~\hat{x}^2=-\frac{d^2}{dk^2}$$ $$\langle x\rangle=\int_{-a}^{a}\phi(k)\hat{x} \phi(k)dk=i\left(\int_{-a}^{0}A^2(a+k)dk-\int_{0}^{a}A^2(a-k)dk\right)=0$$ $$\langle x^2\rangle=\int_{-a}^{a}\phi(k)\hat{x}^2 \phi(k)dk=0$$ $$\rightarrow \Delta x=\sqrt{\langle x^2\rangle-\langle x\rangle^2}=0,$$ which obviously violates uncertainty principle. I asked about this my university professor, he said due to the discontinuity of wave function you should change $\hat{x}$ such that: $$\hat{x}=-i\frac{d}{dk}, ~ -a\leq x <0 $$ $$\hat{x}=i\frac{d}{dk}, ~~~~~~ 0\leq x <a $$ But it gives me a complex number for average of position! It does not make any sense. Besides it is possible to show to that average of position in position space is also zero
$$\langle x\rangle=\int_{-\infty}^{\infty}\psi(x)\hat{x} \psi(x)dx=0.$$
All wave functions are real, so I didn't use complex conjugate anywhere.
This is Zettili answer:
Now, let us find the width $\Delta x$ of $\psi(x)$ Since $\sin(a\pi/2a)=1$, $\psi (\pi/a)=4/\pi^2$ and $\psi(0)=a^2$ we can obtain $\psi (\pi/a)=4/\pi^2\psi (0)$ or $\frac{\psi (\pi/a)}{\psi(0)}=\frac{4}{\pi^2}$ This suggests that $\Delta x= \pi/a.$
Where did I go wrong?