# Construct an example of a function with period 1 which is not a trig function and is differentiable at every point.

This question stuck out to me as particularly difficult. Any insight would be great! (piece-wise are ok, but keep in mind the differentiability clause).

• There are techniques to make any continuous function smooth by tiny change. – Berci Sep 23 '15 at 22:21
• math.stackexchange.com/questions/935840/… – Dimitri C Sep 23 '15 at 22:22
• Isn't $\Re\{e^{xi}\}$ such a function? – Conor O'Brien Sep 24 '15 at 3:13
• $f(x) = c$ works nicely. – Keith Sep 24 '15 at 4:51
• @CᴏɴᴏʀO'Bʀɪᴇɴ He's supposed to exclude trig functions. – DRF Sep 24 '15 at 8:04

## 8 Answers

function with period 1 which is not a trig function

Any sufficiently reasonable periodic function is the sum of its Fourier series, making it a sort of trigonometric function.

If it only needs to be once differentiable, then one can use $f(x) = x^2(1-x)^2$ for $0\le x\le 1$ and then extend by periodicity to numbers not between $0$ and $1$. In other words, first let $$g(x) = \begin{cases} x^2(1-x)^2 & \text{if }0\le x\le 1, \\[6pt] 0 & \text{otherwise}, \end{cases}$$ and then let $$f(x) = \sum_{n=-\infty}^\infty g(x-n).$$ For each value of $x$, only one term of the sum is not $0$, so convergence is no problem.

To make it more-than-once differentiable, how about this: $$\sum_{n=-\infty}^\infty \exp(-(x-n)^2).$$ Then work on proving the series converges and the sum is differentiable.

Based on the fractional part of a real number, define the following odd function: $f:\mathbb{R}\to\mathbb{R}$ with period $1$:

$$f(x)=\begin{cases} 1-\left(4\{x\}-1\right)^2,& 0\le\{x\}<0.5 \\ -1+\left(4\{x\}-3\right)^2,& 0.5\le\{x\}<1 \\ \end{cases}$$

Here is a plot of the function: Now if $\{x\}<0.5$ then $\{-x\}=1-x<0.5$ and $f(x)=1-\left(4\{x\}-1\right)^2$, while $f(-x)=-1+\left(4\{-x\}-3\right)^2=-1+\left(4(1-\{x\})-3\right)^2=-1+\left(1-4\{x\}\right)^2=-f(x)$. So by symmetry, $f(-x)=f(x)$ for $\{x\}>0.5$ too. For ${x}=0.5$ have $f(x)=-1+\left(4\times0.5-3\right)^2=0$.

Also $$\lim_{\{x\}\to0^+}{f(x)}=0$$ and $$\lim_{\{x\}\to1^-}{f(x)}=0$$ So $f$ is an odd continuous function which has period $1$.
Since $x\mapsto 1-(4x-1)^2$ is differentiable on $(0,\frac{1}{2})$ and $x\mapsto -1+(4x-3)^2$ is differentiable on $(\frac{1}{2},1)$ and it is fairly straightforward to show that the one-sided derivatives agree when $\{x\}=\frac{1}{2}$ and when $x$ is in the nbhd of an integer, so $f$ is differentiable on $(-\infty,\infty)$.

• Nice construct. It's a sum of infinite sin functions still but that appears unavoidable. – Joshua Sep 24 '15 at 3:04
• @Joshua You are right. As long as the resulting function is odd, it is unavoidable it is the infinite sum of sine funcions. In fact, Fourier analysis tells us that it is in fact unavoidable for such a function as desired not to be an infinite sum of sines and cosines – user45150 Sep 24 '15 at 10:35
• Since $f(x)=\frac{1}{2}[f(x)+f(-x)]+\frac{1}{2}[f(x)-f(-x)]$ every function can be written as the sum of an even and an odd function. Since our function must be periodic and (as I interpret the question) everywhere $\mathcal{C}^0$ and $\mathcal{C}^1$, the Fourier series for $f$ will converge uniformly to $f$. So being "trigonometric" seems unavoidable here. – Marconius Sep 24 '15 at 12:58

