On the invariant manifolds of the fixed point of a second order nonlinear difference equation

Abstract: This paper addresses the asymptotic approximations of the stable and unstable manifolds for the saddle fixed point and the 2-periodic solutions of the difference equation $x_{n+1} = \alpha + \beta x_{n-1}+x_{n-1}/x_{n},$ where $\alpha>0,$ $0\leqslant \beta <1$ and the initial conditions $x_{-1}$ and $x_0$ are positive numbers. These manifolds determine completely global dynamics of this equation. The theoretical results are supported by some numerical examples.

\section{Introduction}

Many real world processes are studied by means of difference equations. Because
of their wide range of applications in mechanics, economics, electronics, chemistry,
ecology, biology, etc., the theory of discrete dynamical systems has been under intensive
development and many researchers have been paying their attention to the study
of these systems \cite{agarwal, elaydi, HK, kelley, kocic, ladas, KM, laks2, hassan, Wiggins}.

The equation
\begin{align}
x_{n+1}=\alpha + \frac{x_{n-1}}{x_n}, \qquad n=0,1,2,\ldots \label{eqn}
\end{align}
was investigated by many researchers.
The equation \eqref{eqn}, for $\alpha \in [0,\infty)$
and the initial conditions $x_{-1}$ and $x_0$
being arbitrary positive real numbers, has been considered in \cite{amleh}.
There, the authors analyzed the global stability, the
boundedness character, and the periodic nature of the positive solutions of \eqref{eqn}.
The global stability, the permanence,
and the oscillation character of the recursive equation \eqref{eqn}
for nonnegative values of the parameter $\alpha$
with negative initial conditions $x_{-1}$ and $x_0$ was investigated in \cite{hamza}.
The same equation for $\alpha< 0$ was taken into account in \cite{stevic2}.
The global bifurcation result for \eqref{eqn} was obtained in \cite{burgic} and
the asymptotic approximations of the stable and unstable manifolds of the fixed point of
\eqref{eqn} were discussed in \cite{kul}.

In this work, we consider the difference equation
\begin{align}
x_{n+1}=\alpha+\beta x_{n-1} + \frac{x_{n-1}}{x_n}, \qquad n=0,1,2,\ldots \label{main}
\end{align}
where $\alpha \geqslant 0,$ $0 \leqslant \beta < 1,$
and the initial conditions $x_{-1}$ and $x_0$ are positive real numbers.
Clearly, when $\beta=0,$ the equation \eqref{main} reduces to \eqref{eqn}. For this reason,
the results obtained in the current paper covers those given in \cite{kul}.

Equation \eqref{main}
has the unique fixed point
\begin{align} \label{fp}
\bar{x}=\frac{1+\alpha}{1-\beta}.
\end{align}

Letting $y_n=x_{n-1}$ and $z_n=x_n,$ \eqref{main}
can be written as
\begin{align} \label{mainsys}
\begin{array}{l}
y_{n+1} = z_n \\
z_{n+1} = \alpha + \beta y_n + \displaystyle\frac{y_n}{z_n}
\end{array}
\end{align}
together with the initial conditions $y_0=x_{-1},$ $z_0=x_0.$ Introducing the mapping
\begin{align} \label{t}
T\begin{pmatrix}
y \\ z
\end{pmatrix} =
\begin{pmatrix}
z \\ \alpha + \beta y + \displaystyle\frac{y}{z}
\end{pmatrix},
\end{align}
\eqref{mainsys} is written as
\begin{align*}
\begin{pmatrix}
y_{n+1} \\ z_{n+1}
\end{pmatrix}
=
T\begin{pmatrix}
y_n \\ z_n
\end{pmatrix}.
\end{align*}
$T$ has a unique fixed point $(\bar{x}, \bar{x})$ where $\bar{x}$ is given by \eqref{fp}.

The following result for \eqref{main} was given in \cite{at}:
\begin{theorem} Let $0\leqslant \beta < 1.$ For the equation \eqref{main}, one has:
\begin{itemize}
\item If $0\leqslant \alpha < 1,$ the equilibrium point $\bar{x}$ is unstable;
\item If $\alpha = 1,$  then there exists periodic solutions with period 2. Moreover, any non periodic solution of \eqref{main} converges either to the fixed point or to a two-periodic solution;
\item If $\alpha >1,$ then the equilibrium point $\bar{x}$ is globally asymptotically stable.
\end{itemize}
\end{theorem}
To complete the global dynamics of \eqref{main}, the present paper addresses the equations of stable and unstable manifolds of
the equilibrium solution and the stable manifold of period-two solutions of \eqref{main}.
The following definition of the stable and unstable manifolds and the next theorem about their existence can be found in \cite[Definition 15.18, Theorem 15.19, pp.457]{HK} and also in \cite{mars}. We present these only with a minor change in notations for the convenience of the present paper.

\begin{defn*} Let ${\mathcal N}$ be a neighborhood
of a fixed point $\bar{x}$ of a diffeomorphism $T$ defined in ${\mathcal N}.$
Then, the local stable manifold $W^s(\bar{x}, {\mathcal N}),$ and
the local unstable manifold $W^u(\bar{x}, {\mathcal N})$ of $\bar{x}$ are defined,
respectively, to be the following subsets of ${\mathcal N}:$
\begin{align*}
W^s(\bar{x}, {\mathcal N})=\{{\bf x}\in {\mathcal N}: T^n({\bf x})\in {\mathcal N}, \ \text{for all } \ n\geqslant 0,
\ \text{and} \ T^n({\bf x})\to \bar{x}, \ \text{as} \ n\to\infty \} \\
W^u(\bar{x}, {\mathcal N})=\{{\bf x}\in {\mathcal N}: T^{-n}({\bf x})\in {\mathcal N}, \ \text{for all } \ n\geqslant 0,
\ \text{and} \ T^{-n}({\bf x})\to \bar{x}, \ \text{as} \ n\to\infty \}
\end{align*}
\end{defn*}

\begin{theorem}[Stable and Unstable Manifolds]\label{thminv}
Let $T$ be be a diffeomorphism with a hyperbolic saddle point $\bar{x},$ that is, the linearized
map $DT(\bar{x})$ at the fixed point has nonzero eigenvalues $|\lambda_1|<1$ and $|\lambda_2|>1.$
Then $W^s(\bar{x}, {\mathcal N})$ is a curve tangent at $\bar{x}$ to, and a graph over, the eigenspace
corresponding to $\lambda_1,$ while $W^u(\bar{x}, {\mathcal N})$ is a curve tangent at $\bar{x}$ to, and a graph
over, the eigenspace corresponding to $\lambda_2$. These curves are as smooth as
the map $T.$
\end{theorem}
For the following theorem see \cite[Theorem 6, pp 34]{carr}.
\begin{theorem}[Center Manifold]\label{thmc}
Let $T:{\mathbb R}^{n+m}\to{\mathbb R}^{n+m}$ have the following form:
$$T(x,y)=(Ax+f(x,y), \ Bx+g(x,y))$$
where $x\in{\mathbb R}^{n},$ $y\in{\mathbb R}^{m},$ $A$ and $B$ are square matrices such that each eigenvalue of $A$ has modulus 1 and each eigenvalue of $B$ has modulus less than 1, $f$ and $g$ are $C^2$ and $f, g$ and their first order derivatives are zero at the origin. Then, there exists a center manifold $h:{\mathbb R}^n\to{\mathbb R}^m$ for $T.$
More precisely, for some $\varepsilon >0$ there exists a $C^2$ function $h:{\mathbb R}^n\to{\mathbb R}^m$ with
$h(0)=h'(0)=0$ such that $|x|<\varepsilon$ and $(x_1, y_1)=T(x,h(x))$ implies $y_1=h(x_1).$
\end{theorem}

The paper is organized as follows: In the next chapter, the normal form of the map $T$ and the equations of unstable and stable manifolds of the equilibrium solution are given. Chapter 3 deals with the normal form and invariant manifolds of the map $T^2.$ Finally, Chapter 4 is devoted to some numerical examples to illustrate the theoretical results.

\section{Normal form and invariant manifolds of the map $T$}

\subsection{Normal Form}

