By [3, Theorem 1], a real-valued function on a real analytic manifold of dimension at least 3 is analytic whenever all its restrictions to analytic submanifolds homeomorphic to the unit 2-sphere are analytic. In the present note, we prove a variant of this result for functions defined on nonsingular real algebraic sets. Henceforth, we abbreviate real analytic to analytic. Besides analytic functions, we also consider Nash functions. We refer to [1] for the general theory of the latter class of functions.

Unless explicitly stated otherwise, all subsets of \(\mathbb {R}^n\) are endowed with the Euclidean topology, induced by the standard norm.

Recall that \(M \subset \mathbb {R}^m\) is a Nash manifold if it is a semialgebraic subset and an analytic submanifold (in particular, M is a closed subset of some open subset of \(\mathbb {R}^m\)). A function \(f :M \rightarrow \mathbb {R}\) is called a Nash function if it is analytic and its graph is semialgebraic. Equivalently, f is a Nash function if and only if it is analytic and there is a relation

$$\begin{aligned} \displaystyle \sum _{i=0}^k \varphi _i(x) f(x)^{k-i}=0 \text { for all } x \in M, \end{aligned}$$

where \(k \ge 1\) and the \(\varphi _i :\mathbb {R}^m \rightarrow \mathbb {R}\) are polynomial functions, with \(\varphi _0\) not identically 0 on any connected component of M. For this reason, Nash functions are called algebraic functions in the older literature, see for example [5].

Let \(X \subset \mathbb {R}^m\) be an irreducible nonsingular algebraic set of dimension \(n \ge 0\). We define d(X) to be the supremum of the number of points in the intersection \( X \cap L\), where L runs through the family of all affine \((m-n)\)-planes in \(\mathbb {R}^m\) that are transverse to X. Clearly, d(X) is a positive integer, see [11, Theorem 11.5.3]. Given an integer k with \(1 \le k\le n-1\), we denote by \(\mathcal {F}_k(X)\) the collection of all nonsingular algebraic subsets \(Z \subset X\) having at most d(X) connected components, each of which is homeomorphic to the unit k-sphere \(\mathbb {S}^k\). In what follows, we only make use of \(\mathcal {F}_k(X)\) with \(k=1\) and \(k=2\).

FormalPara Theorem 1

Let \(f :X \rightarrow \mathbb {R}\) be a function defined on an irreducible nonsingular algebraic set \(X \subset \mathbb {R}^m\) of dimension \(n \ge 3\). Assume that the restriction \(f|_{S}\) is an analytic (resp. a Nash) function for every algebraic surface \(S \in \mathcal {F}_2(X)\). Then f is an analytic (resp. a Nash) function.

The proof of Theorem 1 requires some preparation. Along the way, we establish results which are of independent interest. We emphasize that the function f in Theorem 1 is not assumed to be continuous.

Let \(\mathbb {B}^n\) be the open unit ball in \(\mathbb {R}^n\). For any integer k with \(1 \le k \le n-1\), we denote by \(\mathcal {E}_k(\mathbb {B}^n)\) the collection of all Euclidean k-spheres in \(\mathbb {B}^n\) passing through the origin, that is, all algebraic sets \(\Sigma ^k \subset \mathbb {R}^n\) of the form

$$\begin{aligned} \Sigma ^k = \{ x \in \mathbb {R}^n :\Vert x-c\Vert = \Vert c\Vert \} \cap V, \end{aligned}$$

where \(c \in \mathbb {R}^n, 0< \Vert c\Vert < \frac{1}{2}, \) and \(V \subset \mathbb {R}^n\) is a vector subspace of dimension \(k+1\). In our results only \(\mathcal {E}_k(\mathbb {B}^n)\) with \(k=1\) and \(k=2\) are relevant.

FormalPara Theorem 2

Let \(f :\mathbb {B}^n \rightarrow \mathbb {R}\) be a function defined on the open unit ball \(\mathbb {B}^n \subset \mathbb {R}^n.\) Assume that \(n \ge 3\) and the restriction \(f|_{\Sigma ^2}\) is an analytic (resp. a Nash) function for every Euclidean 2-sphere \(\Sigma ^2 \in \mathcal {E}_2(\mathbb {B}^n)\). Then f is an analytic (resp. a Nash) function.

The analytic case in Theorem 2 is already settled in [3, Theorem 2]. It plays the key role in the proof of the Nash case.

The inversion

$$\begin{aligned} \mu : \mathbb {R}^n \setminus \{ 0 \} \rightarrow \mathbb {R}^n \setminus \{0\},\ \mu (x) = \frac{x}{\Vert x\Vert ^2}, \end{aligned}$$

