2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00

many improvements (theorem-proof-structure for constant function; corrected errors)

This commit is contained in:
Martin Thoma 2013-12-21 19:10:35 +01:00
parent 01e343f66c
commit a1274e176f
10 changed files with 163 additions and 123 deletions

View file

@ -64,9 +64,19 @@ This result means:
\clearpage
\section{Defined on a closed interval $[a,b] \subseteq \mdr$}
\begin{theorem}[Solution formula for constant functions]
Let $f:[a,b] \rightarrow \mdr$, $f(x) := c$ with $a,b,c \in \mdr$ and
$a \leq b$ be a constant function.
Then the point $(x, f(x))$ of $f$ with minimal distance to $P$ is
given by:
\[\underset{x\in [a,b]}{\arg \min d_{P,f}(x)} = \begin{cases}
S_0(f,P) &\text{if } S_0(f,P) \cap [a,b] \neq \emptyset \\
\Set{a} &\text{if } S_0(f,P) \ni x_P < a\\
\Set{b} &\text{if } S_0(f,P) \ni x_P > b
\end{cases}\]
\end{theorem}
\begin{figure}[htp]
\centering
\begin{tikzpicture}
@ -111,17 +121,16 @@ $a \leq b$ be a constant function.
\label{fig:constant-min-distance-closed-intervall}
\end{figure}
The point with minimum distance can be found by:
\[\underset{x\in\mdr}{\arg \min d_{P,f}(x)} = \begin{cases}
S_0(f,P) &\text{if } S_0(f,P) \cap [a,b] \neq \emptyset \\
\Set{a} &\text{if } S_0(f,P) \ni x_P < a\\
\Set{b} &\text{if } S_0(f,P) \ni x_P > b
\end{cases}\]
Because:
\begin{proof}
\begin{align}
\underset{x\in[a,b]}{\arg \min d_{P,f}(x)} &= \underset{x\in[a,b]}{\arg \min d_{P,f}(x)^2}\\
&=\underset{x\in[a,b]}{\arg \min} x^2 - 2x_P x + (x_P^2 + y_P^2 - 2 y_P c + c^2)\\
&=\underset{x\in[a,b]}{\arg \min} x^2 - 2 x_P x + x_P^2\\
&=\underset{x\in[a,b]}{\arg \min} \big (x^2 - 2x_P x + x_P^2 + \overbrace{(y_P^2 - 2 y_P c + c^2)}^{\text{constant}} \big )\\
&=\underset{x\in[a,b]}{\arg \min} (x^2 - 2 x_P x + x_P^2)\\
&=\underset{x\in[a,b]}{\arg \min} (x-x_P)^2
\end{align}
which is optimal for $x = x_P$, but if $x_P \notin [a,b]$, you want
to make this term as small as possible. It gets as small as possible when
$x$ is as similar to $x_p$ as possible. This yields directly to the
solution formula.$\qed$
\end{proof}

View file