Let's go for something that is piecewise continuous.

So we need $f(0)=f(1)$ and $f'(0)=f'(1)$

A linear function will not work (well, it will, but trivially) and a quadratic function will fail on the gradient constraint, so try a cubic.

Let $f(x)=ax^3+bx^2+cx+d$.

For simplicity set $d=0$.

$f(1)=f(0)=0 \Rightarrow a+b+c=0$.

$f'(x)=3ax^2+2bx+c$

$f'(0)=f'(1) \Rightarrow c=3a+2b+c \Rightarrow 3a+2b=0 \Rightarrow b=- \frac {3a}2$.

Substitute into $a+b+c=0$ to get $a - \frac {3a}2+c=0 \Rightarrow c=\frac {a}2$.

We can scale up to avoid fractions to give $f(x)=2x^3-3x^2+x$ for $0 \le x \le 1$ and $f(x+1)=f(x)$ for all other values of $x$.

Start from the function $x^4-x^2$. It has two symmetrical minima around the $0$. $(x^4-x^2)'=4x^3-2x=0\Leftrightarrow x=0$ or $x=\pm \frac{\sqrt 2}{2}$. At this minima the derivative is zero so you can connect the peaces between the minima smoothly. But to make it with a period of $1$ you should scale it horizontally: you want the distance between the minima to be $1$. This means you scale by $\epsilon>0:$ $g(x)=(\frac{x}{\epsilon})^4-(\frac{x}{\epsilon})^2$. Now the extremums are at $g'(x)=0\Leftrightarrow$ $x=0$ or $x=\pm \frac{\epsilon}{\sqrt 2}$. For a period of one we want $\frac{\epsilon}{\sqrt 2}-(-\frac{\epsilon}{\sqrt 2})=1\Leftrightarrow \epsilon=\frac{\sqrt 2}{2}$.

Finally, the periodic function is $f(x)=g(x-n),$ for $x\in [n-1/2,n+1/2],\,n=\pm1,\pm2,\pm3,....$ where $g(x)=4x^4-2x^2$ (plug in $\epsilon=\frac{\sqrt 2}{2}$) Try with $\exp(\frac{-1}{1/4-|x|^2})$ for $x\in (-1/2,1/2)$, and extend it periodically.

Take any function $g(x)$ that is defined and differentiable on the domain $-1 \le x \le 2$.

Calculate $g(0)$, $g(1)$, $g'(0)$ and $g'(1)$.

Let $f(x)=(ax^2+bx+c)g(x)$

Then $f'(x)=(ax^2+bx+c)g'(x)+(2ax+b)g(x)$

$f(0)=f(1) \Rightarrow cg(0)=(a+b+c)g(1) \Rightarrow ag(1)+bg(1)+c\left[g(1)-g(0) \right]=0$

$f'(0)=f'(1) \Rightarrow cg'(0)+bg(0)=(a+b+c)g'(1)+(2a+b)g(1)\Rightarrow a\left [g'(1)+2g(1)\right]+b\left[g'(1)+g(1)-g(0)\right]+c\left[g'(1)-g'(0) \right]=0$

$b$ and $c$ can be determined from any choice of "a", so there are any number of such functions.

First, take any function $g$ that is continuous on $[0,1]$ and which verifies $g(0) = g(1)$ and $\int_0^1 g(t) dt = 0$. Extend it by periodicity on $\mathbb{R}$ and let us still call $g$ this extended function.

Then the function $x \rightarrow \int_0^x g(t) dt$ is differentiable, since it is the integral of a continuous function, and the periodicity of $g$ and the fact that the integral of $g$ is $0$ on $[0,1]$ ensures that $f$ is periodic.