# Why is it impossible to have a Taylor series for |x|?

I've tried making a Taylor series for $$|x|$$, but I've been told multiple times on this site that creating a Taylor series for $$|x|$$ is impossible, because it's not differentiable at $$0$$.

But, I've never thought that was a requirement for creating a Taylor series--for example with $$\frac{1}{x}$$. It doesn't have a valid derivative at $$0$$, but it still has a Taylor series:

$$\sum_{n=0}^\infty(1-x)^n \quad x \in (0, 2)$$ or $$\sum_{n=0}^{\infty}\left(1-\frac{x}{a}\right)^n\frac{1}{a} \quad x \in \left(0, \frac{|a|+a^2}{a}\right)$$

I've even succeeded in making an infinite polynomial equation that equals $$|x|$$, $$|x| = \lim_{N \to \infty} \sum_{n=1}^{\infty}\frac{x^n}{n!} \left(\sum_{k=1}^{N}\left(\frac{1-2k}{ a i}\right)^{n} \cos{\left(\frac{n \pi }{2}\right)} \left(\frac{ -a\pi }{ 2} \right) \right) \quad x \in \left(-\frac{a}{2}, \frac{a}{2}\right)$$ where $$i$$ is the imaginary unit. This equation is what I thought was a taylor series for $$|x|$$.

I must also note that I didn't get it the standard way by using $$\sum_{n=0}^\infty \frac{f^n(a)}{n!}(x-a)^n$$, as that would end in errors such as $$\frac{0}{|0|}$$. Instead I got it by using the Fourier series and then converting it to a polynomial function. But wouldn't it theoretically be possible for an $$a$$ to exist, such that we get a Taylor series that is identical to my polynomial series?

I've not been able to find any information about this on the internet, nor do I have a degree in maths, so I would really appreciate y'all's helpπ

• Comments are not for extended discussion; this conversation has been moved to chat. Commented Jul 9, 2022 at 16:34
• @XanderHenderson I just wanna quickly apologize for last time ππ I hope you can forgive me, I was really tired and hadn't gotten any sleep for roughly a day, as I was in the middle of traveling ππ
– Sejr
Commented Jul 10, 2022 at 13:56

Every continuous function defined on a closed interval can be uniformly approximated as closely as desired by a polynomial. This is guaranteed by the Stone-Weierstrass Theorem. An example of such converging series of polynomials can be constructed using Bernstein Polynomials.

Just the fact that such approximations exist won't turn them into Taylor series. A Taylor series is defined by the derivatives of a function at some point $$x_0$$. And the series should converge against the target function in some open interval around the expansion point.

As $$|x|$$ is not smooth at 0 it's clear that a Taylor series around 0 cannot exist. Using Taylor series around some $$x_0\neq0$$ is pointless because the series will not converge against $$|x|$$ for $$x<0$$ even though the series has radius of convergence of $$\infty$$ and is analytic everywhere (it's just $$x\mapsto -x$$).

## Background

Here is the definition of a Taylor series:

Suppose $$f : \Bbb{R} \to \Bbb{R}$$ (complex numbers are available on request) is infinitely differentiable at a point $$x_0 \in \Bbb{R}$$. That is, $$f^{(n)}(x_0)$$ exists for all $$n \in \Bbb{N}$$. Then, the Taylor series of $$f$$ centred at $$x_0$$ is the power series: $$\sum_{n=0}^\infty \frac{f^{(n)}(x_0)}{n!}(x - x_0)^n = f(x_0) + f'(a)(x - x_0) + \frac{f''(x_0)}{2}(x - x_0)^2 + \ldots$$

The requirement for differentiability is baked into the definition. If $$f'(x_0)$$ does not exist, then we have no concept of what the second term should be. Also, it means that every higher derivative doesn't exist, so all the higher terms are lost as well.