@ -5,7 +5,9 @@ paths are cubic splines. You also have to be able to calculate
how to steer to get or to remain on a path. A way to do this
is applying the \href{https://en.wikipedia.org/wiki/PID_algorithm}{PID algorithm}.
This algorithm needs to know the signed current error. So you need to
be able to get the minimal distance of a point to a cubic spline combined with the direction (left or right).
be able to get the minimal distance of a point (the position of the car)
to a cubic spline (the prefered path)
combined with the direction (left or right).
As you need to get the signed error (and one steering direction might
be prefered), it is not only necessary to
get the minimal absolute distance, but might also help to get all points
@ -22,3 +24,8 @@ of the underlying PID-related problem. So I will try to give
robust and easy-to-implement algorithms to calculated the distance
of a point to a (piecewise or global) defined polynomial function
of degree $\leq 3$.
When you're able to calculate the distance to a polynomial which is
defined on a closed invervall, you can calculate the distance from
a point to a spline by calculating the distance to the pieces of the
spline.

View file

@ -1,7 +1,13 @@
\chapter{Linear function}
\section{Defined on $\mdr$}
Let $f(x) = m \cdot x + t$ with $m \in \mdr \setminus \Set{0}$ and
$t \in \mdr$ be a linear function.
\begin{theorem}[Solution formula for linear functions on $\mdr$]
Let $f: \mdr \rightarrow \mdr $ be a linear function
$f(x) := m \cdot x + t$ with $m \in \mdr \setminus \Set{0}$ and
$t \in \mdr$ be a linear function.
Then the points $(x, f(x))$ with minimal distance are given by:
\[x = \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\]
\end{theorem}
\begin{figure}[htp]
\centering
@ -39,30 +45,32 @@ $t \in \mdr$ be a linear function.
\label{fig:linear-min-distance}
\end{figure}
Now you can drop a perpendicular $f_\bot$ through $P$ on $f(x)$. The
slope of $f_\bot$ is $- \frac{1}{m}$ and $t_\bot$ can be calculated:\nobreak
\begin{align}
f_\bot(x) &= - \frac{1}{m} \cdot x + t_\bot\\
\Rightarrow y_P &= - \frac{1}{m} \cdot x_P + t_\bot\\
\Leftrightarrow t_\bot &= y_P + \frac{1}{m} \cdot x_P
\end{align}
\begin{proof}
Now you can drop a perpendicular $f_\bot$ through $P$ on $f(x)$. The
slope of $f_\bot$ is $- \frac{1}{m}$ and $t_\bot$ can be calculated:\nobreak
\begin{align}
f_\bot(x) &= - \frac{1}{m} \cdot x + t_\bot\\
\Rightarrow y_P &= - \frac{1}{m} \cdot x_P + t_\bot\\
\Leftrightarrow t_\bot &= y_P + \frac{1}{m} \cdot x_P
\end{align}
The point $(x, f(x))$ where the perpendicular $f_\bot$ crosses $f$
is calculated this way:
\begin{align}
f(x) &= f_\bot(x)\\
\Leftrightarrow m \cdot x + t &= - \frac{1}{m} \cdot x + \left(y_P + \frac{1}{m} \cdot x_P \right)\\
\Leftrightarrow \left (m + \frac{1}{m} \right ) \cdot x &= y_P + \frac{1}{m} \cdot x_P - t\\
\Leftrightarrow x &= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\label{eq:solution-of-the-linear-problem}
\end{align}
The point $(x, f(x))$ where the perpendicular $f_\bot$ crosses $f$
is calculated this way:
\begin{align}
f(x) &= f_\bot(x)\\
\Leftrightarrow m \cdot x + t &= - \frac{1}{m} \cdot x + \left(y_P + \frac{1}{m} \cdot x_P \right)\\
\Leftrightarrow \left (m + \frac{1}{m} \right ) \cdot x &= y_P + \frac{1}{m} \cdot x_P - t\\
\Leftrightarrow x &= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\label{eq:solution-of-the-linear-problem}
\end{align}
There is only one point with minimal distance. I'll call the result
from line~\ref{eq:solution-of-the-linear-problem} \enquote{solution of
the linear problem} and the function that gives this solution
$S_1(f,P)$.
There is only one point with minimal distance. I'll call the result
from line~\ref{eq:solution-of-the-linear-problem} \enquote{solution of
the linear problem} and the function that gives this solution
$S_1(f,P)$.
See Figure~\ref{fig:linear-min-distance}
to get intuition about the geometry used.
See Figure~\ref{fig:linear-min-distance}
to get intuition about the geometry used. $\qed$
\end{proof}
\clearpage
\section{Defined on a closed interval $[a,b] \subseteq \mdr$}

View file

@ -40,13 +40,13 @@
\newtheorem{proof}{Proof:}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Minimal distance to polynomial functions of degree 3 or less}
\title{Minimal distance from a point to polynomial functions of degree 3 or less}
\author{Martin Thoma}
\hypersetup{
pdfauthor = {Martin Thoma},
pdfkeywords = {minimal distance, polynomial, function, degree 3, cubic, spline},
pdftitle = {Minimal distance to polynomial functions of degree 3 or less}
pdftitle = {Minimal distance from a point to polynomial functions of degree 3 or less}
}
\def\mdr{\ensuremath{\mathbb{R}}}

View file