is a biregular isomorphism. It maps \(\mathbb {B}^n \setminus \{0\}\) onto the complement \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\) of the closed unit ball \(\overline{\mathbb {B}}^n\) and gives a one-to-one correspondence between the Euclidean k-spheres in \(\mathcal {E}_k(\mathbb {B}^n)\) and the affine k-planes contained in \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\).

FormalPara Proof of Theorem 2

As indicated above, we may assume that f is an analytic function and the restriction \(f|_{\Sigma ^2}\) is a Nash function for every Euclidean 2-sphere \(\Sigma ^2 \in \mathcal {E}_k(\mathbb {B}^n)\). Hence the function

$$\begin{aligned} g := f \circ (\mu |_{\mathbb {R}^n \setminus \overline{\mathbb {B}}^n}) :\mathbb {R}^n \setminus \overline{\mathbb {B}}^n \rightarrow \mathbb {R} \end{aligned}$$

is analytic and its restriction to any affine 2-plane contained in \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\) is a Nash function. Evidently, the restriction of g to any affine line contained in \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\) is a Nash function. It follows from [2, Theorem 2.4] that g is a Nash function on \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\), and therefore so is f on \(\mathbb {B}^n\). \(\square \)

FormalPara Proposition 3

Let \(X \subset \mathbb {R}^m\) be an irreducible nonsingular real algebraic set of dimension \(n \ge 1\), and let p be a point in X. Then there exists a linear map \(\lambda :\mathbb {R}^m \rightarrow \mathbb {R}^n\) for which the following hold:

  1. (i)

    The restriction \(\lambda |_{X} :X \rightarrow \mathbb {R}^n\) is a proper map with finite fibers (some fibers may be empty).

  2. (ii)

    The map \(\lambda |_{X}\) is transverse to \(\lambda (p)\).

FormalPara Proof

Let \(Y := X- p\) be the translate of X. For each linear map \(\alpha :\mathbb {R}^m \rightarrow \mathbb {R}^n\), the restriction \(\alpha |_{Y} :Y \rightarrow \mathbb {R}^n\) induces a homomorphism of the coordinate rings (=rings of polynomial functions)

$$\begin{aligned} (\alpha |_{Y})^{*} :A(\mathbb {R}^n) \rightarrow A(Y). \end{aligned}$$

Let L(mn) be the space of all linear maps from \(\mathbb {R}^m\) to \(\mathbb {R}^n\), which we identify with the space M(nm) of all n-by-m matrices with real entries. By a suitable version of the Noether normalization theorem, see [6, Theorem 13.3] and its proof, there is a nonempty Zariski open subset \(\Omega \subset L(m,n)\) such that for each \(\beta \in \Omega \), the homomorphism \((\beta |_{Y})^{*}\) is injective and the ring A(Y) is integral over \(A(\mathbb {R}^n) \cong \text {Im}(\beta |_{Y})^{*}\) (equivalently, A(Y) is a finitely generated \(A(\mathbb {R}^n)\)-module). It follows that \(\beta \) is surjective and the restriction \(\beta |_{Y}\) is a proper map with finite fibers. Now we choose a linear map \(\gamma \in \Omega \) such that the derivative of \(\varphi : = \gamma |_{Y} :Y \rightarrow \mathbb {R}^n\) at the origin \(0 \in Y\) is an isomorphism. After a coordinate change, we may assume that \(\gamma \) is the canonical projection \(\mathbb {R}^m = \mathbb {R}^n \times \mathbb {R}^{m-n} \rightarrow \mathbb {R}^n\).

For any constant \(\varepsilon >0\), we set

$$\begin{aligned} M_{\varepsilon } := \{ t = (t_{ij}) \in M(n,m) : |t_{ij}| < \varepsilon \text { for } 1 \le i \le n, 1 \le j \le m \} \end{aligned}$$

and consider the map \(\Phi :Y \times M_{\varepsilon } \rightarrow \mathbb {R}^n\) defined by

$$\begin{aligned} \Phi (x,t) = (x_1 + \displaystyle \sum _{j=1}^m t_{1j}x_j, \cdots , x_n + \displaystyle \sum _{j=1}^m t_{nj}x_j) \end{aligned}$$

