# What is the Fourier transform of an M like function

Given the function $$f(x)= \begin{cases} \vert x \vert& \text{, for }\;\vert x\vert\le M \\ 0 & \text{, otherwise} \end{cases}$$ for some constant $M$.

What would be the form for the continuous Fourier transform of this function, i.e. $$\hat{f}(k)=\int_{-\infty}^{\infty}f(x)\;e^{2\pi i x k}\;dx=?$$

Edit:

I used Wolfram Alpha with the query

fourier transform Piecewise[{{abs(x),-M<x<M},{0,x>=M},{0,x<=-M}}]


and got the answer is $$\mathcal{F}_{x}[f(x)](\omega)=\frac{\left(\theta(-M)-1\right)e^{-iM\omega}\left(-1+e^{iM\omega}\right)\left(iM\omega+e^{iM\omega}\left(-1+iM\omega\right)+1\right)}{\sqrt{2\pi}\omega^{2}}$$ Which after some algebra turns out to be $$\mathcal{F}_{x}[f(x)](\omega)=\sqrt{\frac{2}{\pi}}\left(\frac{\cos M\omega+M\omega\sin M\omega-1}{\omega^{2}}\right)$$

Using the hint I got here (which I actually already knew), and the fact that $$\int x\cos nx\: dx = \frac{x\sin nx}{n}+\frac{\cos nx}{n^{2}}+C$$ (easily proven using integration by parts and simple change of variables), I get another thing: \begin{align} \hat{f}(k) &= -\underbrace{\int_{-M}^0 dx \, x \, e^{i 2 \pi k x}}_{x\mapsto -x} + \int_0^M dx \, x \, e^{i 2 \pi k x}\\ &= \int_0^M dx \,x\, \left ( e^{i 2 \pi k x}+ e^{-i 2 \pi k x} \right ) \\ &= 2 \int_0^M dx \,x \, \cos{2 \pi k x} \\ &= 2 \left(\left[\frac{x\sin\left(2\pi kx\right)}{2\pi k}\right]_{0}^{M}+\left[\frac{\cos\left(2\pi kx\right)}{\left(2\pi k\right)^{2}}\right]_{0}^{M}\right)\\ &= 2\left(\frac{M\sin\left(M2\pi k\right)}{2\pi k}+\frac{\cos\left(M2\pi k\right)}{\left(2\pi k\right)^{2}}-\frac{1}{\left(2\pi k\right)^{2}}\right) \end{align}

Did I miss something? Am I doing something wrong? Is Wolfram Alpha wrong?

Edit: If we use the convention $$\hat{f}\left(\omega\right)=\frac{1}{\left(2\pi\right)^{n/2}}\int_{\mathbb{R}^{n}}f\left(x\right)e^{-i\omega x}\, dx$$ then we get the same result as Wolfram Alpha.

• Have you tried plugging that form into the integrand and applying integration by parts, for example? – Ron Gordon Dec 1 '13 at 12:48

\begin{align}\hat{f}(k) &= -\underbrace{\int_{-M}^0 dx \, x \, e^{i 2 \pi k x}}_{x\mapsto -x} + \int_0^M dx \, x \, e^{i 2 \pi k x}\\ &= \int_0^M dx \,x\, \left ( e^{i 2 \pi k x}+ e^{-i 2 \pi k x} \right ) \\ &= 2 \int_0^M dx \,x \, \cos{2 \pi k x} \end{align}