@ -3,7 +3,7 @@ Let $f: D \rightarrow \mdr$ with $D \subseteq \mdr$ be a polynomial function and
be a point. Let $d_{P,f}: \mdr \rightarrow \mdr_0^+$
be the Euklidean distance of a point $P$ to a point $\left (x, f(x) \right )$
on the graph of $f$:
\[d_{P,f} (x) := \sqrt{(x_P - x)^2 + (y_P - f(x))^2}\]
\[d_{P,f} (x) := \sqrt{(x - x_P)^2 + (f(x) - y_P)^2}\]
Now there is finite set $M = \Set{x_1, \dots, x_n} \subseteq D$ of minima for given $f$ and $P$:
\[M = \Set{x \in D | d_{P,f}(x) = \min_{\overline{x} \in D} d_{P,f}(\overline{x})}\]
@ -20,6 +20,11 @@ about stationary points will be tremendously usefull:
Then: $f'(x_0) = 0$.
\end{theorem}
So in fact you can calculate the roots of $(d_{P,f}(x))'$ to get
candidates for minimal distance. These candidates include all points
with minimal distance, but might also contain more. Example~\ref{ex:false-positive}
shows such a situation.
Let $S_n$ be the function that returns the set of solutions for a
polynomial $f$ of degree $n$ and a point $P$:

View file

@ -0,0 +1,47 @@
$4 \alpha^3 + 27 \beta^2 \geq 0$:
The solution of Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
is
\[x = \frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}\]
When you insert this in Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
you get:\footnote{Remember: $(a-b)^3 = a^3-3 a^2 b+3 a b^2-b^3$}
\allowdisplaybreaks
\begin{align}
0 &\stackrel{!}{=} \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right )^3 + \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= (\frac{t}{\sqrt[3]{18}})^3
- 3 (\frac{t}{\sqrt[3]{18}})^2 \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}
+ 3 (\frac{t}{\sqrt[3]{18}})(\frac{\sqrt[3]{\frac{2}{3}} \alpha }{t})^2
- (\frac{\sqrt[3]{\frac{2}{3}} \alpha }{t})^3
+ \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= \frac{t^3}{18}
- \frac{3t^2}{\sqrt[3]{18^2}} \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}
+ \frac{3t}{\sqrt[3]{18}} \frac{\sqrt[3]{\frac{4}{9}} \alpha^2 }{t^2}
- \frac{\frac{2}{3} \alpha^3 }{t^3}
+ \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= \frac{t^3}{18}
- \frac{\sqrt[3]{18} t \alpha}{\sqrt[3]{18^2}}
+ \frac{\sqrt[3]{12} \alpha^2}{\sqrt[3]{18} t}
- \frac{2 \alpha^3 }{3t^3}
+ \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= \frac{t^3}{18}
- \frac{t \alpha}{\sqrt[3]{18}}
\color{red}+ \frac{\sqrt[3]{2} \alpha^2}{\sqrt[3]{3} t} \color{black}
- \frac{2 \alpha^3 }{3 t^3}
+ \color{red}\alpha \color{black} \left (\frac{t}{\sqrt[3]{18}} \color{red}- \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \color{black}\right )
+ \beta\\
&= \frac{t^3}{18} \color{blue}- \frac{t \alpha}{\sqrt[3]{18}} \color{black}
- \frac{2 \alpha^3 }{3 t^3}
\color{blue}+ \frac{\alpha t}{\sqrt[3]{18}} \color{black}
+ \beta\\
&= \frac{t^3}{18} - \frac{2 \alpha^3 }{3 t^3} + \beta\\
&= \frac{t^6 - 12 \alpha^3 + \beta 18 t^3}{18t^3}
\end{align}
Now only go on calculating with the numerator. Start with resubstituting
$t$:
\begin{align}
0 &= (\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta)^2 - 12 \alpha^3 + \beta 18 (\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta)\\
&= (\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)})^2 +(9\beta)^2 - 12 \alpha^3 -(2 \cdot 9)\cdot 9\beta^2\\
&= 3 \cdot (4 \alpha^3 + 27 \beta^2) -81 \beta^2 - 12 \alpha^3\\
&= 0
\end{align}

View file

