3

Best linear approximation that minimizes the following $L^1$ norm: The $L^1$ norm is defined as $$ \| f\|_1 = \int_a^b |f(x)|{\rm d}x $$ Best Linear approximation $l(x) = a_0 + a_1 x$ that minimizes $\|e^ x - l(x) \|_1$ on the interval $[-1, 1]$
Note: The $L^1$ is not induced by an inner product, so cannot use least squares

I have attempted to take the definition of the $L^1$ norm as indicated using the integral, and substituting in the linear function $l(x)$. I am having trouble on determining the values of $a_0$ and $a_1$ for the best linear function that minimizes this $L^1$ norm.

Any help is greatly appreciated.

  • Welcome to math.SE - If you know MathJax it is preferable that you use it, if you do not it's barely acceptable to edit your question and place the image inline. Having an image as a link is least helpful. Thanks. That will assist someone with editing privileges to Jax your question. – Rob Jun 15 '18 at 01:48
  • 1
    Sorry I do not know MathJax. I will see what I can figure out. – user565684 Jun 15 '18 at 02:04
  • 1
    Thank you caverac! – user565684 Jun 15 '18 at 02:11
  • Are you quite certain that this can be done analytically? The answer I get when I do it numerically are not obviously "nice" numbers, though they are fairly close to the values $a_0=a_1=1$ that you get by guessing that the answer follows from Taylor expansion. – Ian Jun 15 '18 at 05:19
  • Moreover it seems to me that the $L^1$ norm explicitly depends on the roots of $e^x-a_0-a_1x$, of which there are in general two, neither of which are expressible as elementary functions of $(a_0,a_1)$ (the Lambert W function is involved). To be specific, the $L^1$ norm for a function with two roots and which is negative to the left of the leftmost root (natural hypotheses, under the circumstances) will be $-\int_{-1}^{r_1} e^x-a_0-a_1x dx + \int_{r_1}^{r_2} e^x-a_0-a_1x dx - \int_{r_2}^1 e^x-a_0-a_1 x dx$. Does the dependence on the roots somehow cancel out? – Ian Jun 15 '18 at 05:25
  • @Ian. Interesting problem ! Your comment gave me the track to follow. Thanks. – Claude Leibovici Jun 15 '18 at 07:36

2 Answers2

2

Starting from Ian's comment, the roots of $e^x-a-b x=0$ are given by $$r_1=-W_0\left(c\right)-\frac{a}{b}\qquad \text{and} \qquad r_2=-W_{-1}\left(c\right)-\frac{a}{b}\qquad \text{with} \qquad c=-\frac{1}{b}e^{-\frac{a}{b}}$$ Computing the three integrals as suggested by Ian, we end, for $$\| f\|_1 = \int_{-1}^1 |e^x-a-b\,x|\,dx$$ to the quite unpleasant expression $$\| f\|_1 =b \left(W_0\left(c\right)-W_{-1}\left(c\right)\right) \left(W_0\left(c\right)+W_{-1}\left(c\right)+2\right)+2 a-e+\frac{1}{e}$$ but the partial derivatives are not "too" bad $$\frac{\partial \| f\|_1}{\partial a}=-2 W_0\left(c\right)+2 W_{-1}\left(c\right)+2\tag 1$$

$$\frac{\partial \| f\|_1}{\partial b}=\frac{\left(W_0\left(c\right)-W_{-1}\left(c\right)\right) \left(b \left(W_0\left(c\right)+W_{-1}\left(c\right)\right)+2 a\right)}{b}\tag 2$$

Using as estimates $$a=\frac{e^2-1}{2 e}=\sinh(1)\qquad \text{and} \qquad b=\frac 3 e$$ which are the solutions of the minimization of $$\int_{-1}^1 (e^x-a-b\,x)^2\,dx$$ we can easily solve $(1)$ for $c$ starting iterating from $c_0=-\frac{1}{3} e^{\frac{7-e^2}{6}}$ and get the following iterates $$\left( \begin{array}{cc} k & c_k \\ 0 & -0.312404963823450 \\ 1 & -0.325786585779692 \\ 2 & -0.325205861061641 \\ 3 & -0.325204338150736 \\ 4 & -0.325204338140427 \end{array} \right)$$