To obtain the normal form of the map $T,$ first, we transform its fixed point to the origin. For this, let $u_n=y_n-\bar{x}$ and $v_n=z_n-\bar{x}.$ Then, \eqref{mainsys} becomes
\begin{align} \label{mainsys2}
\begin{array}{l}
u_{n+1}=v_n\\
v_{n+1}=\beta u_n+\displaystyle\frac{u_n-v_n}{v_n+\bar{x}}
\end{array}.
\end{align}
For the mapping
\begin{align*}
F\begin{pmatrix}
u \\ v
\end{pmatrix}
=
\begin{pmatrix}
v\\ \beta u+ \frac{u-v}{v+\bar{x}}
\end{pmatrix},
\end{align*}
\eqref{mainsys2} is written as
\begin{align*}
\begin{pmatrix}
u_{n+1} \\ v_{n+1}
\end{pmatrix}
=
F\begin{pmatrix}
u_n \\ v_n
\end{pmatrix}.
\end{align*}
The Jacobian matrix of $F$ at its unique fixed point $(0,0)$ is
\begin{align*}
J=
\begin{pmatrix}
0 & 1\\ \beta+\frac{1}{\bar{x}} & -\frac{1}{\bar{x}}
\end{pmatrix}
\end{align*}
which has the eigenvalues
\begin{align}
\lambda_{1} = \frac{-1-\theta}{2\bar{x}}
\quad \text{and} \quad
\lambda_{2} = \frac{-1+\theta}{2\bar{x}}\label{evalues}
\end{align}
with the corresponding eigenvectors
\begin{align}
{\bf v}_1 = \left(\frac{-2\bar{x}}{1+\theta} \:, \: \: 1\right)^T
\quad \text{and} \quad
{\bf v}_2 = \left(\frac{-2\bar{x}}{1-\theta} \:, \: \: 1\right)^T
\label{evectors}
\end{align}
respectively, where $\theta=\sqrt{1+4\bar{x}+4\beta\bar{x}^2}.$
Thus,
\begin{align*}
F
\begin{pmatrix}
u \\ v
\end{pmatrix}
= J\cdot
\begin{pmatrix}
u \\ v
\end{pmatrix}
+ H
\begin{pmatrix}
u \\ v
\end{pmatrix}
\end{align*}
where
\begin{align*}
H
\begin{pmatrix}
u \\ v
\end{pmatrix}
=
\begin{pmatrix}
0 \\ \frac{v(v-u)}{\bar{x}(v+\bar{x})}
\end{pmatrix}.
\end{align*}
Thus, \eqref{mainsys} is equivalent to
\begin{align} \label{maineq}
\begin{pmatrix}
u_{n+1}\\ v_{n+1}
\end{pmatrix}
=
\begin{pmatrix}
0 & 1 \\ \beta+\frac{1}{\bar{x}} & -\frac{1}{\bar{x}}
\end{pmatrix}
\begin{pmatrix}
u_n\\ v_n
\end{pmatrix}
+H
\begin{pmatrix}
u_n\\ v_n
\end{pmatrix}.
\end{align}
Set
$P=({\bf v}_1 \: {\bf v}_2),$ where ${\bf v}_1$ and ${\bf v}_2$ are given by \eqref{evectors}, and let
\begin{align} \label{uvp}
\begin{pmatrix}
u_n \\ v_n
\end{pmatrix} = P\cdot \begin{pmatrix}
\xi_n \\ \eta_n
\end{pmatrix}.
\end{align}
Then, \eqref{maineq} becomes
\begin{align}
\begin{pmatrix}
\xi_{n+1} \\ \eta_{n+1}
\end{pmatrix}
=
\begin{pmatrix}
\lambda_1 & 0 \\ 0 & \lambda_2
\end{pmatrix}
\begin{pmatrix}
\xi_n \\ \eta_n
\end{pmatrix}
+
\begin{pmatrix}
f(\xi_n, \eta_n) \\ g(\xi_n, \eta_n)
\end{pmatrix}
\label{normal}
\end{align}
where
\begin{align} \label{fg}
\begin{array}{l}
f(\xi, \eta)=
\displaystyle\frac{(1+2\beta\bar{x})(\xi+\eta)^2+\theta(\xi^2-\eta^2)}{\theta(\theta-1)(\xi+\eta+\bar{x})},\\
g(\xi, \eta)=
\displaystyle\frac{(1+2\beta\bar{x})(\xi+\eta)^2+\theta(\xi^2-\eta^2)}{\theta(\theta+1)(\xi+\eta+\bar{x})}.
\end{array}
\end{align}
System \eqref{normal} is called the normal form of \eqref{mainsys}.

\subsection{Unstable manifold of the equilibrium solution}

Let $0<\alpha<1.$ Then, as it is stated in \cite{at}, the fixed point $\bar{x}$ of \eqref{main} is unstable. In fact, it can be shown that $|\lambda_1|>1$ and $|\lambda_2|<1.$ Then, by Theorem \ref{thminv}, there is an unstable manifold $W^u$ which is the graph of an analytic map $\varphi:E_1 \to E_2$
such that $\varphi(0)=\varphi'(0)=0.$ Let $$\varphi(\xi)=a_2\xi^2+a_3\xi^3+O(\xi^4), \quad a_2, a_3 \in{\mathbb R}.$$ Now, we shall compute $a_2$ and $a_3.$ On the manifold $W^u,$  we have $\eta_n=\varphi(\xi_n)$ for $n\in {\mathbb N}_0.$ Thus, the function $\varphi$ must satisfy
\begin{align}
\varphi(\lambda_1\xi+f(\xi,\varphi(\xi)))=\lambda_2\varphi(\xi)+g(\xi, \varphi(\xi)) \label{unsman}
\end{align}
where $f$ and $g$ are given in \eqref{fg}. Rewriting \eqref{unsman} as a polynomial equation in $\xi$ and equation the coefficients of $\xi^2$ and $\xi^3$ to 0, we obtain
\begin{align}
a_2=\frac{1+\theta+2\beta\bar{x}}{\theta(\theta+1)(\lambda_1^2-\lambda_2)\bar{x}} \label{a2}
\end{align}
and
\begin{align}
a_3=\frac{a_2}{(\lambda_1^3-\lambda_2)\bar{x}}\left[\lambda_2-\lambda_1^2-\frac{1+2\beta\bar{x}}{\theta\bar{x}}\left(\frac{1}{\lambda_1}+\frac{\lambda_1}{\lambda_2}\right)-\frac{\lambda_1}{\lambda_2\bar{x}}\right]. \label{a3}
\end{align}

The local unstable manifold is obtained locally as the graph of the map
$\varphi(\xi)=a_2\xi^2+a_3\xi^3.$ Since $\eta_n=a_2\xi_n^2+a_3\xi_n^3,$ using \eqref{uvp} and $u_n=x_{n-1}-\bar{x},$ $v_n=x_n-\bar{x},$ we can approximate locally the local unstable manifold $W_{loc}^u$ of \eqref{main} as the graph of $\tilde{\varphi}(x)$ such that $U(x, \tilde{\varphi}(x))=0$ where
\begin{align}
U(x,y):=\gamma_1(x-\bar{x})-\gamma_2(y-\bar{x})
+a_2\left[\gamma_1(x-\bar{x})+\gamma_3(y-\bar{x})\right]^2
+a_3\left[\gamma_1(x-\bar{x})+\gamma_3(y-\bar{x})\right]^3 \label{manU}
\end{align}
in which
\begin{align} \label{gam}
\gamma_1=\frac{1+\beta\bar{x}}{-\theta},\quad
\gamma_2=\frac{\theta-1}{2\theta} \quad \text{and} \quad
\gamma_3=\frac{\theta+1}{2\theta}.
\end{align}

It is easy to see that the function $\tilde{\varphi}(x)$ satisfies
\begin{align*}
\tilde{\varphi}(\bar{x})=\bar{x} \quad \textnormal {and} \quad
\tilde{\varphi}'(\bar{x})=-\frac{1+\theta}{2\bar{x}}.
\end{align*}
Thus, we have proved the following theorem:
\begin{theorem} \label{thmusman}
The local unstable manifold of \eqref{main} corresponding to the saddle point $\bar{x}$ has the asymptotic equation $U(x,\tilde{\varphi}(x))=0$ where $U(x,y)$ is given by \eqref{manU}.
\end{theorem}

\subsection{Stable manifold of the equilibrium solution}

Since $|\lambda_1|>1$ and $|\lambda_2|<1,$ by Theorem \ref{thminv}, there is a stable manifold $W^s$ which is the graph of an analytic map $\psi:E_1 \to E_2$
such that $\psi(0)=\psi'(0)=0.$ Let $$\psi(\eta)=b_2\eta^2+b_3\eta^3+O(\eta^4), \quad b_2, b_3 \in{\mathbb R}.$$ Now, we shall compute the coefficients $b_2$ and $b_3.$ On the manifold $W^s,$  we have $\xi_n=\psi(\eta_n)$ for $n\in {\mathbb N}_0.$ Thus, the function $\psi$ must satisfy
\begin{align}
\psi(\lambda_2\eta+g(\psi(\eta),\eta))=\lambda_1\psi(\eta)+f(\psi(\eta),\eta) \label{sman}
\end{align}
where $f$ and $g$ are given in \eqref{fg}. Rewriting \eqref{sman} as a polynomial equation in $\eta$ and equating the coefficients of $\eta^2$ and $\eta^3$ to 0, we obtain
\begin{align}
b_2=\frac{1-\theta+2\beta\bar{x}}{\theta(\theta-1)(\lambda_2^2-\lambda_1)\bar{x}} \label{b2}
\end{align}
and
\begin{align}
b_3=\frac{b_2}{(\lambda_b^3-\lambda_1)\bar{x}}\left[\lambda_1-\lambda_2^2+\frac{1+2\beta\bar{x}}{\theta\bar{x}}\left(\frac{1}{\lambda_2}+\frac{\lambda_2}{\lambda_1}\right)-\frac{\lambda_2}{\lambda_1\bar{x}}\right]. \label{b3}
\end{align}

The local stable manifold is obtained locally as the graph of the map
$\psi(\eta)=b_2\eta^2+b_3\eta^3.$ Since $\xi_n=b_2\eta_n^2+b_3\eta_n^3,$ using \eqref{uvp} and $u_n=x_{n-1}-\bar{x},$ $v_n=x_n-\bar{x},$ we can approximate locally the local stable manifold $W_{loc}^s$ of \eqref{main} as the graph of $\tilde{\psi}(y)$ such that $S(\tilde{\psi}(y), y)=0$ where
\begin{align}
S(x,y):=\gamma_1(x-\bar{x})+\gamma_3(y-\bar{x})
-b_2\left[\gamma_1(x-\bar{x})-\gamma_2(y-\bar{x})\right]^2
+b_3\left[\gamma_1(x-\bar{x})-\gamma_2(y-\bar{x})\right]^3. \label{manS}
\end{align}
It is easy to see that the function $\tilde{\psi}(x)$ satisfies
\begin{align*}
\tilde{\psi}(\bar{x})=\bar{x} \quad \textnormal {and} \quad
\tilde{\psi}'(\bar{x})=\frac{2\bar{x}}{\theta-1}.
\end{align*}
Thus, we have proved the following theorem:
\begin{theorem} \label{thmsman}
The local stable manifold of \eqref{main} corresponding to the saddle point $\bar{x}$ has the asymptotic equation $S(\tilde{\psi}(y),y)=0$ where $S(x,y)$ is given by \eqref{manS}.
\end{theorem}

\section{Normal form and invariant manifold of the map $T^2$}

\subsection{Normal Form}

For the map $T$ given by \eqref{t}, one has
\begin{align}\label{t2}
T^2\begin{pmatrix}
y \\ z
\end{pmatrix}
=
\begin{pmatrix}
1+\beta y + y/z \\
1+\beta z + \frac{z}{1+\beta y + y/z}
\end{pmatrix}.
\end{align}
That is,
\begin{align}
\begin{pmatrix}
y_{n+2} \\ z_{n+2}
\end{pmatrix}
=
T^2\begin{pmatrix}
y_n \\ z_n
\end{pmatrix}. \label{yzt2}
\end{align}

