# Basic property of boolean functions with restrictions

For $f:\{\pm1\}^n\to\mathbb{R}$, $I\subset\{1,\dots,n\}$ and $x\in\{\pm1\}^{\{1,\dots,n\}\setminus I}$ we define $f_I[x]:\{\pm1\}^I\to\mathbb{R}$ by $f_I[x](y)=f(x,y)$. (We denote by ($x,y$) the assignment to all $n$ variables given by $x$ and $y$.)

Let $S\subseteq I$. I have proved that $\mathbb{E}_x\left[\widehat{f_I[x]}(S)\right]=\widehat{f}(S)$, where $\widehat{f}(S)$ is the Fourier coefficient of $f$ corresponding to $S$. Now I want to show (possibly using the first result) that $$\mathbb{E}_x\left[\widehat{f_I[x]}^2(S)\right]=\sum\limits_{T:T\cap I=S}\widehat{f}^2(T).$$

Any useful ideas would be greatly appreciated.