Taylor series are a type of power series. Power series revolve around a centre $$x_0 \in \Bbb{R}$$, taking the form $$\sum_{n=0}^\infty a_n(x - x_0)^n$$ for some sequence of terms $$(a_n)$$. They're a bit like a polynomial that refuses to settle for a finite degree. They exist independently of Taylor series, and differentiation. There is, however, a nice result, which I believe you're at least partially aware of:

Suppose a power series $$\sum_{n=0}^\infty a_n(x - x_0)^n$$ converges for all $$x$$ in a neighbourhood of $$x_0$$. That is, it converges on an interval $$(x - r, x + r)$$ for some $$r > 0$$. Let $$f(x)$$ be this function of $$x$$. Then the power series must be the Taylor series of $$f(x)$$ centred at $$x = x_0$$.

So, simply defining a power series, without worrying about functions or differentiability, and having it be convergent to something, actually forces the power series to be a Taylor series! In particular, it means that a function defined as a power series must be (infinitely) differentiable (at its centre, at least). Thus, it is not possible to approximate $$|x|$$, using any power series centred at $$0$$.

## Polynomial Approximation vs. Power Series

First, consider what it means for a power series (or any series) to converge: it means that the sequence of partial sums eventually becomes arbitrarily close to some number, which we call its limit (I'm trying to spare the $$\varepsilon$$-$$N$$s here). So, given a power series $$\sum a_n (x - x_0)^n$$, we get a sequence of approximating polynomials: \begin{align*} S_0 &= a_0 \\ S_1 &= a_0 + a_1(x - x_0) \\ S_2 &= a_0 + a_1(x - x_0) + a_2(x - x_0)^2 \\ &\vdots \\ S_n &= \sum_{k=0}^n a_k(x - x_0)^k \\ &\vdots \end{align*} These functions will converge pointwise to some function, on their interval of convergence. Note that these are all polynomials, but they do have a particular property: each new term simply adds on a new, higher order term $$a_k(x - x_0)^k$$, without modifying the lower order terms.

For example, the constant term, $$a_0$$, is the same in every partial sums. And once the $$a_1(x - x_0)$$ term is added, it features in every subsequent partial sum, with no modification or other $$x - x_0$$ terms added later.

So, approximation by power series is a special case of approximation by polynomials. While it is necessary, when approximating a non-polynomial function by polynomials, for the degrees of the polynomials to approach $$\infty$$, general approximations with a sequence of polynomials need not be so polite to the lower-order terms.

Once we relax approximation by power series (which, remember, makes the resulting function infinitely-differentiable at at least one point) to approximation by polynomials, we can suddenly approximate many more functions. The following is a version of the Stone-Weierstrass theorem:

Suppose we have a continuous function $$f : [a, b] \to \Bbb{R}$$. Then, there exists a sequence of real polynomials $$p_n$$ that uniformly approximate $$f$$.

That is, $$\max_{x \in [a, b]} |f(x) - p_n(x)|$$ becomes eventually as small as you like. If you wanted, by choosing a large enough $$n$$, you could make $$\max_{x \in [a, b]} |f(x) - p_n(x)|$$ a smaller distance than your eyes could perceive, at which point, the graphs of $$f(x)$$ and $$p_n(x)$$ would look identical to you (on the domain $$[a, b]$$).

There is no requirement for differentiability here. Indeed, one could even approximate continuous functions that are nowhere differentiable, for example the Weierstrass function (yes, him again). In this way, approximation by polynomials is far, far more powerful. Approximation with Taylor series is conceptually simpler, but it can only be effective with a tiny subset of continuous functions.

This is how you managed to approximate $$|x|$$ with your functions. They are all polynomials, yes, but if you write some of them out, you'll note that not only are higher terms added, but the lower order terms change. You are now out of the realm of power/Taylor series approximations, where approximating $$|x|$$ would be impossible (around $$0$$), and into the realm of general polynomial approximation. Stone and Weierstrass have your back!

• Again thank you Theoπ + So Taylor series is just a very special case of polynomial approximation?π
– Sejr
Commented Jul 8, 2022 at 9:37
• @Sejr That's right. Commented Jul 8, 2022 at 14:11