Firstly, we note that the fixed point $(\bar{x},\bar{x})$ of $T$ is also a fixed point of $T^2.$ That is why, in this section, the fixed point $(\bar{x},\bar{x})$ of $T^2$ is ignored, and the main focus will be on the other fixed points. As it was shown in \cite{at}, when $\alpha=1,$ equation \eqref{main} has infinitely many 2-periodic solutions each of which corresponds to a fixed point of $T^2.$ Indeed, if $\Phi>1/(1-\beta),$ then all the fixed points of $T^2$ are given by $(\Phi, \Psi)$ where $\Psi=\Phi/[(1-\beta)\Phi-1]).$ It is worth mentioning that $\Psi>1/(1-\beta)$ and for the initial conditions $x_{-1}=\Phi$ and $x_0=\Psi,$ the solution of \eqref{main} is $\{\Phi, \Psi, \Phi, \Psi, \ldots\}.$ Swapping the initial values produces the periodic solution $\{\Psi, \Phi, \Psi, \Phi, \ldots\}.$

  As it was done in the previous section, the fixed point $(\Phi, \Psi)$ will be transformed to the origin. For this, let $u=y-\Phi$ and $v=z-\Psi.$ Then, we get the map
\begin{align} \label{F0}
F_0\begin{pmatrix}
u \\ v
\end{pmatrix}
:=T^2\begin{pmatrix}
u+\Phi \\ v+\Psi
\end{pmatrix}
-\begin{pmatrix}
\Phi \\ \Psi
\end{pmatrix}
=\begin{pmatrix}
\beta u + \frac{u + \Phi}{v+\Psi} - \frac{\Phi}{\Psi}\\
\beta v + \frac{(v + \Psi)^2}{v+\Psi+(u+\Phi)(1+\beta v+\beta\Psi)} - \frac{\Psi}{\Phi}
\end{pmatrix},
\end{align}
for which \eqref{yzt2} can be written as
\begin{align}
\begin{pmatrix}
u_{n+2} \\ v_{n+2}
\end{pmatrix}
=
F_0\begin{pmatrix}
u_n \\ v_n
\end{pmatrix}. \label{unvn}
\end{align}

It is clear to see that $(0,0)$ is a fixed point of $F_0$ and the Jacobian of $F_0$ at this fixed point is
\begin{align}\label{J0}
J_0=\begin{pmatrix}
\beta+\frac{1}{\Psi} & -\frac{\Phi}{\Psi^2} \\
-\frac{\beta \Psi+1}{\Phi^2} & \beta+\frac{1}{\Phi}+\frac{1}{\Psi\Phi}
\end{pmatrix}.
\end{align}
Using the relation $\frac{1}{\Phi}+\frac{1}{\Psi}=1-\beta,$ one can rewrite \eqref{J0} as
\begin{align*}
J_0=\begin{pmatrix}
1-\frac{1}{\Phi} & -\frac{\Phi}{\Psi^2} \\
\frac{\Psi(1-\Phi)}{\Phi^3} & 1-\frac{1}{\Psi}+\frac{1}{\Psi\Phi}
\end{pmatrix}.
\end{align*}
from which it can be derived that the eigenvalues of $J_0$ are
\begin{align*}
\lambda_{01}=\left(1-\frac{1}{\Phi}\right)\left(1-\frac{1}{\Psi}\right) \quad \text{and} \quad
\lambda_{02}=1.
\end{align*}
Since $0<\lambda_{01}<1$ and $\lambda_{02}=1,$ the fixed point $(\Phi, \Psi)$ is stable. The eigenvectors corresponding to the eigenvalues $\lambda_{01}$ and $\lambda_{02}$ are
\begin{align}
{\bf v}_{01}= \left(\frac{\Phi^2}{(\Phi-1)\Psi} \:, \: \: 1\right)^T \quad \text{and} \quad
{\bf v}_{02}= \left(-\frac{\Phi^2}{\Psi^2} \:, \:\: 1\right)^T, \label{ev0}
\end{align}
respectively. Thus, the map obtained in \eqref{F0} can be written as
\begin{align} \label{F02}
F_0\begin{pmatrix}
u \\ v
\end{pmatrix}
=J_0 \cdot
\begin{pmatrix}
u \\ v
\end{pmatrix}
+H_0\begin{pmatrix}
u \\ v
\end{pmatrix}
\end{align}
where
\begin{align*}
H_0\begin{pmatrix}
u \\ v
\end{pmatrix}
=\begin{pmatrix}
\frac{v(\Phi v-\Psi u)}{\Psi^2(v+\Psi)} \\
\frac{(v + \Psi)^2}{v+\Psi+(u+\Phi)(1+\beta v+\beta\Psi)} + \frac{(\beta\Psi+1)u}{\Phi^2} - \frac{(\Psi+1)v}{\Psi\Phi} - \frac{\Psi}{\Phi}
\end{pmatrix}.
\end{align*}
Therefore, \eqref{yzt2} is equivalent to
\begin{align}
\begin{pmatrix}
u_{n+2} \\ v_{n+2}
\end{pmatrix}
=
\begin{pmatrix}
1-\frac{1}{\Phi} & -\frac{\Phi}{\Psi^2} \\
\frac{\Psi(1-\Phi)}{\Phi^3} & 1-\frac{1}{\Psi}+\frac{1}{\Psi\Phi}
\end{pmatrix}
\begin{pmatrix}
u_n \\ v_n
\end{pmatrix}
+
H_0 \begin{pmatrix}
u_n \\ v_n
\end{pmatrix}. \label{unvn2}
\end{align}
Set
$P_0=({\bf v}_{01} \: {\bf v}_{02}),$ where ${\bf v}_{01}$ and ${\bf v}_{02}$ are given by \eqref{ev0}, and let
\begin{align} \label{uvp0}
\begin{pmatrix}
u \\ v
\end{pmatrix} = P_0\cdot \begin{pmatrix}
\xi \\ \eta
\end{pmatrix}.
\end{align}
Then, \eqref{unvn2} leads to
\begin{align}
\begin{pmatrix}
\xi_{n+2} \\ \eta_{n+2}
\end{pmatrix}
=
\begin{pmatrix}
\lambda_{01} & 0 \\ 0 & \lambda_{02}
\end{pmatrix}
\begin{pmatrix}
\xi_n \\ \eta_n
\end{pmatrix}
+
\begin{pmatrix}
f_0(\xi_n, \eta_n) \\ g_0(\xi_n, \eta_n)
\end{pmatrix} \label{norm0}
\end{align}
where
\begin{align} \label{f0g0}
\begin{array}{l}
f_0(\xi, \eta)=
\displaystyle \frac{\Phi-1}{\Psi+\Phi-1}\left( \zeta-\frac{\xi}{\Phi\Psi}-\frac{\eta(\Phi+\Psi)}{\Phi(\xi+\eta+\Psi)}+\frac{(\xi+\eta)\xi}{\Phi(1-\Phi)(\xi+\eta+\Psi)}\right), \\
g_0(\xi, \eta)=
\displaystyle \frac{\Psi}{\Psi+\Phi-1}\left(\zeta-\frac{\eta(\Phi+\Psi)}{\Phi\Psi}-\frac{\xi}{\Phi(\xi+\eta+\Psi)}+\frac{(1-\Phi)(\Phi+\Psi)(\xi+\eta)\eta}{\Phi\Psi^2(\xi+\eta+\Psi)}\right).
\end{array}
\end{align}
and
$$\zeta=\frac{(\xi+\eta+\Psi)^2}{\xi+\eta+\Psi+\left(\frac{\Phi^2\xi}{(\Phi-1)\Psi}-\frac{\Phi^2\eta}{\Psi^2}+\Phi\right)(1+\beta \xi+\beta\eta+\beta\Psi)}-\frac{\Psi}{\Phi}.$$
System \eqref{norm0} is the normal of \eqref{yzt2}.

\subsection{Stable set of 2-periodic solution $\{(\Phi, \Psi), (\Psi, \Phi)\}$}

Since $0<\lambda_{01}<1$ and $\lambda_{02}=1,$ by Theorem \ref{thmc}, there is an invariant curve ${\mathcal C}$ (called center manifold) which is the graph of an analytic map $h$ such that $h(0)=h'(0)=0.$ Let
\begin{align*}
h(\xi)=c_2\xi^2+c_3\xi^3+O(\xi^4), \quad c_2, c_3 \in{\mathbb R}.
\end{align*}
Now, we shall compute $c_2$ and $c_3.$ The function $h$ must satisfy
\begin{align}
h(\lambda_{01}\xi+f_0(\xi, h(\xi)))=h(\xi)+g_0(\xi,h(\xi)) \label{cman}
\end{align}
where $\lambda_{01}$ is given in \eqref{ev0}, $f_0$ and $g_0$ are given in \eqref{f0g0}. Rewriting \eqref{cman} as a polynomial equation in $\xi$ and equation the coefficients of $\xi^2$ and $\xi^3$ to 0, we obtain
\begin{align}\label{c2}
c_2=\frac{\Phi}{(1-\Phi)(\Phi+\Psi-1)(2\Phi\Psi-\Phi-\Psi+1)}
\end{align}
and
\begin{align}\label{c3}
c_3=\frac{\Phi^4\kappa_1+\Phi^3\kappa_2-\Phi^2\kappa_3+\kappa_4\Phi}
{\Psi(\Psi+\Phi-1)(1-\Phi)\kappa_5}\, c_2
\end{align}
where
\begin{align*}
\kappa_1&=3\Psi^2-4\Psi+1\\
\kappa_2&=3\Psi^3-12\Psi^2+9\Psi-1\\
\kappa_3&=5\Psi^3-14\Psi^2+6\Psi+1\\
\kappa_4&=2\Psi^3-4\Psi^2+\Psi+1\\
\kappa_5&=\Phi^2(3\Psi^2-3\Psi+1)-\Phi(3\Psi^2-5\Psi+2)+(\Psi-1)^2.
\end{align*}
Using $\eta_{2n}=c_2\xi_{2n}^2+c_3\xi_{2n}^3,$ the relation \eqref{uvp0} together with $u_{2n}=x_{2n-2}-\Phi$ and  $v_{2n}=x_{2n}-\Psi,$ we can approximate locally the invariant curve ${\mathcal C}$ as the graph of $\tilde{h}(x)$ such that $C(x, \tilde{h}(x))=0$ where
\begin{align*}
C(x,y;\Phi):=\delta_1(x-\Phi)-\delta_2(y-\Psi)
+c_2\left[\delta_1(x-\Phi)+\delta_3(y-\Psi)\right]^2
+c_3\left[\delta_1(x-\Phi)+\delta_3(y-\Psi)\right]^3,
\end{align*}
in which
\begin{align} \label{del}
\delta_1=\frac{\Psi^2(\Phi-1)}{\Phi^2(\Phi+\Psi-1)},\quad
\delta_2=\frac{\Psi}{\Phi+\Psi-1} \quad \text{and} \quad
\delta_3=\frac{\Phi-1}{\Phi+\Psi-1}.
\end{align}