where \(x=(x_1, \cdots , x_m) \in Y\) and \(t=(t_{ij}) \in M_{\varepsilon }\). If \(\varepsilon \) is sufficiently small, then \(\Phi \) is a submersion since for each point \(x \ne 0\), the restriction of \(\Phi \) to \(\{x\} \times M_{\varepsilon }\) is a submersion, and \(\varphi \) is a submersion at the origin \(0 \in Y\). Hence, according to the standard consequence of Sard’s theorem [7, p. 79, Theorem 2.7], the map \(\Phi _t :Y \rightarrow \mathbb {R}^n, \Phi _t(x) = \Phi (x,t)\), is transverse to the origin \(0 \in \mathbb {R}^n\) for some \(t \in M_{\varepsilon }\). There is a linear map \(\lambda \in L(m,n)\) with \(\lambda |_{Y} = \Phi _t\). If \(\varepsilon \) is small, then \(\lambda \) belongs to \(\Omega \) and has the required properties. \(\square \)

FormalPara Proof of Theorem 1

Let p be a point in X and let \(\lambda :\mathbb {R}^m \rightarrow \mathbb {R}^n\) be a linear map as in Proposition 3. We can choose a constant \(r >0\) such that

$$\begin{aligned} (\lambda |_{X})^{-1}(B(\lambda (p),r)) = U_1 \cup \cdots \cup U_l, \end{aligned}$$

where \(B(\lambda (p),r) \subset \mathbb {R}^n\) is the open ball centered at \(\lambda (p)\) with radius r, the \(U_i\) are pairwise disjoint open subsets of X, \(\lambda |_{U_i} :U_i \rightarrow B(\lambda (p),r)\) are Nash isomorphisms, and \(p \in U_1\). Clearly, \(l \le d(X)\). Define the map \(\pi :X \rightarrow \mathbb {R}^n\) by

$$\begin{aligned} \pi (x) = \frac{1}{r} (\lambda (x) - \lambda (p)) \text { for } x \in X. \end{aligned}$$

Then

$$\begin{aligned} \pi ^{-1}(\mathbb {B}^n) = U_1 \cup \cdots \cup U_l \end{aligned}$$

and the restriction \(\pi |_{U_i} :U_i \rightarrow \mathbb {B}^n\) is a Nash isomorphism for \(i =1 , \cdots , l\).

If \(\Sigma ^2 \in \mathcal {E}_2(\mathbb {B}^n)\), then \(S(\Sigma ^2) : = \pi ^{-1} (\Sigma ^2) \in \mathcal {F}_2(X).\) Assume that for every \(\Sigma ^2 \in \mathcal {E}_2(\mathbb {B}^n)\), the restriction \(f|_{S(\Sigma ^2)}\) is an analytic (resp. a Nash) function. Then, by Theorem 2, the composite \(f \circ (\pi |_{U_1})^{-1} :\mathbb {B}^n \rightarrow \mathbb {R}\) is an analytic (resp. a Nash) function. It follows that f is an analytic (resp. a Nash) function, the point \(p \in X\) being arbitrary. \(\square \)

Making use of local coordinate charts and applying Theorem 2, we immediately obtain the following.

FormalPara Theorem 4

Let \(f :M \rightarrow \mathbb {R}\) be a function defined on an analytic (resp. a Nash) manifold M of dimension \(n \ge 3\). Assume that the restriction \(f|_{N}\) is an analytic (resp. a Nash) function for every analytic (resp. Nash) submanifold \(N \subset M\) homeomorphic to \(\mathbb {S}^2\). Then f is an analytic (resp. a Nash) function.

The analytic case in Theorem 4 is contained in [3, Theorem 1].

Replacing in Theorem 1 (resp. Theorem 2) \(\mathcal {F}_2(X)\) by \(\mathcal {F}_1(X)\) (resp. \(\mathcal {E}_2(\mathbb {B}^n)\) by \(\mathcal {E}_1(\mathbb {B}^n)\)), one would get a false statement.

FormalPara Counterexample 5

Let \(f :\mathbb {R}^3 \rightarrow \mathbb {R}\) be the function defined by

