# Higher order reflections

Mathematical reflections, not those supposedly practiced in metaphilosophy.

Given a function ${f}$ defined for ${x\ge 0}$, we have two basic ways to reflect it about ${x=0}$: even reflection ${f(-x)=f(x)}$ and odd reflection ${f(-x)=-f(x)}$. Here is the even reflection of the exponential function ${e^x}$:

The extended function is not differentiable at ${0}$. The odd reflection, pictured below, is not even continuous at ${0}$. But to be fair, it has the same slope to the left and to the right of ${0}$, unlike the even reflection.

Can we reflect a function preserving both continuity and differentiability? Yes, this is what higher-order reflections are for. They define ${f(-x)}$ not just in terms of ${f(x)}$ but also involve values at other points, like ${f(x/2)}$. Here is one such smart reflection: $\displaystyle f(-x) = 4f(x/2)-3f(x) \qquad\qquad\qquad (1)$

Indeed, letting ${x\rightarrow 0^+}$, we observe continuity: both sides converge to ${f(0)}$. Taking derivatives of both sides, we get $\displaystyle -f'(-x) = 2f'(x/2) - 3f'(x)$

where the limits of both sides as ${x\rightarrow 0^+}$ again agree: they are ${-f'(0)}$.

A systematic way to obtain such reflection formulas is to consider what they do to monomials: ${1}$, ${x}$, ${x^2}$, etc. A formula that reproduces the monomials up to degree ${d}$ will preserve the derivatives up to order ${d}$. For example, plugging ${f(x)=1}$ or ${f(x)=x}$ into (1) we get a valid identity. With ${f(x)=x^2}$ the equality breaks down: ${x^2}$ on the left, ${-2x^2}$ on the right. As a result, the curvature of the graph shown above is discontinuous: at ${x=0}$ it changes the sign without passing through ${0}$.

To fix this, we’ll need to use a third point, for example ${x/4}$. It’s better not to use points like ${2x}$, because when the original domain of ${f}$ is a bounded interval ${[0,b]}$, we probably want the reflection to be defined on all of ${[-b,b]}$.

So we look for coefficients ${A,B,C}$ such that ${f(-x)=Af(x/4)+Bf(x/2)+Cf(x)}$ holds as identity for ${f(x)=1,x,x^2}$. The linear system ${A+B+C=1}$, ${A/4+B/2+C=-1}$, ${A/16+B/4+C=1}$ has the solution ${A=16}$, ${B=-20}$, ${C=5}$. This is our reflection formula, then: $\displaystyle f(-x) = 16f(x/4)-20f(x/2)+5f(x) \qquad\qquad\qquad (2)$

And this is the result of reflecting ${\exp(x)}$ according to (2):

Now the curvature of the graph is continuous. One could go on, but since human eye is not sensitive to discontinuities of the third derivative, I’ll stop here.

In case you don’t believe the last paragraph, here is the reflection with three continuous derivatives, given by $\displaystyle f(-x) = \frac{640}{7} f(x/8) - 144f(x/4)+60f(x/2)-\frac{45}{7}f(x)$

and below it, the extension given by (2). For these plots I used Desmos because plots in Maple (at least in my version) have pretty bad aliasing.