It is easy to see that the function $\tilde{h}(x)$ satisfies
\begin{align*}
\tilde{h}(\Phi)=\Psi \quad \textnormal {and} \quad
\tilde{h}'(\Phi)=\frac{\Psi(\Phi-1)}{\Phi^2}.
\end{align*}
Thus, we have proved the following theorem:
\begin{theorem} \label{thmcman}
Let $\Phi>1/(1-\beta)$ and $\Psi=\Phi/[(1-\beta)\Phi-1].$ Then corresponding to the non-hyperbolic period-two solution $\{(\Phi, \Psi), (\Psi, \Phi)\},$ there is an invariant curve which is the union of two curves that are locally given with the asymptotic expansions $C(x,\tilde{h}(x);\Phi)=0$ and $C(x,\tilde{h}(x);\Psi)=0.$
\end{theorem}

\section{Numerical Examples}

In this section, some illustrative examples supporting the theoretical results presented in this article will be constructed. To compare the current results with those given in \cite{kul}, we first take the parameter values as in \cite{kul}.

\begin{example}
For $\alpha=0.2,$ $\beta=0,$ which is the case $p=0.2$ in \cite[Section 3.4]{kul}, we have
\begin{align*}
U_1(x,y)&= -0.4152273992 x + 0.8491364395 - 0.2923863004 y \\
& \qquad  +0.2419777563(-0.4152273992 x - 0.3508635604 + 0.7076136995 y)^2\\
& \qquad  -0.0974600586(-0.4152273992 x - 0.3508635604 + 0.7076136995 y)^3,\\
S_1(x,y)&=-0.4152273992 x - 0.3508635604 + 0.7076136995 y \\
& \qquad  +0.1961061968(-0.4152273992 x + 0.8491364395 - 0.2923863004 y)^2\\
& \qquad  +0.09806508071(-0.4152273992 x + 0.8491364395 - 0.2923863004 y)^3.
\end{align*}
and
\begin{align*}
U_2(x,y)&= -0.3492151478 x + 1.214293633 -0.3253924261 y \\
& \qquad +0.3059452562(-0.3492151478 x - 0.5857063670 + 0.6746075740y)^2 \\
& \qquad -0.1066716833(-0.3492151478 x - 0.5857063670 + 0.6746075740y)^3, \\
S_2(x,y)&= -0.3492151478 x - 0.5857063670 + 0.6746075740 y \\
& \qquad + 0.1446549340(-0.3492151478 x + 1.214293633 - 0.3253924261y)^2 \\
& \qquad + 0.0525187072(-0.3492151478 x + 1.214293633 - 0.3253924261y)^3.
\end{align*}

Figure \ref{fig1} shows the graphs of the functions $U_1(x,y)=0,$ $S_1(x,y)=0,$ $U_2(x,y)=0$ and $S_2(x,y)=0$ together with a typical trajectory. As it can be seen, the trajectory follows the unstable manifold in both cases.