@ -1,8 +1,8 @@
\todo[inline]{calculate...}
One solution is
\[x = \frac{(1+i \sqrt{3})\alpha}{\sqrt[3]{12} \cdot t}
-\frac{(1-i\sqrt{3}) t}{2\sqrt[3]{18}}\]
We will verify it in multiple steps. First, get $x^3$:
\begin{align}
x^3 &= \underbrace{\left (\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right)^3}_{=: \raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {1}}}}
\underbrace{- 3 \left(\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right)^2 \left(\frac{(1-i\sqrt{3})t}{2 \sqrt[3]{18}} \right)}_{=: \raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {2}}}}\\
@ -10,26 +10,23 @@
\underbrace{- \left(\frac{(1-i\sqrt{3})t}{2 \sqrt[3]{18}}\right)^3}_{=: \raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {4}}}}
\end{align}
Now simplify the summands:
Now simplify the summands of $x^3$:
\begin{align}
\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {1}}} &=
\left (\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right)^3\\
&= \frac{\alpha^3(1-3i\sqrt{3} - 3 \cdot 3 + \sqrt{27} i)}{12 t^3}\\
&= \frac{-8\alpha^3}{12 t^3}\\
&= \frac{-2 \alpha^3}{3 t^3}\\
\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {2}}} &=- 3 \left(\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right)^2 \left(\frac{(1-i\sqrt{3})t}{2 \sqrt[3]{18}} \right)\\
&= \frac{-3\alpha^2(1+2\sqrt{3}i-3)(1-i\sqrt{3})t}{t^2 \sqrt[3]{2^4 \cdot 3^2} \cdot 2 \sqrt[3]{2 \cdot 3^2}}\\
&= \frac{-3\alpha^2((1+2\sqrt{3}i - 3)+(- i\sqrt{3}+2\cdot 3 + i\sqrt{3}))}{12 t \sqrt[3]{12}}\\
&= \frac{-\alpha^2(4+2\sqrt{3}i)}{4t\sqrt[3]{12}}\\
&= \frac{-\alpha^2(2+\sqrt{3}i)}{2t\sqrt[3]{12}}\\
&= \frac{-3\alpha^2(-2(1-i\sqrt{3}))(1-i\sqrt{3})t}{t^2 \sqrt[3]{2^4 \cdot 3^2} \cdot 2 \sqrt[3]{2 \cdot 3^2}}\\
&= \frac{6\alpha^2 t (-2 (1+i \sqrt{3}))}{12 t^2 \sqrt[3]{12}}\\
&= \frac{- \alpha^2 (1+i\sqrt{3})}{t\sqrt[3]{12}}\\
\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {3}}} &= 3 \left(\frac{(1+i\sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \right) \left(\frac{(1-i\sqrt{3})t}{2 \sqrt[3]{18}}\right)^2\\
&= \frac{3(1+i\sqrt{3})\alpha (1-2i\sqrt{3} - 3)t}{4 \sqrt[3]{12 \cdot 18^2}}\\
&= \frac{3 \alpha t((1-2i\sqrt{3}-3)+(i\sqrt{3} + 2\cdot 3 - 3i\sqrt{3}))}{4 \sqrt[3]{2^2 \cdot 3 \cdot (2 \cdot 3^2)^2}}\\
&= \frac{3 \alpha t(4-4\sqrt{3}i)}{4 \cdot 2 \cdot 3 \sqrt[3]{2 \cdot 3^2}}\\
&= \frac{\alpha t(1-\sqrt{3}i)}{2\sqrt[3]{18}}\\
&= \frac{3\alpha t (1+i\sqrt{3})(-2(1+i\sqrt{3}))}{4 \cdot \sqrt[3]{12 \cdot 18^2}}\\
&= \frac{-\alpha t (-2 (1 - i \sqrt{3}))}{2 \sqrt[3]{12 \cdot 4 \cdot 3}}\\
&= \frac{\alpha t (1-i\sqrt{3})}{\sqrt[3]{2^4 \cdot 3^2}}\\
&= \frac{\alpha t (1-i\sqrt{3}}{2 \sqrt[3]{18}}\\
\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {4}}} &= - \left(\frac{(1-i\sqrt{3})t}{2 \sqrt[3]{18}}\right)^3\\
&= -\frac{(1-3i\sqrt{3} - 3 \cdot 3 + i \sqrt{27}) t^3}{8 \cdot 18}\\
&=- \frac{t^3 (-8)}{8 \cdot 18}\\
&=- \frac{(-8) t^3}{8 \cdot 18}\\
&= \frac{t^3}{18}
\end{align}
@ -37,10 +34,10 @@ Now get back to the original equation:
\begin{align}
0 &\stackrel{!}{=} x^3 + \alpha x + \beta \\
&= \left (\frac{-2 \alpha^3}{3 t^3}
+ \frac{-\alpha^2(2+\sqrt{3}i)}{2t\sqrt[3]{12}}
+ \color{red}\frac{-\alpha^2(1+\sqrt{3}i)}{t\sqrt[3]{12}}\color{black}
+ \color{blue}\frac{\alpha t(1-\sqrt{3}i)}{2\sqrt[3]{18}}\color{black}
+ \frac{t^3}{18} \right )\\
&\hphantom{{}=} + \color{blue}\alpha\color{black} \left (\frac{(1+i \sqrt{3})\alpha}{\sqrt[3]{12} \cdot t}
&\hphantom{{}=} + \alpha \left (\color{red}\frac{(1+i \sqrt{3})\alpha}{\sqrt[3]{12} \cdot t} \color{black}
\color{blue}-\frac{(1-i\sqrt{3}) t}{2\sqrt[3]{18}} \color{black} \right ) + \beta\\
&= \frac{-2 \alpha^3}{3 t^3}
+ \frac{\alpha^2(2(1+i\sqrt{3})-(2+\sqrt{3}i))}{2t\sqrt[3]{12}}

View file

@ -10,8 +10,7 @@
&= 12 \cdot \bigg (\frac{\overbrace{\sqrt[3]{12} \alpha (1-i \sqrt{3}) - t^2(1+i\sqrt{3})}^{\text{numerator}}}{12t} \bigg )^3
\end{align}
Now calculate the numerator$^3$. Remember, that $(1-i \sqrt{3})^2 = -2 (1+i \sqrt{3})$
and $(1 \pm i \sqrt{3})^3 = -8$.
Now calculate the numerator$^3$:
\begin{align}
\left (\sqrt[3]{12} \alpha (1-i \sqrt{3}) - t^2(1+i\sqrt{3}) \right )^3 &=
12 \alpha^3 (1-i\sqrt{3})^3 \\

View file

@ -59,18 +59,22 @@ There can be up to 3 solutions in such an equation. Those solutions
can be found with a closed formula. But not every solution of the
equation given by Theorem~\ref{thm:fermats-theorem}
has to be a solution to the given problem.
\begin{example}
\goodbreak
\begin{example}\label{ex:false-positive}
Let $a = 1, b = 0, c= 1, x_p= 0, y_p = 1$.
So $f(x) = x^2 + 1$ and $P(0, 1)$.
\begin{align}
0 &\stackrel{!}{=} 4 x^3 - 2x\\
&=2x(2x^2 - 1)\\
\Rightarrow x_1 &= 0 \;\;\; x_{2,3} = \pm \frac{1}{\sqrt{2}}
\end{align}
As you can easily verify, only $x_1$ is a minimum of $d_{P,f}$.
So $f(x) = x^2 - 1$ and $P(0, 1)$.
\begin{align}
\xRightarrow{\text{Equation}~\ref{eq:quadratic-derivative-eq-0}} 0 &\stackrel{!}{=} 2x^3 - 3x\\
&= x(2x^2-3)\\
\Rightarrow x_{1,2} &= \pm \sqrt{\frac{3}{2}} \text{ and } x_3 = 0\\
d_{P,f}(x_3) &= \sqrt{0^2 + (-1-1)^2} = 2\\
d_{P,f} \left (+ \sqrt{\frac{3}{2}} \right ) &= \sqrt{\left (\sqrt{\frac{3}{2} - 0} \right )^2 + \left (\frac{1}{2}-1 \right )^2}\\
&= \sqrt{\nicefrac{3}{2}+\nicefrac{1}{4}} \\
&= \sqrt{\nicefrac{7}{4}}\\
&= d_{P,f} \left (- \sqrt{\frac{3}{2}} \right )
\end{align}
This means $x_3$ is not a point of minimal distance, but with
$(d_{P,f}(x_3))' = 0$.
\end{example}
@ -81,8 +85,12 @@ As you can easily verify, only $x_1$ is a minimum of $d_{P,f}$.
\end{theorem}
\begin{proof}
The number of closests points of $f$ cannot be bigger than 3, because
Equation~\ref{eq:quadratic-derivative-eq-0} is a polynomial function
of degree 3. Such a function can have at most 3 roots.
In the following, I will do some transformations with $f = f_0$ and
$P = P_0$ .
$P = P_0$.
Moving $f_0$ and $P_0$ simultaneously in $x$ or $y$ direction does
not change the minimum distance. Furthermore, we can find the
@ -95,8 +103,8 @@ First of all, we move $f_0$ and $P_0$ by $\frac{b}{2a}$ in $x$ direction, so
Because:\footnote{The idea why you subtract $\frac{b}{2a}$ within
$f$ is that when you subtract something from $x$ before applying
$f$ it takes more time ($x$ needs to be bigger) to get to the same
situation. So to move the whole graph by $1$ to the left whe have
to add $+1$.}
situation. In consequence, if we want to move the whole graph by 1
to the left, we have to add $+1$.}
\begin{align}
f(x-\nicefrac{b}{2a}) &= a (x-\nicefrac{b}{2a})^2 + b (x-\nicefrac{b}{2a}) + c\\
&= a (x^2 - \nicefrac{b}{a} x + \nicefrac{b^2}{4a^2}) + bx - \nicefrac{b^2}{2a} + c\\
@ -117,15 +125,15 @@ Then compute:
&= \sqrt{x^2 + (ax^2-w)^2}\\
&= \sqrt{x^2 + a^2 x^4-2aw x^2+w^2}\\
&= \sqrt{a^2 x^4 + (1-2aw) x^2 + w^2}\\
&= \sqrt{\left (a^2 x^2 + \frac{1-2 a w}{2} \right )^2 + w^2 - (1-2 a w)^2}\\
&= \sqrt{\left (a^2 x^2 + \nicefrac{1}{2}-a w \right )^2 + \big (w^2 - (1-2 a w)^2 \big)}
&= \sqrt{\left (a x^2 + \frac{1-2 a w}{2a} \right )^2 + w^2 - (\frac{1-2 a w}{2a})^2}\\
&= \sqrt{\left (a x^2 + \nicefrac{1}{2a}- w \right )^2 + \big (w^2 - (\frac{1-2 a w}{2a})^2 \big)}
\end{align}
The term
\[a^2 x^2 + (\nicefrac{1}{2}-a w)\]
\[a^2 x^2 + (\nicefrac{1}{2a}- w)\]
should get as close to $0$ as possilbe when we want to minimize
$d_{P,{f_2}}$. For $w \leq \nicefrac{1}{2a}$ you only have $x = 0$ as a minimum.
For all other points $P = (0, w)$, there are exactly two minima $x_{1,2} = \pm \sqrt{aw - \nicefrac{1}{2}}$.
For all other points $P = (0, w)$, there are exactly two minima $x_{1,2} = \pm \sqrt{\frac{\frac{1}{2a} - w}{a}}$.
$\qed$
\end{proof}
@ -136,7 +144,7 @@ We start with the graph that was moved so that $f_2 = ax^2$.
In this case, we have already found the solution. If $w = y_P + \frac{b^2}{4a} - c > \frac{1}{2a}$,
then there are two solutions:
\[x_{1,2} = \pm \sqrt{aw - \nicefrac{1}{2}}\]
\[x_{1,2} = \pm \sqrt{\frac{\frac{1}{2a} - w}{a}}\]
Otherwise, there is only one solution $x_1 = 0$.
\textbf{Case 2:} $P = (z, w)$ is not on the symmetry axis, so $z \neq 0$. Then you compute:
@ -147,8 +155,7 @@ Otherwise, there is only one solution $x_1 = 0$.
0 &\stackrel{!}{=} \Big(\big(d_{P, {f_2}}(x)\big)^2\Big)' \\
&= 4a^2x^3 + 2(1- 2 aw)x +(- 2z)\\
&= 2 \left (2a^2x^2 + (1- 2 aw) \right )x - 2z\\
\Leftrightarrow 0 &\stackrel{!}{=} (2a^2x^2 + (1- 2 aw)) x - z\\
&= 2 a^2 x^3 + (1- 2 aw) x - z\\
\Leftrightarrow 0 &\stackrel{!}{=} 2a^2x^3 + (1- 2 aw) x - z\\
\Leftrightarrow 0 &\stackrel{!}{=} x^3 + \underbrace{\frac{1- 2 aw}{2 a^2}}_{=: \alpha} x + \underbrace{\frac{-z}{2 a^2}}_{=: \beta}\\
&= x^3 + \alpha x + \beta\label{eq:simple-cubic-equation-for-quadratic-distance}
\end{align}
@ -156,54 +163,15 @@ Otherwise, there is only one solution $x_1 = 0$.
Let $t$ be defined as
\[t := \sqrt[3]{\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta}\]
\textbf{Case 2.1:} $4 \alpha^3 + 27 \beta^2 \geq 0$:
The solution of Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
is
\[x = \frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}\]
I will make use of the following identities:
\begin{align*}
(1-i \sqrt{3})^2 &= -2 (1+i \sqrt{3})\\
(1+i \sqrt{3})^2 &= -2 (1-i \sqrt{3})\\
(1 \pm i \sqrt{3})^3 &= -8
\end{align*}
When you insert this in Equation~\ref{eq:simple-cubic-equation-for-quadratic-distance}
you get:\footnote{Remember: $(a-b)^3 = a^3-3 a^2 b+3 a b^2-b^3$}
\allowdisplaybreaks
\begin{align}
0 &\stackrel{!}{=} \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right )^3 + \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= (\frac{t}{\sqrt[3]{18}})^3
- 3 (\frac{t}{\sqrt[3]{18}})^2 \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}
+ 3 (\frac{t}{\sqrt[3]{18}})(\frac{\sqrt[3]{\frac{2}{3}} \alpha }{t})^2
- (\frac{\sqrt[3]{\frac{2}{3}} \alpha }{t})^3
+ \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= \frac{t^3}{18}
- \frac{3t^2}{\sqrt[3]{18^2}} \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t}
+ \frac{3t}{\sqrt[3]{18}} \frac{\sqrt[3]{\frac{4}{9}} \alpha^2 }{t^2}
- \frac{\frac{2}{3} \alpha^3 }{t^3}
+ \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= \frac{t^3}{18}
- \frac{\sqrt[3]{18} t \alpha}{\sqrt[3]{18^2}}
+ \frac{\sqrt[3]{12} \alpha^2}{\sqrt[3]{18} t}
- \frac{\frac{2}{3} \alpha^3 }{t^3}
+ \alpha \left (\frac{t}{\sqrt[3]{18}} - \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \right ) + \beta\\
&= \frac{t^3}{18}
- \frac{t \alpha}{\sqrt[3]{18}}
\color{red}+ \frac{\sqrt[3]{2} \alpha^2}{\sqrt[3]{3} t} \color{black}
- \frac{\frac{2}{3} \alpha^3 }{t^3}
+ \color{red}\alpha \color{black} \left (\frac{t}{\sqrt[3]{18}} \color{red}- \frac{\sqrt[3]{\frac{2}{3}} \alpha }{t} \color{black}\right )
+ \beta\\
&= \frac{t^3}{18} \color{blue}- \frac{t \alpha}{\sqrt[3]{18}} \color{black}
- \frac{\frac{2}{3} \alpha^3 }{t^3}
\color{blue}+ \frac{\alpha t}{\sqrt[3]{18}} \color{black}
+ \beta\\
&= \frac{t^3}{18} - \frac{\frac{2}{3} \alpha^3 }{t^3} + \beta\\
&= \frac{t^6 - 12 \alpha^3 + \beta 18 t^3}{18t^3}
\end{align}
Now only go on calculating with the numerator. Start with resubstituting
$t$:
\begin{align}
0 &= (\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta)^2 - 12 \alpha^3 + \beta 18 (\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)} -9\beta)\\
&= (\sqrt{3 \cdot (4 \alpha^3 + 27 \beta^2)})^2 +(9\beta)^2 - 12 \alpha^3 -18\cdot 9\beta^2\\
&= 3 \cdot (4 \alpha^3 + 27 \beta^2) -81 \beta^2 - 12 \alpha^3\\
&= (4 \alpha^3 + 27 \beta^2) -27 \beta^2 - 4 \alpha^3\\
&= 0
\end{align}
\textbf{Case 2.1:}
\input{quadratic-case-2.1}
\textbf{Case 2.2:}
\input{quadratic-case-2.2}