Discontinuities of a function whose graph is invariant under rotation by 90 degrees
Prove that there is no function on open interval $(-1,1)$, which has only finite number of discontinuity point, such that its graph is invariant under rotation by the right angle around the origin.
Let $f:(-1,1)\to\mathbb{R}$ be a function such that its graph is invariant under rotation by the right angle around the origin. It implies that if $(x,y)$ is the graph, then $(y,-x)$ is also in the graph, i.e. if $x\in(-1,1)$ and $y=f(x)$, then $y\in(-1,1)$ and $-x=f(y)$. It follows that $f$ maps $(-1,1)$ to itself, and $$f^{\circ 2}(x)=-x,\quad\forall x\in(-1,1).\tag{1}$$ From $(1)$ we know that $f$ must be bijective on $(-1,1)$, i.e. $f$ is $1$ to $1$ and onto. Therefore, $f$ cannot be continuous on $(-1,1)$, because if $f$ is continuous and injective on $(-1,1)$, $f$ must be monotone on $(-1,1)$, and hence $f^{\circ 2}$ must be increasing, contradicting to $(1)$.
Now suppose that $f$ has finitely many discontinuity points, which are $a_1<a_2<\dots<a_n$. Denote $I_i=(a_i,a_{i+1})$, $0\le i\le n$, where $a_0=-1$ and $a_{n+1}=1$. Moreover, denote $C=\cup_{i=0}^n I_i$, the collection of continuity points of $f$, and $D=\{a_i:1\le i\le n\}$, the collection of discontinuity points of $f$.
Since for each open interval $I_i$, $f$ is continuous and injective on $I_i$, $f(I_i)$ is also an open interval, and $f$ has a continuous inverse $g_i:f(I_i)\to I_i$. Since on $f(I_i)$, $f= f\circ f\circ g_i=-g_i$, $f$ is continuous on $f(I_i)$. That is to say, $f$ maps continuity points to continuity points. Combining this fact with $f$ being bijective, we have $$f(C)=C \quad\text{and}\quad f(D)=D.\tag{2}$$
In particular, for every $0\le i\le n$, there exists $0\le j\le n$, such that $f(I_i)\subset I_j$. Since $I_j\subset C$ and $C=\cup_kf(I_k)$, we know that $I_j=\cup_k(f(I_k)\cap I_j)$. Then by the connectedness of $I_j$, in fact $f(I_i)=I_j$. As a result, $f$ defines a permutation on $\mathcal{I}:=\{I_i:0\le i\le n\}$. Note that $f^{\circ 2 }(I_i)=-I_i$, so there are two cases. First, if $I_i\ne -I_i$, i.e. $0\notin I_i$, then $f^{\circ k}(I_i)$ are pairwise different, $k=0,1,2,3$. Second, if $I_i=-I_i$, i.e. $0\in I_i$, then $f(I_i)=I_i$, because
$$f(I_i)=f(-I_i)=f^{\circ 3}(I_i)=f^{\circ 2}(f(I_i))=-f(I_i)\Rightarrow 0\in f(I_i)\Rightarrow I_i=f(I_i).$$
However, the second case cannot happen, and the reason is the same as in the first paragragh: if $f:I_i\to I_i$ is injective and continuous, then $f^{\circ 2}$ must be increasing. Finally, we can conclude that: (i) $0$ is a discontinuity point, and (ii), $\mathcal{I}$ is a disjoint union of the $f$-orbits, and each orbit is of length $4$, i.e.
$$ n+1=\#\mathcal{I}\equiv 0 \mod 4.\tag{3}$$
A similar argument can be applied to $f:D\to D$. For each $a_i\in D$, if $a_i\ne 0$, then $f^{\circ k}(a_i)$ are pairwise different, $k=0,1,2,3$; if $a_i=0$, then $f(a_i)=a_i$. Since $0\in D$, we can also conclude that $$n=\# D\equiv 1 \mod 4.\tag{4}$$
The contradiction between $(3)$ and $(4)$ completes the proof.