Then, from $(2)$, $b=-\frac {2a}{W_0\left(c\right)+W_{-1}\left(c\right) }$ and, back to the definition of $c$, get $a$. All of that leads to $$a=1.1276259652064\qquad \text{and}\qquad b=1.0421906109875$$ which, to my surprise, are recognized by inverse symbolic calculators

$$\color{blue}{a=\frac{1+e}{2 \sqrt{e}}=\cosh \left(\frac{1}{2}\right)}\qquad \text{and} \qquad \color{blue}{b=\frac{e-1}{ \sqrt{e}}=2 \sinh \left(\frac{1}{2}\right)}$$

Update

The results could have obtained analytically since, looking here $$W_0(c)-W_{-1}(c)=1 \implies c=-\frac {1} {e-1}\, \exp \left( \frac {-1} {e-1}\right)$$ is known result which makes $$W_0(c)=\frac{1}{1-e} \qquad \text{and} \qquad W_{-1}(c)=\frac{e}{1-e}$$ Then, from $(2)$ $$b=-\frac{2a} {W_0(c)+ W_{-1}(c)}=\frac{2 (e-1) }{1+e}a$$ and reusing the definition of $c$, then $a$ and $b$. QED.

2

A nicer approach seems to be to set the interpolation points $(x,y)=(a,e^a)$ and $(x,y)=(b,e^b)$ as unknowns rather than slope and intercept. Then the three pieces are $$\begin{align}I_1&=\int_{-1}^a\left[e^x-e^a-\left(\frac{e^b-e^a}{b-a}\right)(x-a)\right]dx=\frac{-1}e+e^a\left[-a-\frac12\frac{(1+a)^2}{b-a}\right]+e^b\frac12\frac{(1+a)^2}{(b-a)}\\ I_2&=\int_a^b\left[e^a+\left(\frac{e^b-e^a}{b-a}\right)(x-a)-e^x\right]dx=e^a\left[\frac12(b-a)+1\right]+e^b\left[\frac12(b-a)-1\right]\\ I_3&=\int_b^1\left[e^x-e^b-\left(\frac{e^b-e^a}{b-a}\right)(x-b)\right]dx=e^1+e^a\frac12\frac{(1-b)^2}{(b-a)}+e^b\left[b-2-\frac12\frac{(1-b)^2}{(b-a)}\right]\end{align}$$ Adding up, we get the $L_1$ norm as $$f(a,b)=I_1+I_2+I_3=e^1-e^{-1}+e^a\left[b-a-\frac{2a}{b-a}\right]+e^b\left[b-a-2+\frac{2a}{b-a}\right]$$ Then to minimize we have to set the partial derivatives to zero: $$\begin{align}\frac{\partial f}{\partial a}&=e^a\left[b-a-\frac{2a}{b-a}-1-\frac{2b}{(b-a)^2}\right]+e^b\left[-1+\frac{2b}{(b-a)^2}\right]\\ \frac{\partial f}{\partial b}&=e^a\left[1+\frac{2a}{(b-a)^2}\right]+e^b\left[b-a-1+\frac{2a}{b-a}-\frac{2a}{(b-a)^2}\right]\end{align}$$ Now we need some kind of miracle to solve the above system analytically. Here is a surface plot of $f(a,b)$

Local Minimum for L_1 Norm

And the miracle is that if $b=-a=\frac12$ the contents of the square brackets in the above two equations vanish and the local minimum is $$f\left(-\frac12,\frac12\right)=e^1-2e^{1/2}+2e^{-1/2}-e^{-1}$$

user5713492
  • 15,938
  • Interesting approach for sure ! What I did find nice in my solution was to reduce the problem to a single equation in $c$ for which the solution is "obvious". Have a look at https://math.stackexchange.com/questions/2822658/solution-of-w-0x-w-1x-1 – Claude Leibovici Jun 18 '18 at 07:33
  • A very nice approach! – orangeskid Dec 21 '20 at 09:18