\begin{figure}[!ht]
\begin{center}
\subfigure[Graphs of $U_1(x,y)=0$ (blue) and $S_1(x,y)=0$ (red) for $\alpha=0.2, \beta=0$]{
\resizebox*{60mm}{!}{\includegraphics{fig1a.eps}}}\hspace{8mm
\subfigure[Graphs of $U_2(x,y)=0$ (blue) and $S_2(x,y)=0$ (red) for $\alpha=0.8, \beta=0$]{
\resizebox*{60mm}{!}{\includegraphics{fig1b.eps}}}
\caption{\label{fig1} Graphs of stable and unstable manifolds together with a typical trajectory for different values of $\alpha$ and $\beta.$}
\end{center}
\end{figure}
\end{example}

We would like to note here that the functions $U_1(x,y),$ $S_1(x,y),$ $U_2(x,y)$ and $S_2(x,y),$ obtained in this example are not the same as those given in \cite{kul}. However, they are some certain constant multiples of each other, and hence, the manifolds provided here and given in \cite{kul} are the same. So, we recover the results given in \cite{kul} by taking $\beta=0.$

\begin{example}
As another example let us keep $\alpha$ the same as in the previous example but change $\beta.$

For $\alpha=0.2,$ $\beta=0.5,$ we have
\begin{align*}
U_3(x,y)&= -0.4152273992 x + 0.8491364395 - 0.2923863004 y \\
& \qquad  +0.2419777563(-0.4152273992 x - 0.3508635604 + 0.7076136995 y)^2\\
& \qquad  -0.0974600586(-0.4152273992 x - 0.3508635604 + 0.7076136995 y)^3,\\
S_3(x,y)&=-0.4152273992 x - 0.3508635604 + 0.7076136995 y \\
& \qquad  +0.1961061968(-0.4152273992 x + 0.8491364395 - 0.2923863004 y)^2\\
& \qquad  +0.09806508071(-0.4152273992 x + 0.8491364395 - 0.2923863004 y)^3.
\end{align*}
and
\begin{align*}
U_4(x,y)&= -0.3492151478 x + 1.214293633 -0.3253924261 y \\
& \qquad +0.3059452562(-0.3492151478 x - 0.5857063670 + 0.6746075740y)^2 \\
& \qquad -0.1066716833(-0.3492151478 x - 0.5857063670 + 0.6746075740y)^3, \\
S_4(x,y)&= -0.3492151478 x - 0.5857063670 + 0.6746075740 y \\
& \qquad + 0.1446549340(-0.3492151478 x + 1.214293633 - 0.3253924261y)^2 \\
& \qquad + 0.0525187072(-0.3492151478 x + 1.214293633 - 0.3253924261y)^3.
\end{align*}

Figure \ref{fig2} shows the graphs of the functions $U_3(x,y)=0,$ $S_3(x,y)=0,$ $U_4(x,y)=0$ and $S_4(x,y)=0$ together with a typical trajectory. As it can be seen, the trajectory follows the unstable manifold in both cases.

\begin{figure}[!ht]
\begin{center}
\subfigure[Graphs of $U_3(x,y)=0$ (blue) and $S_3(x,y)=0$ (red) for $\alpha=0.2, \beta=0.5$]{
\resizebox*{60mm}{!}{\includegraphics{fig2a.eps}}}\hspace{8mm
\subfigure[Graphs of $U_4(x,y)=0$ (blue) and $S_4(x,y)=0$ (red) for $\alpha=0.8, \beta=0.5$]{
\resizebox*{60mm}{!}{\includegraphics{fig2b.eps}}}
\caption{\label{fig2} Graphs of stable and unstable manifolds together with a typical trajectory for different values of $\alpha$ and $\beta.$}
\end{center}
\end{figure}
\end{example}

\begin{example} In this example, let us take the parameters as in \cite{kul}. Let $\alpha=1,$ $\beta=0.$ Let $\Phi=2.94.$ In this case, we have $\Psi=1.515463918$ and
\begin{align*}
C_1(x,y;\Phi)&=0.1491735785x+0.2260671754-0.4385703205y\\
&\qquad -0.08039102209(0.1491735785x-1.289396743+0.5614296795y)^2\\
&\qquad +0.01997063483(0.1491735785x-1.289396743+0.5614296795y)^3
\end{align*}
and
\begin{align*}
C_1(x,y;\Psi)&=0.5614296798x+1.650603257-0.8508264215y \\
&\qquad -0.1559585827(0.5614296798x-1.289396743+0.1491735785y)^2 \\
&\qquad +0.05514400545(0.5614296798x-1.289396743+0.1491735785y)^3.
\end{align*}
For $\Phi=2.3,$ we have $\Psi=1.769230769$ and
\begin{align*}
C_2(x,y;\Phi)&=0.2506265664x+0.4434162323-0.5764411027y\\
&\qquad -0.1137137228(0.2506265664x-1.325814536+0.4235588973y)^2\\
&\qquad +0.03453170706(0.2506265664x-1.325814536+0.4235588973y)^3
\end{align*}
and
\begin{align*}
C_2(x,y;\Psi)&=0.4235588973x+0.9741854634-0.7493734336y\\
&\qquad -0.1478278397(0.4235588973x-1.325814536+0.2506265664y)^2\\
&\qquad +0.0520650698(0.4235588973x-1.325814536+0.2506265664y)^3.
\end{align*}

Figure \ref{fig3} shows the graphs of the functions $C_1(x,y;\Phi)=0,$ $C_1(x,y;\Psi)=0$ and $C_2(x,y;\Phi)=0,$ $C_2(x,y;\Psi)=0,$ together with typical trajectories. As it can be seen, the trajectory follows the invariant manifold in both cases.
\begin{figure}[!ht]
\begin{center}
\subfigure[Graphs of $C_1(x,y;\Phi)=0$ (blue) and $C_1(x,y;\Psi)=0$ (red) for $\Phi=2.94.$]{
\resizebox*{60mm}{!}{\includegraphics{fig3a.eps}}}\hspace{8mm
\subfigure[Graphs of $C_2(x,y;\Phi)=0$ (blue) and $C_2(x,y;\Psi)=0$ (red) for $\Phi=2.3.$]{
\resizebox*{60mm}{!}{\includegraphics{fig3b.eps}}}
\caption{\label{fig3} Graphs of invariant curves together with typical trajectories and periodic solutions for different values of $\Phi$ and $\beta=0.$}
\end{center}
\end{figure}
\end{example}

\begin{example} As the last example, let $\alpha=1,$ $\beta=0.5.$
For $\Phi=2.94,$ we have $\Psi=6.255319149$ and
\begin{align*}
C_3(x,y;\Phi)&=1.071618354x+1.623998947-0.7632795057y\\
&\qquad -0.006468848599(1.071618354x-4.631320202+0.2367204943y)^2\\
&\qquad +0.001026052614(1.071618354x-4.631320202+0.2367204943y)^3
\end{align*}
and
\begin{align*}
C_3(x,y;\Psi)&=0.1416540319x+0.1686084427-0.3587413677y\\
&\qquad -0.005080796064(0.1416540319x-2.771391557+0.6412586323y)^2\\
&\qquad +0.001395071806(0.1416540319x-2.771391557+0.6412586323y)^3.
\end{align*}
For $\Phi=2.3,$ we have $\Psi=15.33333333$ and
\begin{align*}
C_4(x,y;\Phi)&=3.473613893x+6.145624586-0.9218436874y\\
&\qquad -0.001973405924(3.473613893x-9.187708748+0.07815631264y)^2\\
&\qquad +0.000140325572(3.473613893x-9.187708748+0.07815631264y)^3
\end{align*}
and
\begin{align*}
C_4(x,y;\Psi)&=0.01938877756x+0.0207414829-0.1382765531y\\
&\qquad -0.001193222187(0.01938877756x-2.279258517+0.8617234469y)^2\\
&\qquad +0.0003847285557(0.01938877756x-2.279258517+0.8617234469y)^3.
\end{align*}

Figure \ref{fig4} shows the graphs of the functions $C_3(x,y;\Phi)=0,$ $C_3(x,y;\Psi)=0$ and $C_4(x,y;\Phi)=0,$ $C_4(x,y;\Psi)=0,$ together with typical trajectories. As it can be seen, the trajectory follows the invariant manifold in both cases.
\begin{figure}[!ht]
\begin{center}
\subfigure[Graphs of $C_3(x,y;\Phi)=0$ (blue) and $C_3(x,y;\Psi)=0$ (red) for $\Phi=2.94.$]{
\resizebox*{60mm}{!}{\includegraphics{fig4a.eps}}}\hspace{8mm
\subfigure[Graphs of $C_4(x,y;\Phi)=0$ (blue) and $C_4(x,y;\Psi)=0$ (red) for $\Phi=2.3.$]{
\resizebox*{60mm}{!}{\includegraphics{fig4b.eps}}}
\caption{\label{fig4} Graphs of invariant curves together with typical trajectories and periodic solutions for different values of $\Phi$ and $\beta=0.5.$}
\end{center}
\end{figure}
\end{example}

\bigskip


Testing Booleanity and the Uncertainty Principle

Abstract: Let f:{-1,1}^n -> R be a real function on the hypercube, given by its discrete Fourier expansion, or, equivalently, represented as a multilinear polynomial. We say that it is Boolean if its image is in {-1,1}.We show that every function on the hypercube with a sparse Fourier expansion must either be Boolean or far from Boolean. In particular, we show that a multilinear polynomial with at most k terms must either be Boolean, or output values different than -1 or 1 for a fraction of at least 2/(k+2)^2 of its domain.It follows that given oracle access to f, together with the guarantee that its representation as a multilinear polynomial has at most k terms, one can test Booleanity using O(k^2) queries. We show an \Omega(k) queries lower bound for this problem.Our proof crucially uses Hirschman's entropic version of Heisenberg's uncertainty principle.

\section{Introduction}
Let $f$ be a function from $\{-1,1\}^n$ to $\R$. Equivalently, one can
consider functions on $\{0,1\}^n$ or $\Z_2^n$, as we do below. A
natural way to represent such a function is as a multilinear
polynomial. For example:
\begin{align*}
  f(x_1,x_2,x_3) = x_1-2x_2x_3+3.5x_1x_2.
\end{align*}
This representation is called the {\em Fourier expansion} of $f$ and
is extremely useful in many applications
(cf.,~\cite{odonnell12analysis}). The coefficients of the Fourier
expansion of $f$ are called the {\it Fourier transform} of $f$. We
denote the Fourier transform by $\hat{f}$, and think of it too as a
function from $\{-1,1\}^n$ to $\R$.

We say that $f$ is Boolean if $f(x)=1$ or $f(x)=-1$ for all $x$ in its
domain. An interesting question in the field of discrete Fourier
analysis of Boolean functions is the following: what does the fact
that $f$ is Boolean tell us about its Fourier transform $\hat{f}$? Is
there a simple characterization of functions that are the Fourier
transform of Boolean functions?

We propose the following observation that lies at the basis of our
proofs: $f$ is Boolean if and only if the convolution (over $\Z_2^n$)
of $\hat{f}$ with itself is equal to the delta function. This follows
from the convolution theorem, as we show below in
Proposition~\ref{thm:boolean-fourier}.

Equipped with this characterization, we consider the question of
determining whether or not $f$ is Boolean. In particular, we consider
the case that we are given black box access to a function $f$,
together with the guarantee that its representation as a multilinear
polynomial has at most $k$ terms, in which case we say that $f$ is
{\em $k$-sparse}. Sparse functions on the hypercube have been the
subject of numerous studies (see,
e.g.,~\cite{nisan1994rank,gopalan2011testing,mansour1994learning}).

We show that $O(k^2)$ queries to $f$ suffice to answer this question
correctly with high probability. This follows from the following
combinatorial result: in Theorem~\ref{thm:bool-is-or-far-from} we show
that if $f$ is not Boolean then it is not Boolean for at least a
$2/(k+2)^2$ fraction of its domain. More generally, we show that for
any set $D \subset \R$ of size $d$, either the image of $f$ is
contained in $D$, or else $f(x) \not \in D$ for at least a
$d!/(k+d)^d$ fraction of the domain of $f$.  We prove an $\Omega(k)$
lower bound for this problem.

Booleanity testing bears resemblance to problems of property testing
of functions on the hypercube (see,
e.g.,~\cite{blais2009,fischer2002,fischer_eldar2002,newman2000}). See
Section~\ref{sec:property testing} below for further discussion.

Our proofs rely on the discrete version of {\em Heisenberg's
  uncertainty principle}. There have been very few applications of the
discrete uncertainty principle in Computer Science, and in fact we are
only familiar with one other such result, concerning circuit lower
bounds~\cite{Jansen06anon-linear}. We expect that more applications
can be found, in particular in cryptography.  See
Sections~\ref{sec:uncertainty} and~\ref{sec:discussion} below for
further discussion.

In the following Section~\ref{sec:main-results} we present our main
results, and in Sections~\ref{sec:boolean-fourier},
\ref{sec:uncertainty}, \ref{sec:property testing}
and~\ref{sec:discussion} we elaborate on the background and relation
to other work, as well as propose a relaxation of our main
claim. Section~\ref{sec:definitions} contains formal definitions, and
proofs appear in Section~\ref{sec:results}.

\subsection{Main results}
\label{sec:main-results}
A function $f :\{-1,1\}^n\to \R$ is $k$-sparse if it can be
represented as a multilinear polynomial with at most $k$ terms. Recall
that we say that $f$ is Boolean if its image is contained in
$\{-1,1\}$.

The following theorem is a combinatorial result, stating that a
function with a sparse Fourier expansion is either Boolean or far from
Boolean.
\begin{theorem}
  \label{thm:bool-is-or-far-from}
  Every $k$-sparse function $f$ is either Boolean, or satisfies
  \begin{equation*}
    \Psub{x}{f(x) \not \in \{-1,1\}} \geq \frac{2}{(k+2)^2}
  \end{equation*}
  where $\Psub{x}{\cdot}$ denotes the uniform distribution over the
  domain of $f$.
\end{theorem}

We in fact prove a more general result:
\begin{theorem}
  \label{thm:is-or-far-from}
  Let $D \subset \R$ be a set with $d$ elements. Then, for any
  $k$-sparse function $f$, one of the following holds.
  \begin{itemize}
  \item Either $\Psub{x}{f(x) \in D} = 1$,
  \item or $\Psub{x}{f(x) \not \in D} \geq \frac{d!}{(k+d)^d}$,
  \end{itemize}
  where $\Psub{x}{\cdot}$ denotes the uniform distribution over the
  domain of $f$.
\end{theorem}
That is, either $f$'s image is in $D$, or it is far from being in
$D$. In particular, for $D=\{-1,1\}$ (or $\{0,1\}$, or any other set
of size two), this theorem reduces to
Theorem~\ref{thm:bool-is-or-far-from}

An immediate consequence of Theorem~\ref{thm:bool-is-or-far-from} is
the following result.
\begin{theorem}
  \label{thm:k-algo}
  For every $\epsilon>0$ there exists a randomized algorithm with query
  (and time) complexity $O(k^2\log(1/\epsilon))$ that, given $k$ and
  oracle access to a $k$-sparse function $f$,
  \begin{itemize}
  \item returns {\em true} if $f$ is Boolean, and
  \item returns {\em false} with probability at least $1-\epsilon$ if $f$
    is not Boolean.
  \end{itemize}
\end{theorem}
This result can easily be extended to test whether the image of a
function on the hypercube is contained in any finite set, using
Theorem~\ref{thm:is-or-far-from}.

We prove the following lower bound:
\begin{theorem}
  \label{thm:k-lower-bound}
  Let $A$ be a randomized algorithm that, given $k$ and oracle access
  to a $k$-sparse function $f$,
  \begin{itemize}
  \item returns {\em true} with probability at least $2/3$ if $f$ is
    Boolean, and
  \item returns {\em false} with probability at least $2/3$ if $f$ is
    not Boolean.
  \end{itemize}
  Then $A$ has query complexity $\Omega(k)$.
\end{theorem}

\subsection{The Fourier transform of Boolean functions}
\label{sec:boolean-fourier}

Let $f,g$ be functions from $\Z_2^n$ to $\R$. Their convolution $f*g$
is also a function from $\Z_2^n$ to $\R$ defined by
\begin{align*}
  [f*g](x) = \sum_{y \in \Z_2^n}f(y)g(x+y),
\end{align*}
where the addition ``$x+y$'' is done using the group operation of
$\Z_2^n$. Note that the convolution operator is both associative and
distributive.

An observation that lies at the basis of our proofs is a
characterization of the Fourier transforms of Boolean functions:
$\hat{f} : \Z_2^n \to \R$ is the Fourier transform of a Boolean
function if its convolution with itself is equal to the delta
function; that is,
\begin{align*}
  \hat{f} * \hat{f} = \delta
\end{align*}
(where $\delta: \Z_2^n \to \B$ is given by $\delta(0)=1$, and
$\delta(x)=0$ for every $x \neq 0$).

This is our Proposition~\ref{thm:boolean-fourier}; it follows from the
convolution theorem (see, e.g.,\cite{katznelson2004introduction}).
Equivalently, given a function $f$ on $\Z_2^n$, one can shift it by
acting on it with $x \in \Z_2^n$ by $[xf](y) = f(x+y)$. Hence the
observation above can be stated as follows: If and only if a function
is orthogonal to its shifted self, for all non-zero shifts in
$\Z_2^n$, then it is the Fourier transform of a Boolean function.

\subsection{The uncertainty principle}
\label{sec:uncertainty}
A distribution over a discrete domain $S$ is often represented as a
non-negative function $f: S \to \R^+$ which is normalized in $L_1$,
i.e., $\sum_{x \in S}f(x)=1$.

In Quantum Mechanics the state of a particle on a domain $S$ is
represented by a {\em complex} function on $S$, and the probability to
find the particle in a particular $x \in S$ is equal to
$|f(x)|^2$. Accordingly, $f$ is normalized in $L_2$, so that $\sum_{x
  \in S}|f(x)|^2=1$.

Often, the domain $S$ is taken to be $\R$ (or some power thereof). In
this continuous case one represents the state of a particle by a
function $f:\R \to \mathbb C} \newcommand{\Z}{\mathbb Z$ such that $\int_{x \in \R}|f(x)|^2dx =1$, and
then $|f(x)|^2$ is the probability density function of the
distribution of the particle's position. The Fourier transform of $f$,
denoted by $\hat{f}$, is then also normalized in $L_2$ (if one chooses
the Fourier transform operator to be unitary), and $|\hat{f}(x)|^2$ is
the probability density function of the {\em distribution of the
  particle's momentum}.

The Heisenberg uncertainty principle states that the variance of a
particle's position times the variance of its momentum is at least one
- under an appropriate choice of units. Besides its physical
significance, this is also a purely mathematical statement relating a
function on $\R$ to its Fourier transform.

Hirschman~\cite{hirschman1957note} conjectured in 1957 a stronger
entropic form, namely
\begin{align*}
  H_e\Big[f\Big]+\EntSub{e}{\hat{f}} \geq 1-\ln 2,
\end{align*}
where $\EntSub{e}{f} = -\int_{x \in \R} |f(x)|^2\ln |f(x)|^2dx$ is the
differential entropy of $f$. This was proved nearly twenty years later
by Beckner~\cite{beckner1975inequalities}.

When the domain $S$ is $\Z_2^n$ (equivalently, $\{-1,1\}^n$) then a
similar inequality holds, but with a different constant. Let $f:\Z_2^n
\to \mathbb C} \newcommand{\Z}{\mathbb Z$ have Fourier transform $\hat{f}:\Z_2^n \to \mathbb C} \newcommand{\Z}{\mathbb Z$. Then
\begin{align*}
  H\Bigg[\frac{f}{||f||}\Bigg]+\Ent{\frac{\hat{f}}{||\hat{f}||}} \geq
  n.
\end{align*}
where $\Ent{f} = -\sum_{x \in \Z_2^n}|f(x)|^2\log_2|f(x)|^2$, and
$\|f\| = \sqrt{\sum_{x \in \Z_2^n}f(x)^2}$. (For a further discussion
on the foregoing inequality, see
Section~\ref{sec:uncertainty-principle}.)

\subsection{Relation to property testing}
\label{sec:property testing}
We note that the problem of testing Booleanity is similar in structure
to a property testing problem. Since its introduction in the seminal
paper by Rubinfeld and Sudan \cite{rubinfeld_sudan1996}, property
testing has been studied extensively, both due to its theoretical
importance, and the wide range of applications it has spanned
(cf.~\cite{goldreich2010,goldreich1996}). In particular, property
testing of functions on the hypercube is an active area of
research~\cite{blais2009,fischer2002,fischer_eldar2002,newman2000}.

A typical formulation of property testing is as follows: Given a fixed
property $P$ and an input $f$, a property tester is an algorithm that
distinguishes with high probability between the case that $f$
satisfies $P$, and the case that $f$ is $\epsilon$-far from satisfying it,
according to some notion of distance.

The algorithm we present for testing Booleanity given oracle access is
similar to a property testing algorithm. However, in our case there is
no proximity parameter: we show that if a function is not Boolean then
it {\it must} be far from Boolean, and can therefore be proved to not
be Boolean by a small number of queries.  This type of property
testing algorithms have appeared in the context of the study of
adaptive versus non-adaptive testers \cite{gonen_ron10}.

\subsection{Discussion and open questions}
\label{sec:discussion}
In this paper we use a discrete entropy uncertainty principle to prove
a combinatorial statement concerning functions on the hypercube.  To
the best of our knowledge, this is the first time this tool has been
used in the context of theoretical computer science, outside of
circuit lower bounds.

We note that Theorem~\ref{thm:bool-is-or-far-from} and
Theorem~\ref{thm:is-or-far-from} are, in a sense, a dual to the {\em
  Schwartz-Zippel} lemma~\cite{zippel1989explicit,schwartz1980fast}:
both limit the number of roots of a polynomial, given that it is
sparse. Given the usefulness of the Schwartz-Zippel lemma, we suspect
that more combinatorial applications can be found for the discrete
uncertainty principle.

For example, Biham, Carmeli and Shamir~\cite{biham2008bug} show that
an RSA decipherer who uses hardware that has been maliciously altered
can be vulnerable to an attack resulting in the revelation of the
private key. The assumption is that the dechiperer is not able to
discover that it is using faulty hardware, because the altered
function returns a faulty output for only a very small number of
inputs. The uncertainty principle shows that such malicious alteration
is impossible to accomplish with succinctly represented functions:
when the Fourier transform of a function is sparse then it is
impossible to ``hide'' elements in its image.

As for the scope of this study, many questions still remains open. In
particular, there is a gap between the lower bound and the upper bound
for testing Booleanity with oracle access; we are disinclined to guess
which of the two is not tight.

A natural extension of our results is to functions with a Fourier
transform $\hat{f}$ that is not restricted to having support of size
$k$, but rather having {\em entropy} $\log k$; the latter is a natural
relaxation of the former. Unfortunately, we have not been able to
generalize our results given this constraint. However, another natural
constraint which does yield a generalization is the requirement that
the entropy of $\hat{f}*\hat{f}$, the convolution of the Fourier
transform with itself, is at most $2\log k$. See
Proposition~\ref{thm:conv-support} for why this is indeed natural.

Two additional amendments are needed to be added for
Theorem~\ref{thm:bool-is-or-far-from} for it to be thus
generalized. First, we require that $|f|^2=2^n$. Next, recall that we
call a function $f$ Boolean if $f^2=1$. We likewise say that $f$ is
$\epsilon$-close to being Boolean if
\begin{align*}
  \sqrt{\frac{1}{2^n}\sum_{x \in \Z_2^n}(f(x)^2-1)^2} \leq \epsilon.
\end{align*}
This is simply the $L_2$ distance of $f^2$ from the constant function
$1$. In the following theorem we do not test for Booleanity, but for
$\epsilon$-closeness to Booleanity.
\begin{theorem}
  \label{conjecture:entropy}
  Let $\Ent{\frac{\hat{f}*\hat{f}}{\|\hat{f}*\hat{f}\|}} \leq 2\log
  k$, and let $\|f\|^2=2^n$. Then $f$ is either $\epsilon$-close to
  Boolean, or satisfies
  \begin{equation*}
    \Psub{x}{f(x) \not \in \{-1,1\}} = \Omega\left(\frac{1}{
        k^{2(\epsilon^2+1)/\epsilon^2}}\right)
  \end{equation*}
  where $\Psub{x}{\cdot}$ denotes the uniform distribution over the
  domain of $f$.
\end{theorem}

We prove this Theorem in Section~\ref{sec:conditional-proof}.

\section{Definitions}
\label{sec:definitions}
The following definitions are mostly standard. We deviate from common
practice by considering both a function and its Fourier transform to
be defined on the same domain, namely $\Z_2^n$. Some readers might
find $\{0,1\}^n$ or $\{-1,1\}^n$ a more familiar domain for a
function, and likewise the power set of $[n]$ a more familiar domain
for its Fourier transform.

Denote $\Z_2=\Z/2\Z$. For $x,y \in \Z_2^n$ we denote by $x+y$ the sum
using the $\Z_2^n$ group operation. The equivalent operation in
$\{-1,1\}^n$ is pointwise multiplication (i.e., $xy = (x_1y_1, \ldots,
x_ny_n)$).

Let $f:\Z_2^n \to \R$. We denote its $L_2$-norm by
\begin{align}
  \label{eq:norm}
  \|f\| = \sqrt{\sum_{x \in \Z_2^n}f(x)^2},
\end{align}
denote its support by
\begin{align}
  \label{eq:support}
  \supp f = \{x \in \Z_2^n \::\: f(x) \neq 0\},
\end{align}
and denote its entropy by
\begin{align}
  \label{eq:entropy}
  \Ent{f} = -\sum_{x \in \Z_2^n}f(x)^2\log f(x)^2,
\end{align}
where logarithms are base two and $0\log 0 = 0$, by the usual
convention in this case. We remark that for the simplicity of the
presentation, we define norms and convolutions using summation rather
than expectation.

We call a function $f:\Z_2^n \to \R$ {\em Boolean} if its image is in
$\{-1,1\}$, i.e., if $f(x) \in \{-1,1\}$ for all $x \in \Z_2^n$.

Let $\hat{f}:\Z_2^n \to \R$ denote the {\em discrete Fourier
  transform} (also known as the {\em Walsh-Fourier transform} and {\em
  Hadamard transform}) of $f$, or its representation as a multilinear
polynomial:
\begin{align}
  \label{eq:fourier}
  \hat{f}(x) = \frac{1}{2^n}\sum_{y \in \Z_2^n}f(y)\chi_y(x),
\end{align}
where the characters $\chi_y$ are defined by
\begin{align*}
  \chi_y(x) =
  \begin{cases}
    -1 & \sum_{i:y_i=1}x_i = 1\\
    1 & \mbox{otherwise}
  \end{cases}.
\end{align*}
Note that the sum $\sum_{i:y_i=1}x_i$ is over $\Z_2$ and that
$x_i,y_i$ are (respectively) the $i$'th coordinate of $x$ and $y$.  It
follows that the {\em discrete Fourier expansion} of $f$ is
\begin{align}
  \label{eq:inv-fourier}
  f(x) = \sum_{y \in \Z_2^n}\hat{f}(y)\chi_y(x).
\end{align}
Note that this is a representation of $f$ as a multilinear polynomial.
Hence $f:\Z_2^n \to \R$ is $k$-sparse if $|\supp \hat{f}| \leq k$.

We define $\delta : \Z_2^n \to \R$ by
\begin{align*}
  \delta(x) =
  \begin{cases}
    1& \mbox{when } x = (0,\ldots,0)\\
    0& \mbox{otherwise}
  \end{cases}.
\end{align*}
If we denote by ${\bf 1}(x): \Z_2^n \to \R$ the constant function such
that ${\bf 1}(x)=1$ for all $x \in \Z_2^n$, then it is easy to verify
that
\begin{align}
  \label{eq:delta-transform}
  \hat{\bf 1}=\delta.
\end{align}

Given functions $f,g : \Z_2^n \to \R$, their {\em convolution} $f * g$
is also a function from $\Z_2^n$ to $\R$, defined by
\begin{align}
  \label{eq:convolution}
  [f*g](x) = \sum_{y \in \Z_2^n}f(y)g(x+y).
\end{align}
We denote
\begin{align*}
  f^{(2)} = f * f,
\end{align*}
and more generally $f^{(k)}$ is the convolution of $f$ with itself $k$
times. $f^{(0)}$ is taken to equal $\delta$, since $f * \delta = f$.

\section{Proofs}
\label{sec:results}
\subsection{The Fourier transform of Boolean functions}

The convolution theorem (see.,
e.g.,~\cite{katznelson2004introduction}) for $\Z_2^n$ states that, up
to multiplication by a constant, the Fourier transform of the
pointwise multiplication of two functions is equal to the convolution
of their Fourier transforms, and that likewise the Fourier transform
of a convolution is the product of the Fourier transforms (again up to
a constant):
\begin{align}
  \label{eq:convolutions}
  \widehat{f \cdot g} = \hat{f} *
  \hat{g},\quad\quad\mbox{and}\quad\quad \widehat{f * g} = 2^n\hat{f}
  \cdot \hat{g}.
\end{align}
The correctness of the constants can be verified by, for example,
setting $f=g={\bf 1}$. The following proposition follows from
Eqs.~\ref{eq:delta-transform} and~\ref{eq:convolutions}.

\begin{proposition}
  \label{thm:boolean-fourier}
  $f :\Z_2^n \to \R$ is Boolean iff $\hat{f}*\hat{f}=\delta$.
\end{proposition}

\subsection{The discrete uncertainty principle}
\label{sec:uncertainty-principle}

The discrete uncertainty principle for $\Z_2^n$ is the following. It
is a straightforward consequence of Theorem 23 in Dembo, Cover and
Thomas~\cite{dembo1991information}; we provide the proof for
completeness, since it does not seem to have previously appeared in
the literature.
\begin{theorem}
  \label{thm:uncertainty}
  For any non-zero function $f:\Z_2^n \to \R$ (i.e., $\|f\| > 0$) it
  holds that
  \begin{align}
    \label{eq:uncertainty}
    H\Bigg[\frac{f}{||f||}\Bigg]+\Ent{\frac{\hat{f}}{||\hat{f}||}}
    \geq n.
  \end{align}
\end{theorem}
\begin{proof}
  Let $U$ be a unitary $n$ by $n$ matrix such that
  $\max_{ij}|u_{ij}|=M$. Let $x \in \mathbb C} \newcommand{\Z}{\mathbb Z^n$ be such that $\|x\|>0$. Then
  Theorem 23 in Dembo, Cover and Thomas~\cite{dembo1991information}
  states that
  \begin{align*}
    \Ent{\frac{x}{\|x\|}} + \Ent{\frac{Ux}{\|Ux\|}} \geq 2 \log(1/M),
  \end{align*}
  where for $x \in \mathbb C} \newcommand{\Z}{\mathbb Z^n$ we define $\Ent{x} = -\sum_{i \in
    [n]}|x_i|^2\log |x_i|^2$.

  Let $F$ be the matrix representing the Fourier transform operator on
  $\Z_2^n$. Note that by our definition in Eq.~\ref{eq:fourier}, the
  transform operator $F$ is not unitary. However, if we multiply it by
  $\sqrt{2^n}$ (i.e., normalize the characters $\chi_y$) then it
  becomes unitary. The normalized matrix elements (which are equal to
  the elements of the normalized characters $\chi_y$), are all equal
  to $\pm 1/\sqrt{2^n}$. Hence $M = 1/\sqrt{2^n}$, and
  \begin{align*}
    \Ent{\frac{f}{\|f\|}}+\Ent{\frac{Ff}{\|Ff\|}} \geq 2 \log(1/M) =
    n.
  \end{align*}
\end{proof}

A distribution supported on a set of size $k$ has entropy at most
$\log k$, as can be shown by calculating its Kullback-Leibler
divergence from the uniform distribution (see,
e.g.,~\cite{cover1991elements}). Hence any distribution with entropy
$\log k$ has support of size at least $k$. This fact, together with
the discrete uncertainty principle, yields a proof of the following
claim (see Matolcsi~and~Szucs~\cite{matolcsi1973intersections} or
O'Donnell~\cite{odonnell12analysis} for an alternative proof of
Eq.~\ref{eq:support-uncertainty}.)

\begin{claim}
  \label{thm:support-uncertainty}
  For any non-zero function $f:\Z_2^n \to \R$ (i.e., $\|f\| > 0$) it
  holds that
  \begin{align}
    \label{eq:support-uncertainty}
    |\supp f| \cdot |\supp \hat{f}| \geq 2^n
  \end{align}
  and
  \begin{align}
    \label{eq:support-ent-uncertainty}
    |\supp f| \cdot 2^{\Ent{\hat{f}/ \|\hat{f}\|}} \geq 2^n.
  \end{align}
\end{claim}
\begin{proof}
  By Theorem~\ref{thm:uncertainty} we have that
  \begin{align*}
    \Ent{\frac{f}{||f||}}+\Ent{\frac{\hat{f}}{||\hat{f}||}} \geq n.
  \end{align*}
  Since $\log |\supp(f)| = \log |\supp(f/||f||)| \geq \Ent{f/||f||}$
  then
  \begin{align*}
    |\supp f |\cdot 2^{\Ent{\hat{f}/ \|\hat{f}\|}} \geq 2^n
  \end{align*}
  and likewise
  \begin{align*}
    |\supp f |\cdot|\supp \hat{f} | \geq 2^n.
  \end{align*}
\end{proof}

We note that for the proof of Theorem~\ref{thm:is-or-far-from} we rely
on Claim~\ref{thm:support-uncertainty}, whereas for the more general
Theorem~\ref{conjecture:entropy}, using
Claim~\ref{thm:support-uncertainty} does not suffices and we must use
(the stronger) Theorem~\ref{thm:uncertainty}.

\subsection{Testing Booleanity given oracle access}
We begin by proving the following standard proposition, which relates
the support of functions $f$ and $g$ with the support of their
convolution.
\begin{proposition}
  \label{thm:conv-support}
  Let $g,f :\Z_2^n \to \R$.  Then
  \begin{align*}
    \supp (f*g) \subseteq \supp f + \supp g.
  \end{align*}
\end{proposition}
Here $\supp f + \supp g$ is the set of elements of $\Z_2^n$ that can
be written as the sum of an element in $\supp f$ and an element in
$\supp g$.
\begin{proof}
  Let $x \in \supp (f * g)$. Then, from the definition of convolution,
  there exist $y$ and $z$ such that $f(y) \neq 0$, $g(z) \neq 0$ and
  $x=y+z$. Hence $x \in \supp f + \supp g$.
\end{proof}

We consider a $k$-sparse function $f$ to which we are given oracle
access. We are asked to determine if it is Boolean, or more generally
if its image is in some small set $D$. We here think of $k$ as being
small - say polynomial in $n$.

We first prove the following combinatorial result:
\begin{theorem*}[\ref{thm:is-or-far-from}]
  Let $D \subset \R$ be a set with $d$ elements. Then for any
  $k$-sparse $f$ one of the following holds.
  \begin{itemize}
  \item Either $\Psub{x}{f(x) \in D} = 1$,
  \item or $\Psub{x}{f(x) \not \in D} \geq \frac{d!}{(k+d)^d}$,
  \end{itemize}
  where $\Psub{x}{\cdot}$ denotes the uniform distribution over the
  domain of $f$.
\end{theorem*}
\begin{proof}
  Let $D=\{y_1,\ldots,y_d\}$.  Denote
  \begin{align*}
    g = \prod_{i=1}^d(f-y_i),
  \end{align*}
  so that $g(x) = 0$ iff $f(x) \in D$. Then
  \begin{align*}
    \hat{g} &=
    \left(\hat{f}-y_1\delta\right)*\cdots*\left(\hat{f}-y_d\delta\right)
    = \hat{f}^{(d)}+a_{d-1}\hat{f}^{(d-1)}+ \cdots
    a_1\hat{f}+a_0\delta,
  \end{align*}
  for some coefficients $a_0,\ldots,a_{d-1}$. Therefore
  \begin{align*}
    \supp \hat{g} \subseteq \bigcup_{i=1}^d\supp \hat{f}^{(i)}
    \cup\{0\}.
  \end{align*}
  We show that $|\supp \hat{g}| \leq (k+d)^d/d!$. Let $A = \supp
  \hat{f} \cup \{0\}$. Then by Proposition~\ref{thm:conv-support}
  $\supp \hat{f}^{(i)}$ is a subset of $iA = A+\cdots+A$, where the
  sum is taken $i$ times; this is the set of elements in $\Z_2^n$ that
  can be written as a sum of $i$ elements of $A$. Hence
  \begin{align*}
    \supp \hat{g} \subseteq A \cup 2A \cup \cdots \cup dA.
  \end{align*}
  Since $0 \in A$, then for all $i \leq d$ we have that $iA \subseteq
  dA$. Hence
  \begin{align*}
    \supp \hat{g} \subseteq dA.
  \end{align*}
  Therefore $\supp \hat{g}$ is a subset of the set of elements that
  can be written as the sum of at most $d$ elements of $A$. This
  number is bounded by the number of ways to choose $d$ elements of
  $A$ with replacement, disregarding order. Hence
  \begin{align}
    \label{eq:supp-g}
    |\supp \hat{g}| \leq \binom{|A|-1+d}{d} \leq \frac{(k+d)^d}{d!},
  \end{align}
  since $|A| \leq |\supp \hat{f}| + 1=k+1$.

  Now, if $f(x) \in D$ for all $x \in \Z_2^n$, then clearly
  $\Psub{x}{f(x) \in D} = 1$. Otherwise, $g(x)$ is different than zero
  for some $x$, and so $\|g\| > 0$. Hence we can apply
  Claim~\ref{thm:support-uncertainty} and
  \begin{align*}
    |\supp g| \cdot |\supp \hat{g}| \geq 2^n.
  \end{align*}
  By Eq.~\ref{eq:supp-g} this implies that
  \begin{align*}
    |\supp g| \geq \frac{2^nd!}{(k+d)^d}.
  \end{align*}
  Since the support of $g$ is precisely the set of $x \in \Z_2^n$ for
  which $f(x) \notin D$ then it follows that
  \begin{align*}
    \Psub{x}{f(x) \not \in D} \geq \frac{d!}{(k+d)^d}.
  \end{align*}
\end{proof}

A consequence is that a function that is not Boolean (i.e., the case
$D=\{-1,1\}$) is not Boolean over a fraction of at least $2/(k+2)^2$
of its domain.  Theorem~\ref{thm:k-algo} is a direct consequence of
this result: assuming oracle access to $f$ (i.e., $O(1)$ time random
sampling), the algorithm samples $f$ at random ${\textstyle \frac12}
(k+2)^2\ln(1/\epsilon)$ times, and therefore will discover an $x$ such
that $f(x) \not \in \{-1,1\}$ with probability at least $1-\epsilon$ -
unless $f$ is Boolean.

While we were not able to show a tight lower bound, we show that any
algorithm would require at least $\Omega(k)$ queries to perform this
task (even when two-sided error is allowed).

\begin{theorem*}[\ref{thm:k-lower-bound}]
  Let $A$ be a randomized algorithm that, given $k$ and oracle access
  to a $k$-sparse function $f$,
  \begin{itemize}
  \item returns {\em true} with probability at least $2/3$ if $f$ is
    Boolean, and
  \item returns {\em false} with probability at least $2/3$ if $f$ is
    not Boolean.
  \end{itemize}
  Then $A$ has query complexity $\Omega(k)$.
\end{theorem*}

\begin{proof}[Proof of Theorem~\ref{thm:k-lower-bound}]
  Let $A$ be an algorithm that is given oracle access to a function
  $f:\Z_2^n \to \R$, together with the guarantee that $\supp \hat{f}
  \leq k$. When $f$ is Boolean then $A$ returns ``true''. When $f$ is
  not Boolean then $f$ returns ``false'' with probability at least
  $2/3$. We show that $A$ makes $\Omega(k)$ queries to $f$.

  Denote by $B_k$ the set of Boolean functions that depend only on the
  first $\log k$ coordinates. Denote by $C_k$ the set of functions
  that likewise depend only on the first $\log k$ coordinates, return
  values in $\{-1,1\}$ for some $k-1$ of the $k$ possible values of
  the first $\log k$ coordinates, but otherwise return $2$. Note that
  functions in both $B_k$ and $C_k$ have Fourier transforms of support
  of size at most $k$.

  We prove the lower bound on the query complexity of the randomized
  algorithm by showing two distributions, a distribution of Boolean
  functions and a distribution of non-Boolean functions, which are
  indistinguishable to any algorithm that makes a small number of
  queries to the input.  That is, we present two distributions: one
  for which the algorithm should return ``false'' (denoted by
  $\mathcal{D}_0$) and another for which the algorithm should return
  ``true'' (denoted by $\mathcal{D}_1$). We prove that any randomized
  algorithm which performs at most $o(k)$ queries would not be able to
  distinguish between the two distributions with non-negligible
  probability. This proves the claim.

  Let $\mathcal{D}_1$ be the uniform distribution over $B_k$, and let
  $\mathcal{D}_0$ be the uniform distribution over $C_k$.  Observe
  that an arbitrary query to $f$ in either distribution would output a
  non-Boolean value with probability at most $1/k$, independently of
  previous queries with different values of the first $\log k$
  coordinates. Therefore any algorithm that performs $o(k)$ queries
  would find an input for which $f(x)=2$ with probability $o(1)$, and
  would therefore be unable to distinguish between $\mathcal{D}_0$ and
  $\mathcal{D}_1$ with noticeable probability.
\end{proof}

\subsection{Proof of Theorem~\ref{conjecture:entropy}}
\label{sec:conditional-proof}
Recall the statement of Theorem~\ref{conjecture:entropy}.

\begin{theorem*}[\ref{conjecture:entropy}]
  Let $\Ent{\frac{\hat{f}*\hat{f}}{\|\hat{f}*\hat{f}\|}} \leq 2\log
  k$, and let $\|f\|^2=2^n$. Then $f$ is either $\epsilon$-close to
  Boolean, or satisfies
  \begin{equation*}
    \Psub{x}{f(x) \not \in \{-1,1\}} = \Omega\left(\frac{1}{
        k^{2(\epsilon^2+1)/\epsilon^2}}\right)
  \end{equation*}
  where $\Psub{x}{\cdot}$ denotes the uniform distribution over the
  domain of $f$.
\end{theorem*}

We begin by proving a preliminary proposition.
\begin{proposition}
  \label{thm:H-H}
  Let $X$ be a discrete random variable, and let $x_0$ be a value that
  $X$ takes with positive probability. Then
  \begin{align*}
    H(X|X \neq x_0) \leq \frac{H(X)}{\P{X \neq x_0}}.
  \end{align*}
\end{proposition}
\begin{proof}
  Let $A$ be the indicator of the event $X=x_0$. Then
  \begin{align*}
    H(X) & \geq H(X|A) \\ &= \P{X=x_0}H(X|X=x_0) + \P{X\neq x_0}H(X|X
    \neq x_0)\\ &= \P{X\neq x_0}H(X|X \neq x_0),
  \end{align*}
  since $H(X|X=x_0)=0$.
\end{proof}
\begin{proof}[Proof of Theorem~\ref{conjecture:entropy}]
  Assume that $f$ is $\epsilon$-far from being Boolean. Observe that
  \begin{align}
    \label{eq:conv-eps}
    \|\hat{f}^{(2)}\|^2 = \frac{1}{2^n}\|f^2\|^2 =
    \frac{1}{2^n}\sum_{x \in \Z_2^n}f(x)^4 = \frac{1}{2^n}\sum_{x \in
      \Z_2^n}(f(x)^2-1)^2 + 1 \ge 1+\epsilon^2,
  \end{align}
  where the equality before last follows from the fact that
  $\|f\|^2=2^n$.

  Let $X$ be a $\Z_2^n$-valued random variable such that $\P{X=x}=
  \hat{f}^{(2)}(x)^2/\|\hat{f}^{(2)}\|^2$.  Since $f$ is normalized,
  then $\hat{f}^{(2)}(0)=1$. Furthermore,
  \begin{align*}
    \P{X \neq 0} = 1-\P{X = 0} =
    1-\frac{\hat{f}^{(2)}(0)^2}{\|\hat{f}^{(2)}\|^2} \ge
    \frac{\epsilon^2}{\epsilon^2+1},
  \end{align*}
  since $\hat{f}^{(2)}(0)=1$, and by Eq.~\ref{eq:conv-eps}.

  Let $g=f^2-1$. Then $\hat{g} = \hat{f}^{(2)}-\delta$, $\hat{g}(0) =
  0$, and $\P{X=x|X \neq 0}=\hat{g}(x)^2/\|\hat{g}\|^2$. Hence by
  Proposition~\ref{thm:H-H} it follows that
  \begin{align*}
    \Ent{\frac{\hat{g}}{\|\hat{g}\|}} \leq
    \Ent{\frac{\hat{f}^{(2)}}{\|\hat{f}^{(2)}\|^2}} \cdot
    \frac{\epsilon^2+1}{\epsilon^2} \leq 2 \frac{\epsilon^2+1}{\epsilon^2}\log k,
  \end{align*}
  where the second inequality follows from the proposition hypothesis
  that
  \begin{equation*}
    \Ent{\frac{\hat{f}*\hat{f}}{\|\hat{f}*\hat{f}\|}} \leq 2\log k.
  \end{equation*}

  By Claim~\ref{thm:support-uncertainty} it follows that
  \begin{equation*}
    |\supp
    g| \cdot 2^{\Ent{\hat{g}/\|\hat{g}\|}} \geq 2^n.
  \end{equation*}
  Hence $|\supp (f^2-1)| \cdot k^{2(\epsilon^2+1)/\epsilon} \geq 2^n$, from
  which the proposition\ follows directly, since
  \begin{equation*}
    \Psub{x}{f(x) \not
      \in \{-1,1\}} = \frac{|\supp (f^2-1)|}{2^n}.
  \end{equation*}
\end{proof}

\section{Acknowledgments}
The authors would like to thank Elchanan Mossel for a helpful initial
discussion of the problem and for suggesting the application to
property testing. We would like to thank Adi Shamir for suggesting the
relevance to cryptography, and we would like to thank Oded Goldreich
for discussions regarding the relevance to property testing.  Last, we
would like to thank the anonymous referees for the helpful comments
that allowed us to improve the presentation of the results.

\bibliographystyle{abbrv}

Discrete Mathematics (cs.DM); Computational Complexity (cs.CC); Data Structures and Algorithms (cs.DS)