# Fourier transform in spherical coordinates from a Cartesian grid

Recently I realized I didn't understand what FT is, which is embarrassing after years of training. However, I don't get what the basic Fourier integral means.

To make it concrete, let's assume I have a finite array a = rand(1, 10); (using matlab notation but any 10 random numbers in a row vector is fine).

When I take FFT on this, fft(a), what am I computing? Since the Fourier transform is an integration, I'd assume this would be a single number, but it's a 10 element row vector.

This prelude is for this following problem: Here, I have a function defined on a sphere, $f(\theta,\phi)$, and I go over all $\phi$ and sum them up to get the $f_m(\theta)$.

This is my main problem, however if it's an easy question, how can I compute this from a Cartesian grid? As in I have the $f(\theta,\phi)$ on a 3D array, and actually can access to the points, however if I do this manually, I feel like I'll waste a lot of computing power. I'm looking for a way I can do the FFT on Cartesian grid and collect the results from that output. It may be too hard, since the FFT on cartesian grid will be done on xyz whereas here we have r theta phi.

## 1 Answer

Alright, let me try to go through your questions in order.

Let's assume I have a finite array a = rand(1, 10); When I take FFT on this, fft(a), what am I computing? Since the Fourier transform is an integration, I'd assume this would be a single number, but it's a 10 element row vector.

I think it helps to think about the vectorspace that your vector $\vec{a}$ is part of. You have chosen $\vec{a}$ to be of size $10$, so $\vec{a} \in \mathbb{R}^{10}$. We can chose different bases for this vectorspace $\mathbb{R}^{10}$. The most natural choice is certainly this one: $\{[1,0,0,0,0,0,0,0,0,0], [0,1,0,0,0,0,0,0,0,0], ..., [0,0,0,0,0,0,0,0,0,1]\}$. Let's call that base $B_T$, and it's 10 members $\vec{b}_n$. Your vector $\vec{a}$ can be expressed as a linear combination of these basevectors: $\vec{a} = \sum a_n \vec{b_n}$. That means the elements $a_n$ are just the coordinates of your vector in a coordinate system defined by your base $B_T$. You obtain these coordinates by calculating the inner product $<\vec{a}, \vec{b}_n>$. Since there are ten base vectors, you can obtain 10 coordinates.

But as we just learned, $B_T$ is not the only possible base for $\mathbb{R}^{10}$. Here is another base: $B_F = \{ e^{i 2 \pi \frac{n}{10} m} | n \in (1, 10), m \in (1, 10)\}$. This is the Fourier base for $\mathbb{R}^{10}$. Notice that these are again 10 vectors of length 10 each. Again, since there are 10 base vectors, by calculating the inner product $<\vec{a}, \vec{b}_n>$ you obtain 10 coordinates. That is the 10 element row vector that you have obtained by the Fourier transform: it's nothing other than the coordinates of your vector $\vec{a}$ with respect to the Fourier base.

This prelude is for this following problem: Fourier transform on spherical coordinates. Here, I have a function defined on a sphere, $f(\theta, \phi)$ , and I go over all $\phi$ and sum them up to get the $f_m(\theta)$.

Well, by not integrating over $\theta$, you chose to treat $\theta$ as a constant. This leaves your function $f(\theta, \phi)$ a function of one parameter of the form $[0, 2\pi] \to \mathbb{R}$. Let's write this function as $f_\theta(\phi)$ to make that aspect clearer. The Fourier base of the space of such functions would consist of the functions:

$$b_m(\phi) = e^{i m \phi}$$

Your calculation $\int_0^{2\pi}f_\theta(\phi) b_m(\phi) d\phi$ is just the inner product $<f_\theta(\phi), b_m(\phi)>$. So $f_m(\theta)$ is the $m$th coordinate of your function $f_\theta(\phi)$ with respect to the Fourier base, for whichever concrete value of $\theta$ you might have chosen. Note that the Fourier spectrum that you are going to obtain is then going to be a function of $m$, not of $\theta$. Every $m$ here is equivalent to one of the 10 dimensions in your initial example about the vector $\vec{a}$, and every concrete value of $f_m(\theta)$ corresponds to one of the 10 coordinate values.

Also note that if instead you wanted $\theta$ to be a parameter as well, you'd be dealing with a space of functions of the form $[0, 2\pi]^2 \to \mathbb{R}$. In that case your Fourier base would consist of functions of the form $$b_{n,m}(\theta, \phi) = e^{i n \theta}e^{i m \phi}$$