linear-functions.tex 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. \chapter{Linear function}
  2. \section{Defined on $\mdr$}
  3. \begin{theorem}[Solution formula for linear functions on $\mdr$]
  4. Let $f: \mdr \rightarrow \mdr $ be a linear function
  5. $f(x) := m \cdot x + t$ with $m \in \mdr \setminus \Set{0}$ and
  6. $t \in \mdr$ be a linear function.
  7. Then the points $(x, f(x))$ with minimal distance are given by:
  8. \[x = \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\]
  9. \end{theorem}
  10. \begin{figure}[htp]
  11. \centering
  12. \begin{tikzpicture}
  13. \begin{axis}[
  14. legend pos=north east,
  15. legend cell align=left,
  16. axis x line=middle,
  17. axis y line=middle,
  18. grid = major,
  19. width=0.8\linewidth,
  20. height=8cm,
  21. grid style={dashed, gray!30},
  22. xmin= 0, % start the diagram at this x-coordinate
  23. xmax= 5, % end the diagram at this x-coordinate
  24. ymin= 0, % start the diagram at this y-coordinate
  25. ymax= 3, % end the diagram at this y-coordinate
  26. axis background/.style={fill=white},
  27. xlabel=$x$,
  28. ylabel=$y$,
  29. tick align=outside,
  30. minor tick num=-3,
  31. enlargelimits=true,
  32. tension=0.08]
  33. \addplot[domain=-5:5, thick,samples=50, red] {0.5*x};
  34. \addplot[domain=-5:5, thick,samples=50, blue, dashed] {-2*x+6};
  35. \addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
  36. \addplot[blue, nodes near coords=$f_\bot$,every node near coord/.style={anchor=225}] coordinates {(1.5, 3)};
  37. \addplot[red, nodes near coords=$f$,every node near coord/.style={anchor=225}] coordinates {(0.9, 0.5)};
  38. \addlegendentry{$f(x)=\frac{1}{2}x$}
  39. \addlegendentry{$f_\bot(x)=-2x+6$}
  40. \end{axis}
  41. \end{tikzpicture}
  42. \caption{The shortest distance of $P$ to $f$ can be calculated by using the perpendicular}
  43. \label{fig:linear-min-distance}
  44. \end{figure}
  45. \begin{proof}
  46. With Theorem~\ref{thm:fermats-theorem} you get:
  47. \begin{align}
  48. 0 &\stackrel{!}{=} (d_{P,f}(x)^2)'\\
  49. &= 2(x-x_P) + 2 (f(x) - y_P)f'(x)\\
  50. \Leftrightarrow 0 &\stackrel{!}{=} x - x_P + (f(x) - y_P) f'(x)\\
  51. &= x- x_P + (mx+t - y_P)\cdot m\\
  52. &= x (m+1) + m(t-y_P) - x_P\\
  53. \Leftrightarrow x &\stackrel{!}{=} \frac{x_p - m(t-y_p)}{m^2+1}\\
  54. &= \frac{m}{m^2+1} \left ( y_P + \frac{1}{m} \cdot x_P - t \right )\label{eq:solution-linear-r}
  55. \end{align}
  56. It is obvious that a minium has to exist, the $x$ from Equation~\ref{eq:solution-linear-r}
  57. has to be this minimum.
  58. \end{proof}
  59. \clearpage
  60. \section{Defined on a closed interval $[a,b] \subseteq \mdr$}
  61. Let $f:[a,b] \rightarrow \mdr$, $f(x) := m\cdot x + t$ with $a,b,m,t \in \mdr$ and
  62. $a \leq b$, $m \neq 0$ be a linear function.
  63. \begin{figure}[htp]
  64. \centering
  65. \begin{tikzpicture}
  66. \begin{axis}[
  67. legend pos=north east,
  68. legend cell align=left,
  69. axis x line=middle,
  70. axis y line=middle,
  71. grid = major,
  72. width=0.8\linewidth,
  73. height=8cm,
  74. grid style={dashed, gray!30},
  75. xmin= 0, % start the diagram at this x-coordinate
  76. xmax= 5, % end the diagram at this x-coordinate
  77. ymin= 0, % start the diagram at this y-coordinate
  78. ymax= 3, % end the diagram at this y-coordinate
  79. axis background/.style={fill=white},
  80. xlabel=$x$,
  81. ylabel=$y$,
  82. tick align=outside,
  83. minor tick num=-3,
  84. enlargelimits=true,
  85. tension=0.08]
  86. \addplot[domain= 2:3, thick,samples=50, red] {0.5*x};
  87. \addplot[domain=-5:5, thick,samples=50, blue, dashed] {-2*x+6};
  88. \addplot[domain=1:1.5, thick, samples=50, orange] {3*x-3};
  89. \addplot[domain=4:5, thick, samples=50, green] {-x+5};
  90. \addplot[black, mark = *, nodes near coords=$P$,every node near coord/.style={anchor=225}] coordinates {(2, 2)};
  91. \draw[thick, dashed] (axis cs:2,2) -- (axis cs:1.5,1.5);
  92. \draw[thick, dashed] (axis cs:2,2) -- (axis cs:4,1);
  93. \addlegendentry{$f(x)=\frac{1}{2}x, D = [2,3]$}
  94. \addlegendentry{$f_\bot(x)=-2x+6, D=[-5,5]$}
  95. \addlegendentry{$h(x)=3x-3, D=[1,1.5]$}
  96. \addlegendentry{$h(x)=-x+5, D=[4,5]$}
  97. \end{axis}
  98. \end{tikzpicture}
  99. \caption{Different situations when you have linear functions which
  100. are defined on a closed intervall}
  101. \label{fig:linear-min-distance-closed-intervall}
  102. \end{figure}
  103. The point with minimum distance can be found by:
  104. \[\underset{x\in[a,b]}{\arg \min d_{P,f}(x)} = \begin{cases}
  105. S_1(f, P) &\text{if } S_1(f, P) \cap [a,b] \neq \emptyset\\
  106. \Set{a} &\text{if } S_1(f, P) \ni x < a\\
  107. \Set{b} &\text{if } S_1(f, P) \ni x > b
  108. \end{cases}\]
  109. \todo[inline]{argument? proof?}