$$\begin{aligned}f(x,y,z)= {\left\{ \begin{array}{ll} \frac{x^8 + y(x^2-y^3)^2 + z^4}{x^{10}+(x^2-y^3)^2 + z^2}&{} \text { for } (x,y,z) \ne (0,0,0), \\ 0&{} \text { for } (x,y,z)=(0,0,0). \end{array}\right. } \end{aligned}$$

Then the restriction of f is an analytic (resp. a Nash) function on each nonsingular analytic (resp. Nash) curve in \(\mathbb {R}^3\), but f is not even continuous at (0, 0, 0).

To establish the first part of the assertion, it suffices to prove that for any nonsingular analytic curve \(C \subset \mathbb {R}^3\) passing through (0, 0, 0), the restriction \(f|_{C}\) is analytic at (0, 0, 0). Since C is nonsingular, it has near (0, 0, 0) a local analytic parametrization

$$\begin{aligned} x=x(t),\ y=y(t),\ z=z(t) \text { for }t\text { near } 0 \in \mathbb {R}, \end{aligned}$$

where \(x(0)=y(0)=z(0)=0\), and at least one of the analytic functions x(t), y(t), z(t) has a zero of order 1 at \(t=0\). It is not hard to check that the function f(x(t), y(t), z(t)) is analytic for t near \(0 \in \mathbb {R}\). Thus \(f|_{C}\) is analytic at (0, 0, 0), as required.

Clearly, the function f is not continuous at (0, 0, 0) since on the curve \(x^2-y^3=0\), \(z=0\), it is equal to \(\frac{1}{x^2}\) away from (0, 0, 0).

However, for \(\mathcal {C}^{\infty }\) functions, we have the following version of Theorem 1.

FormalPara Theorem 6

Let \(f :X \rightarrow \mathbb {R}\) be a \(\mathcal {C}^{\infty }\) function defined on an irreducible nonsingular algebraic set \(X \subset \mathbb {R}^m\) of dimension \(n \ge 2\). Assume that the restriction \(f|_{C}\) is an analytic (resp. a Nash) function for every algebraic curve \(C \in \mathcal {F}_1(X)\). Then f is an analytic (resp. a Nash) function.

FormalPara Proof

We argue as in the proof of Theorem 1, substituting Theorem 7 below for Theorem 2. \(\square \)

FormalPara Theorem 7

Let \(f :\mathbb {B}^n \rightarrow \mathbb {R}\) be a \(\mathcal {C}^{\infty }\) function defined on the unit open ball \({\mathbb {B}^n \subset \mathbb {R}^n}\). Assume that \(n\ge 2\) and the restriction \(f|_{\Sigma ^1}\) is an analytic (resp. a Nash) function for every Euclidean 1-sphere \(\Sigma ^1 \in \mathcal {E}_1(\mathbb {B}^n)\). Then f is an analytic (resp. a Nash) function.

FormalPara Proof

To begin with, we consider the analytic case, assuming that the restriction \(f|_{\Sigma ^1}\) is an analytic function for every Euclidean 1-sphere \(\Sigma ^1 \in \mathcal {E}_1(\mathbb {B}^n)\).

First we prove analyticity of f on the punctured unit ball \(\mathbb {B}^n \setminus \{0\}\). This is equivalent to proving analyticity of the function

$$\begin{aligned} g := f \circ \mu |_{\mathbb {R}^n \setminus \overline{\mathbb {B}}^n} :\mathbb {R}^n \setminus \overline{\mathbb {B}}^n \rightarrow \mathbb {R}. \end{aligned}$$

The problem is local, so fix a point \(b \in \mathbb {R}^n \setminus \overline{\mathbb {B}}^n\). Our goal is to show that g is analytic at b. Evidently, g is of class \(\mathcal {C}^{\infty }\) and its restriction to any affine line contained in \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\) is analytic. Let

$$\begin{aligned} \mathcal {L} : = \text { the set of all affine lines contained in } \mathbb {R}^n \setminus \overline{\mathbb {B}}^n \text { and passing through }b. \end{aligned}$$

The union C of all lines in \(\mathcal {L}\) is a cone in \(\mathbb {R}^n\) and the set \(U := C \setminus \{b\}\) is open in \(\mathbb {R}^n\). Consider the series \(\Sigma _kP_k\) of homogeneous polynomials in n variables \(x=(x_1, \cdots , x_n)\), where

$$\begin{aligned} P_k(x) = \frac{1}{k!}\displaystyle \sum _{|a|=k} \frac{\partial ^{|\alpha |} g}{\partial x_1^{\alpha _1} \cdots \partial x_n^{\alpha _n}}(b) x_1^{\alpha _1} \cdots x_n^{\alpha _n}, \end{aligned}$$
$$\begin{aligned} \alpha = (\alpha _1, \cdots , \alpha _n), |\alpha |=\alpha _1 + \cdots + \alpha _n. \end{aligned}$$

By construction, for each vector line \(\Lambda \subset \mathbb {R}^n\) with \(b + \Lambda \in \mathcal {L}\), the series \(\Sigma _kP_k(x)\) converges to \(g(b+x)\) for all \(x\in \Lambda \) in a neighborhood of \( 0 \in \Lambda \). Hence, in view of Lemma 8 below, the series \(\Sigma _kP_k(x)\) converges to an analytic function \(\gamma :B \rightarrow \mathbb {R}\) defined on an open ball \(B \subset \mathbb {R}^n\) centered at the origin. Clearly, the function

$$\begin{aligned} \gamma _b :B_b \rightarrow \mathbb {R}, \gamma _b(b+x): = \gamma (x) \text { for } x \in B, \end{aligned}$$

