I am certainly going to make a mess of any serious algebraic terminology, so bear with me as I present my problem arising from a probability problem.


Consider the space of sequences of $n$ zero-one valued bits -- that is, $\mathbb{Z}\_2^n$. For any element $\omega = (\omega\_1,\omega\_2,\ldots,\omega\_n)$ we can of course define $|\omega|$ to be the number of $i$ such that $\omega\_i = 1$. In some sense, $|\omega| = \sum\_i \omega\_i$.


Now define the function $f: \mathbb{Z}\_2^n \to \mathbb{R^{\geq 0}}$ by $f(\omega) = 1\_{|\omega|>0}\frac{1}{|\omega|^2} = 1\_{|\omega|>0}\left(\sum\_{i,j} \omega\_i\omega\_j\right)^{-1}$. If you accept that last equality, this is very nearly a second-degree rational function, except for at $\omega=(0,0,\ldots,0)$, where we define it to be zero.


Now, this function $f$ can be written as a polynomial -- this is clear just by polynomial interpolation, and there only being a finite number of points in $\mathbb{Z}\_2^n$ to fit the polynomial at. I am interested in what the coefficients of this polynomial are -- these are also the Fourier coefficients of $f$ when we endow $\mathbb{Z}\_2^n$ with the uniform probability measure, so it is a natural thing to want.


The remark about Fourier coefficients does give one expression for the coefficients of this polynomial as an expectation (inner product of the function with the characters), specifically if we take $X\_i$ to be iid uniform on $\{-1,1\}$, we have
$$\hat{f}(S) = \mathbb{E}\left[1\_{\sum\_i X\_i+1 > 0}\frac{\prod\_{i\in S} X\_i}{\left(\sum\_i \frac{X\_i +1}{2}\right)^2}\right]$$


Unfortunately, it isn't clear to me how to compute that expectation.


So I was hoping that there was some other approach -- I know there has been a lot of work on computing things in algebraic geometry, and this question involves enough polynomials and finite fields that it might be relevant. But the sum total of my knowledge of algebraic geometry is half a master's class several years ago, so I have no idea if it actually is. Thus I am asking here, to see if the problem has already been solved somewhere.



Polynomial form/Fourier transform of rational function over finite affine space
You want [Kravchuk polynomials](https://en.wikipedia.org/wiki/Kravchuk_polynomials), and the following identity
$$
\sum\_{\substack{(\omega\_{1},\ldots,\omega\_{n}) \in \{0,1\}^{n}\\ \omega\_{1}+...+\omega\_{n}=\ell}} \prod\_{j \in S} (-1)^{\omega\_{j}} = \sum\_{j=0}^{\ell} (-1)^{j} \binom{|S|}{j}\binom{n-|S|}{\ell-j}.
$$


For some *probabilistic* reasons I prefer to work with $\{-1,1\}^{n}$. Let $f : \{-1,1\}^{n} \to X$ , where $X$ is a normed space, be a function such that $f(x\_{1}, \ldots, x\_{n}) = g(x\_{1}+...+x\_{n})$. Let $x=(x\_{1}, \ldots, x\_{n}) \in \mathrm{unif}(\{-1,1\}^{n})$. Then for any $S \subset \{1, \ldots, n\}$ we have
$$
\widehat{f}(S) :=\mathbb{E}\, f(x)\prod\_{j \in S}x\_{j} = \frac{1}{2^{n}} \sum\_{\ell=0}^{n}g(2\ell-n)\sum\_{\substack{(\omega\_{1},\ldots,\omega\_{n}) \in \{0,1\}^{n}\\ \omega\_{1}+...+\omega\_{n}=\ell}} \prod\_{j \in S} (-1)^{\omega\_{j}+1}=\\
\frac{(-1)^{|S|}}{2^{n}} \sum\_{\ell=0}^{n}g(2\ell-n)K\_{\ell}(|S|;n,2),
$$
where $K\_{\ell}(x;n,2) = \sum\_{j=0}^{\ell} (-1)^{j} \binom{x}{j}\binom{n-x}{\ell-j}$ are called [Kravchuk polynomials](https://en.wikipedia.org/wiki/Kravchuk_polynomials). See, for example,
[Dimension-free Maximal Inequalities for Spherical Means in the Hypercube](https://arxiv.org/abs/1309.4466) by Ben Krause, and the references therein.


