In mathematics, smooth functions (also called infinitely differentiable functions) and analytic functions are two very important types of functions. One can easily prove that any analytic function of a real argument is smooth. The converse is not true, as demonstrated with the counterexample below.
One of the most important applications of smooth functions with compact support is the construction of socalled mollifiers, which are important in theories of generalized functions, such as Laurent Schwartz's theory of distributions.
The existence of smooth but nonanalytic functions represents one of the main differences between differential geometry and analytic geometry. In terms of sheaf theory, this difference can be stated as follows: the sheaf of differentiable functions on a differentiable manifold is fine, in contrast with the analytic case.
The functions below are generally used to build up partitions of unity on differentiable manifolds.
An example function
Definition of the function
Consider the function
defined for every real number x.
The function is smooth
The function f has continuous derivatives of all orders at every point x of the real line. The formula for these derivatives is
where p_{n}(x) is a polynomial of degree n − 1 given recursively by p_{1}(x) = 1 and
for any positive integer n. From this formula, it is not completely clear that the derivatives are continuous at 0; this follows from the onesided limit
for any nonnegative integer m.
Detailed proof of smoothness


By the power series representation of the exponential function, we have for every natural number (including zero) because all the positive terms for are added. Therefore, dividing this inequality by and taking the limit from above, We now prove the formula for the nth derivative of f by mathematical induction. Using the chain rule, the reciprocal rule, and the fact that the derivative of the exponential function is again the exponential function, we see that the formula is correct for the first derivative of f for all x > 0 and that p_{1}(x) is a polynomial of degree 0. Of course, the derivative of f is zero for x < 0. It remains to show that the righthand side derivative of f at x = 0 is zero. Using the above limit, we see that The induction step from n to n + 1 is similar. For x > 0 we get for the derivative where p_{n+1}(x) is a polynomial of degree n = (n + 1) − 1. Of course, the (n + 1)st derivative of f is zero for x < 0. For the righthand side derivative of f^{ (n)} at x = 0 we obtain with the above limit 
The function is not analytic
As seen earlier, the function f is smooth, and all its derivatives at the origin are 0. Therefore, the Taylor series of f at the origin converges everywhere to the zero function,
and so the Taylor series does not equal f(x) for x > 0. Consequently, f is not analytic at the origin.
Smooth transition functions
The function
has a strictly positive denominator everywhere on the real line, hence g is also smooth. Furthermore, g(x) = 0 for x ≤ 0 and g(x) = 1 for x ≥ 1, hence it provides a smooth transition from the level 0 to the level 1 in the unit interval [0, 1]. To have the smooth transition in the real interval [a, b] with a < b, consider the function
For real numbers a < b < c < d, the smooth function
equals 1 on the closed interval [b, c] and vanishes outside the open interval (a, d).
A smooth function which is nowhere real analytic
A more pathological example, of an infinitely differentiable function which is not analytic at any point can be constructed by means of a Fourier series as follows. Let A := { 2^{n} : n ∈ ℕ } be the set of all powers of 2, and define for all x ∈ ℝ
Since the series converges for all n ∈ ℕ, this function is easily seen to be of class C^{∞}, by a standard inductive application of the Weierstrass Mtest to demonstrate uniform convergence of each series of derivatives. Moreover, for any dyadic rational multiple of π, that is, for any x := π·^{ p}/_{q} with p ∈ ℕ and q ∈ A, and for all order of derivation n ∈ A, n ≥ 4 and n > q we have
where we used the fact that cos(kx) = 1 for all k > q. As a consequence, at any such x ∈ ℝ
so that the radius of convergence of the Taylor series of F at x is 0 by the CauchyHadamard formula. Since the set of analyticity of a function is an open set, and since dyadic rationals are dense, we conclude that F is nowhere analytic in ℝ.
Application to Taylor series
For every sequence α_{0}, α_{1}, α_{2}, . . . of real or complex numbers, the following construction shows the existence of a smooth function F on the real line which has these numbers as derivatives at the origin.^{[1]} In particular, every sequence of numbers can appear as the coefficients of the Taylor series of a smooth function. This result is known as Borel's lemma, after Émile Borel.
With the smooth transition function g as above, define
This function h is also smooth; it equals 1 on the closed interval [−1,1] and vanishes outside the open interval (−2,2). Using h, define for every natural number n (including zero) the smooth function
which agrees with the monomial x^{n} on [−1,1] and vanishes outside the interval (−2,2). Hence, the kth derivative of ψ_{n} at the origin satisfies
and the boundedness theorem implies that ψ_{n} and every derivative of ψ_{n} is bounded. Therefore, the constants
involving the supremum norm of ψ_{n} and its first n derivatives, are welldefined real numbers. Define the scaled functions
By repeated application of the chain rule,
and, using the previous result for the kth derivative of ψ_{n} at zero,
It remains to show that the function
is well defined and can be differentiated termbyterm infinitely many times.^{[2]} To this end, observe that for every k
where the remaining infinite series converges by the ratio test.
Application to higher dimensions
For every radius r > 0,
with Euclidean norm x defines a smooth function on ndimensional Euclidean space with support in the ball of radius r, but .
Complex analysis
This pathology cannot occur with differentiable functions of a complex variable rather than of a real variable. Indeed, all holomorphic functions are analytic, so that the failure of the function f defined in this article to be analytic in spite of its being infinitely differentiable is an indication of one of the most dramatic differences between realvariable and complexvariable analysis.
Note that although the function f has derivatives of all orders over the real line, the analytic continuation of f from the positive halfline x > 0 to the complex plane, that is, the function
has an essential singularity at the origin, and hence is not even continuous, much less analytic. By the great Picard theorem, it attains every complex value (with the exception of zero) infinitely many times in every neighbourhood of the origin.
See also
Notes
 ^ Exercise 12 on page 418 in Walter Rudin, Real and Complex Analysis. McGrawHill, New Dehli 1980, ISBN 0070995575
 ^ See e.g. Chapter V, Section 2, Theorem 2.8 and Corollary 2.9 about the differentiability of the limits of sequences of functions in Amann, Herbert; Escher, Joachim (2005), Analysis I, Basel: Birkhäuser Verlag, pp. 373–374, ISBN 3764371536