is analytic on the ball \(B_b : = b+B\) centered at b. Since \(g=\gamma _b\) on \(B_b \cap L\) for all \(L \in \mathcal {L}\), it follows that

$$\begin{aligned} g = \gamma _b \text { on } B_b \cap C. \end{aligned}$$

We claim that \(g=\gamma _b\) in a neighborhood of b in \(\mathbb {R}^n\). Indeed, fix an affine line \(L_0 \in \mathcal {L}\) and let K be any affine line contained in \(\mathbb {R}^n \setminus \overline{\mathbb {B}}^n\) that is parallel to \(L_0 \in \mathcal {L}\) and satisfies \(K \cap B_b \cap U \ne \emptyset \). The functions g and \(\gamma _b\) coincide on \(K \cap B_b \cap U\), hence the analytic functions \(g|_{K \cap B_b}\) and \(\gamma _b|_{K \cap B_b}\) are equal. The union of the sets \(K \cap B_b\), for all K as above, is a neighborhood of b in \(\mathbb {R}^n\). It follows that g and \(\gamma _b\) are equal in a neighborhood of b in \(\mathbb {R}^n\), as claimed. So f is an analytic function on \(\mathbb {B}^n\), except possibly at the origin.

To prove that f is analytic at the origin, we use the inversion

$$\begin{aligned} \mu _a :\mathbb {R}^n \setminus \{a\} \rightarrow \mathbb {R}^n \setminus \{a\},\ \mu _a(x) = \mu (x-a)+a, \end{aligned}$$

centered at a point \(a \in \mathbb {B}^n \setminus \{0\}.\) Let \(U_a := \mu _a(\mathbb {B}^n \setminus \{a\})\). The function

$$\begin{aligned} h := f \circ (\mu _a|_{U_a})^{-1} :U_a \rightarrow \mathbb {R} \end{aligned}$$

is of class \(\mathcal {C}^{\infty }\), analytic except possibly at \(\mu _a(0)\), and its restriction is analytic on every affine line passing through \(\mu _a(0)\) and contained in \(U_a\). Arguing as above, we show that the Taylor series of h at \(\mu _a(0)\) converges to h in a neighborhood of \(\mu _a(0)\) in \(\mathbb {R}^n\). Thus f is analytic at the origin, and therefore everywhere on \(\mathbb {B}^n\).

In the Nash case, we proceed as in the proof of Theorem 2. \(\square \)

We have used the following result, see [4, Lemma 3] for the proof.

FormalPara Lemma 8

Let \(\sum \nolimits _k^{\infty }P_k\) be a series of real homogenous polynomials in n variables, \(\deg P_k=k\). Assume that there exists a nonempty open subset \(\Omega \subset \mathbb {S}^{n-1}\) such that for every point \(a \in \Omega \), one can find a constant \(\rho _a >0\) such that the series \(\sum \nolimits _k^{\infty } P_k(x)\) converges at \(x=\rho _a a\). Then there exist constants \(c>0, r>0\) such that

$$\begin{aligned} |P_k(z)| \le \frac{c}{2^k} \text { for } z\in \mathbb {C}^n,\ \Vert z\Vert \le r,\ k \ge 0. \end{aligned}$$

In particular, the function \(z \mapsto \sum \nolimits _k^{\infty } P_k(z)\) is holomorphic in the ball \(\Vert z\Vert <r, z\in \mathbb {C}^n\).

Working on local coordinate charts, we derive from Theorem 7 the following.

FormalPara Theorem 9

Let \(f :M \rightarrow \mathbb {R}\) be a \(\mathcal {C}^{\infty }\) function defined on an analytic (resp. a Nash) manifold M of dimension \(n\ge 2\). Assume that the restriction \(f|_{C}\) is an analytic (resp. a Nash) function for every analytic (resp. Nash) submanifold \(C \subset M\) homeomorphic to \(\mathbb {S}^1\). Then f is an analytic (resp. a Nash) function.

One can compare Theorems 6 and 9 with the following example.

FormalPara Example 10

The function \(f :\mathbb {R}^2 \rightarrow \mathbb {R}\) defined by

$$\begin{aligned}f(x,y) = {\left\{ \begin{array}{ll} xy \exp \left( - \frac{1}{x^2+y^2}\right) &{} \text {if } (x,y) \ne (0,0),\\ 0 &{}\text {if } (x,y) = (0,0), \end{array}\right. } \end{aligned}$$

is of class \(\mathcal {C}^{\infty }\) and analytic with respect to each variable separately. However, f is not analytic as a function of two variables.