# Tor/Winkeloptimierung/Gradient/Aufgabe/Lösung

* Die Richtungsvektoren des Dreiecks im Eckpunkt $(x,y)$ sind ${\begin{pmatrix}x\\y\end{pmatrix}}-{\begin{pmatrix}1\\0\end{pmatrix}}={\begin{pmatrix}x-1\\y\end{pmatrix}}$ und ${\begin{pmatrix}x\\y\end{pmatrix}}-{\begin{pmatrix}-1\\0\end{pmatrix}}={\begin{pmatrix}x+1\\y\end{pmatrix}}$. Das Skalarprodukt dazwischen ist Nach Fakt ist der Winkel gleich
    $\left\langle {\begin{pmatrix}x-1\\y\end{pmatrix}},{\begin{pmatrix}x+1\\y\end{pmatrix}}\right\rangle =x^{2}+y^{2}-1\,.$
    ${\begin{aligned}\alpha (x,y)&=\arccos {\frac {\left\langle {\begin{pmatrix}x-1\\y\end{pmatrix}},{\begin{pmatrix}x+1\\y\end{pmatrix}}\right\rangle }{\Vert {\begin{pmatrix}x-1\\y\end{pmatrix}}\Vert \cdot \Vert {\begin{pmatrix}x+1\\y\end{pmatrix}}\Vert }}\\&=\arccos {\frac {x^{2}+y^{2}-1}{{\sqrt {(x-1)^{2}+y^{2}}}\cdot {\sqrt {(x+1)^{2}+y^{2}}}}}\\&=\arccos {\frac {x^{2}+y^{2}-1}{\sqrt {(x^{2}-1)^{2}+y^{4}+((x-1)^{2}+(x+1)^{2})y^{2}}}}\\&=\arccos {\frac {x^{2}+y^{2}-1}{\sqrt {x^{4}+y^{4}-2x^{2}+1+2x^{2}y^{2}+2y^{2}}}}.\end{aligned}}$
* Nach dem Satz des Thales (und seiner Umkehrung) ist dies der Halbkreis oberhalb des Tores.
* Wir müssen nach Fakt den Gradienten zur Funktion $\alpha (x,y)$ berechnen. Nach Aufgabe ist In unserer Situation ist Die partiellen Ableitungen von $z$ sind nach der Quotientenregel und Daher ist insgesamt
    ${\left(\arccos z\right)}'=-{\frac {1}{\sqrt {1-z^{2}}}}\,.$
    $z(x,y)={\frac {x^{2}+y^{2}-1}{\sqrt {x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}}\,.$
    ${\begin{aligned}&\,\,\,\,\,\,\,{\frac {\partial z}{\partial x}}(x,y)\\&={\frac {2x{\sqrt {x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}-{\left(x^{2}+y^{2}-1\right)}{\frac {2x^{3}+2xy^{2}-2x}{\sqrt {x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}}}{x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}\\&={\frac {2x{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}-{\left(x^{2}+y^{2}-1\right)}{\left(2x^{3}+2xy^{2}-2x\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {2x{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1-{\left(x^{2}+y^{2}-1\right)}{\left(x^{2}+y^{2}-1\right)}\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {2x{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1-x^{4}-y^{4}-1-2x^{2}y^{2}+2x^{2}+2y^{2}\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {8xy^{2}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\,\end{aligned}}$
    ${\begin{aligned}{\frac {\partial z}{\partial y}}(x,y)&={\frac {2y{\sqrt {x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}-{\left(x^{2}+y^{2}-1\right)}{\frac {2y^{3}+2x^{2}y+2y}{\sqrt {x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}}}{x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1}}\\&={\frac {2y{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}-{\left(x^{2}+y^{2}-1\right)}{\left(2y^{3}+2x^{2}y+2y\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {2y{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1-{\left(x^{2}+y^{2}-1\right)}{\left(x^{2}+y^{2}+1\right)}\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {2y{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1-x^{4}-y^{4}-2x^{2}y^{2}+1\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {2y{\left(-2x^{2}+2y^{2}+2\right)}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}\\&={\frac {-4x^{2}y+4y^{3}+4y}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}.\end{aligned}}$
    ${\begin{aligned}&\,\,\,\,\,\,\,{\frac {\partial \alpha (x,y)}{\partial x}}\\&=-{\frac {{\frac {\partial z}{\partial x}}(x,y)}{\sqrt {1-\left({\frac {x^{2}+y^{2}-1}{\sqrt {x^{4}+y^{4}-2x^{2}+1+2x^{2}y^{2}+2y^{2}}}}\right)^{2}}}}\\&=-{\frac {\frac {8xy^{2}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}^{3/2}}}{\sqrt {\frac {x^{4}+y^{4}-2x^{2}+1+2x^{2}y^{2}+2y^{2}-{\left(x^{2}+y^{2}-1\right)}^{2}}{x^{4}+y^{4}-2x^{2}+1+2x^{2}y^{2}+2y^{2}}}}}\\&=-{\frac {8xy^{2}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}{\left(x^{4}+y^{4}-2x^{2}+1+2x^{2}y^{2}+2y^{2}-{\left(x^{2}+y^{2}-1\right)}^{2}\right)}}}\\&=-{\frac {8xy^{2}}{{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}{\left(4y^{2}\right)}}}\\&=-{\frac {2x}{\left(x^{4}+2x^{2}y^{2}+y^{4}-2x^{2}+2y^{2}+1\right)}}.\,\end{aligned}}$