\input{SingleAssignmentSetup.tex}
\input{../WeekTitles.tex}
\begin{document}

\begin{center}
\subsection*{MNTC P01 - Week \#2 - \WeekTitleTwo}
\end{center}

\subsection*{Linear Approximations and Tangent Lines}
\begin{enumerate}[1.]
\begin{multicols}{2}

  % ***************************************************************
\item
  \begin{Question}
    Find the equation of the tangent line to the graph of $f$ at
    (1,1), where $f$ is given by $f(x) = 2x^3 - 2x^2 + 1$.
  \end{Question}
  \begin{Solution}
    $f(x) = 2x^3 - 2x^2 + 1$.  \\
    In general, the slopes of the function are given by $f'(x) = 6x^2
    -
    4x$ \\
    At the point $(1,1)$ (which you should check is actually on the graph of $f(x)$!), the slope is \\
    $f'(1) = 6 - 4 = 2$ \\
    Using the point/slope formula for a line (or the tangent line
    formula), a line tangent to the graph of $f(x)$ at the point
    $(1,1)$ is
    \begin{align*} y & = f'(1) (x-1) + f(1)\\
      & = 2 (x-1) + 1 \\
      \mbox{ or } y & = 2x - 1
    \end{align*}

  \end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    \begin{enumerate}[(a)]
    \item Find the equation of the tangent line to $f(x) = x^3$ at
      $x=2$.
    \item Sketch the curve and the tangent line on the same axes, and
      decide whether using the tangent line to approximate $f(x) =
      x^3$ would produce {\em over-} or {\em under-}estimates of
      $f(x)$ near $x=2$.
    \end{enumerate}

  \end{Question}
  \begin{Solution}
    \begin{enumerate}[(a)]
    \item $f(x) = x^3$, so $f'(x) = 3x^2$.  \\
      At $x=2$, $f(2) = 8$ and $f'(2) = 12$, so the tangent line to
      $f(x)$ at $x=2$ is
$$ y = 12 (x-2) + 8$$
\item ~ \\
  \includegraphics[width=2.0in]{graphics/Week02_TangentLines/Tangent_x_cubed} \\
  From the graph of $y =x^3$, it is clear that the tangent line at
  $x=2$ will lie {\em below} the actual curve. This means that using
  the tangent line to estimate $f(x)$ values will produce {\em
    underestimates} of $f(x)$.
\end{enumerate}

\end{Solution}
% ***************************************************************
\item
  \begin{Question}
    Find the equation of the line tangent to the graph of \(f\) at
    \((3,57)\), where \(f\) is given by \(f(x)= 4 x^3 - 7 x^2 + 12\).
    \par \end{Question}
  \begin{Solution}
    Differentiating gives \(f'(x) = 12 x^2 - 14 x\), so \(f'(3) =
    66\).  Thus the equation of the tangent line is \(y - 57 = 66 ( x
    - 3 )\), or \(y = 57 + 66 (x - 3 )\).
    \par\end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    Given a power function of the form \(f(x)=ax^n\), with \(f'(3) =
    16\) and \(f'(6) = 128\), find \(n\) and \(a\).
    \par
    \par \end{Question}
  \begin{Solution}

    Since \(f(x)=ax^n\), \(f'(x)=anx^{n-1}\).  We know that
    \(f'(3)=(an)3^{n-1} = 16\), and \(f'(6) = (an) 6^{n-1} = 128\).
    Therefore,
    \[\frac{f'(6)}{f'(3)} = \frac{128}{16} = 8.\]
    But
    \[\frac{f'(6)}{f'(3)} = \frac{(an)6^{n-1}}{(an)3^{n-1}} =
    2^{n-1},\] so \(2^{n-1} = 8\), and so \(n = 4\).
    \par
    Substituting \(n=4\) into the expression for \(f'(3)\), we get \(4
    a 3^{3} = 16\), so \(a = \frac{4}{27}\).
    \par\end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    Find the equation of the line tangent to the graph of \(f\) at
    \((2,1)\), where \(f\) is given by \(f(x)= 2 x^3 - 5 x^2 + 5\).
    \par \end{Question}
  \begin{Solution}

    Differentiating gives \(f'(x) = 6 x^2 - 10 x\), so \(f'(2) = 4\).
    Thus the equation of the tangent line is \(y - 1 = 4 ( x - 2 )\),
    or \(y = 1 + 4 (x - 2 )\).
    \par\end{Solution}

  % *******************************
\item
  \begin{Question}

\par
Find all values of \(x\) where the tangent lines to \(y=x^{8}\) and
\(y=x^{9}\) are parallel.
\par \end{Question}
\begin{Solution}

  Let \(f(x)=x^{8}\) and let \(g(x)=x^{9}\). The two graphs have
  parallel tangent lines at all \(x\) where \(f'(x)=g'(x)\).
  \[f'(x) = g'(x)\]
  \[8x^{7} = 9x^{8}\]
  \[8x^{7}-9x^{8} = 0\]
  \[x^{7}\!\left(8-9x\right) = 0\] hence, \(x=0\) or
  \(x=\frac{8}{9}\).

  The point at $x=0$ is easy to visualize (both graphs are flat
  there).  Here is a graph showing the parallel tangents at $x=8/9$.

  \includegraphics[width=0.8\linewidth]{graphics/Week02_TangentLines/TangentTo_x8_x9}
  \par\end{Solution}
% ***************************************************************
\item
  \begin{Question}
    Consider the function \(f(x)=9-e^x\).
    \begin{enumerate}[(a)]
    \item Find the slope of the graph of \(f(x)\) at the point where
      the graph crosses the \(x\)-axis.
      \par
    \item

      Find the equation of the tangent line to the curve at this
      point.
      \par
    \item Find the equation of the line perpendicular to the tangent
      line at this point. (This is the {\it normal} line.)
    \end{enumerate}
    \par \end{Question}
  \begin{Solution}
    \begin{enumerate}[(a)]
    \item \(f(x) = 9-e^x\) crosses the \(x\)-axis where \(0 = 9
      -e^x\), which happens when \(e^x = 9\), so \(x = \ln 9\).  Since
      \(f'(x) = -e^{x}\), \(f'(\ln 9) = -9\).
      \par
    \item \(y = -9 ( x - \ln(9) )\).
      \par
    \item The slope of the normal line is the negative reciprocal of
      the slope of the tangent, so \(y = \frac{1}{9} (x - \ln(9))\).
    \end{enumerate}
    \par\end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    Consider the function $y = 2^x$.
    \begin{enumerate}[(a)]
    \item Find the tangent line based at $x=1$, and find where the
      tangent line will intersect the $x$ axis.
    \item Find the point on the graph $x=a$ where the tangent line
      will pass through the origin.
    \end{enumerate}
  \end{Question}
  \begin{Solution}
    \begin{enumerate}[(a)]
    \item  We find the linearization using $f(x) = 2^x$, so
$f'(x) = 2^x \ln(2)$ (non-$e$ exponential derivative rule).

At the point $x=1$, $f(1) = 2^1 = 2$ and $f'(1) = 2^1 \ln(2)$, so the linear approximation to $f(x)$ is

$L(x) = 2+(2 \ln(2))(x-1)$.

Solving for where this line intersects the $x$ axis (or the $y=0$
line), we find the $x$ intercept is approximately -0.4427.

\item This question is more general.  Instead of asking for a
  linearization at a specific point, it is asking ``at what point
  would the linearization pass through the origin?''  Let us give the
  point a name: $x=a$ (as opposed to $x=1$ used in part (a)).

From the function and the derivatives, the linearization at the point $x=a$ is given by:
$$L_a(x) = \underbrace{2^a}_{f(a)} + \underbrace{2^a \ln(2)}_{f'(a)}(x-a)$$

That is true in general, but we want the point $x=a$ where the
linearization will go through $(0,0)$, i.e. for which $L_a(0) = 0$:
\begin{align*}
0 & = 2^a + 2^a \ln(2) (0-a)  \\
\mbox{ Solving for }a,~~~~~ 0 & = 2^a (1 - a \ln(2)) \\
0 & = 1 - a \ln(2) \\
a \ln(2)  & = 1  \\
a & = \frac{1}{\ln(2)} \approx 1.442  \\
\end{align*}
At that $x$ point, the graph of $y = 2^x$'s tangent line will pass
exactly through the origin.
    \end{enumerate}
  \end{Solution}

  % ***************************************************************
\item
  \begin{Question}
    \begin{enumerate}[(a)]
    \item Find the tangent line approximation to $f(x) = e^x$ at
      $x=0$.
    \item Use a sketch of $f(x)$ and the tangent line to determine
      whether the tangent line produces over- or under-estimates of
      $f(x)$.
    \item Use your answer from part (b) to decide whether the
      statement $e^x \ge 1 + x$ is always true or not.
    \end{enumerate}
  \end{Question}
  \begin{Solution}
    \begin{enumerate}[(a)]
    \item $f(x) = e^x$, so $f'(x) = e^x$ as well.\\
To build the tangent line at $x=0$, we use $a=0$ as our reference point:
$f(0) = e^0 = 1$, and $f'(0) = e^0 = 1$.
The tangent line is therefore \\
$l(x) = 1 (x-0) + 1 = x + 1$
\item  ~ \\
\includegraphics[width=0.8\linewidth]{graphics/Week02_TangentLines/exp_tangent}

Since the exponential graph is concave up, it curves upwards away from
the graph.  This means that the linear approximation will always be an
under-estimate of the original function.
\item Since the linear function will always underestimate the value of $e^x$, we can
conclude that
$$1+x \le e^x$$, and they will be equal only at the tangent point, $x=0$.
\end{enumerate}

  \end{Solution}

  % ***************************************************************
\item
  \begin{Question}
   The speed of sound in dry air is
$$f(T) = 331.3 \sqrt{1 + \frac{T}{273.15}} \mbox{m/s} $$
where $T$ is the temperature in degrees Celsius.  Find a linear
function that approximates the speed of sound for temperatures near
$0^o$ C.
  \end{Question}
  \begin{Solution}

  \begin{align*}
    f(T) & = 331.3 \sqrt{1 + \frac{T}{273.15}} \\
 f'(T) & = 331.3 \left(\frac{1}{2}\right) \left(\frac{1}{\sqrt{1 + \frac{T}{273.15}}}\right) \frac{1}{273.15}
\end{align*}
  \begin{align*}
    \mbox{ so at } T = 0^o \mbox{ C}, ~~~ f(0) & = 331.3 & f'(0) & =
    \frac{331.3}{(2)(273.15)} \approx 0.606
  \end{align*}
  Thus the speed of sound for air temperatures around $0^o$ C is
$$f(T) \approx 0.606 (T - 0) + 331.3, \mbox{ or } f(t) \approx 0.606 T + 331.3 \mbox{ m/s}$$

  \end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    Find the equations of the tangent lines to the graph of $y =
    \sin(x)$ at $x=0$, and at $x=\pi/3$.
    \begin{enumerate}
    \item Use each tangent line to approximate $\sin(\pi/6)$.
    \item Would you expect these results to be equally accurate, given
      that they are taken at equal distances on either side of
      $\pi/6$?  If there is a difference in accuracy, can you explain
      it?
    \end{enumerate}

  \end{Question}
  \begin{Solution}
    \begin{enumerate}[(a)]
  \item At $x=0$, the tangent line is defined by
$f(0) = 0$ and $f'(0) = 1$, so
$$y = 1(x-0) + 0 = x$$
is the tangent line to $f(x)$ at $\ds x=\frac{\pi}{3}$.

  At $\ds x=\frac{\pi}{3}$, the tangent line is defined by
$(\pi/3) = \frac{\sqrt{3}}{2}$ and $f'(\pi/3) = \frac{1}{2}$, so
$$y = \frac{1}{2}\left(x-\frac{\pi}{3}\right) + \frac{\sqrt{3}}{2}$$
is the tangent line to $f(x)$ at $x=0$.

The estimates of each tangent line at the point $x=\pi/6$ would be
\begin{itemize}
\item Based on $x=0$ tangent line, $f(x) \approx x$, so $f(\pi/6) \approx
  \pi/6 \approx 0.5236 $.
\item Based on $x=\pi/3$ tangent line,
$\ds f(x) \approx  \frac{1}{2}\left(x-\frac{\pi}{3}\right) + \frac{\sqrt{3}}{2}$, \\
so
$\ds f(\pi/6) \approx  \frac{1}{2}\left(\pi/6-\frac{\pi}{3}\right) + \frac{\sqrt{3}}{2} \approx 0.6042 $
\item The {\bf actual} value of $f(x) = \sin(x)$ at $x= \pi/6$ is
  $\sin(\pi/6) = 0.5$.
\end{itemize}
\item From these calculations, the estimate obtained by using the
  tangent line based at $x=0$ gives the more accurate prediction for
  $f(x)$ at $x=\pi/6$

A sketch might help explain these results.

\includegraphics[width=0.8\linewidth]{graphics/Week02_TangentLines/Sine_tangents}

In the interval $x \in [0, \pi/6]$, the function stays very close to
linear (i.e. does not curve much), which means that the tangent
line stays a good approximation for a relatively long time.

The function is most curved/least linear around its peak, so the
linear approximation around $x = \pi/3$ is less accurate even over the
same $\Delta x$.
    \end{enumerate}

  \end{Solution}

%   % ***************************************************************
% \item
%   \begin{Question}
%     Find the {\bf quadratic} polynomial $g(x) = ax^2 + bx + c$ which
%     best fits the function $f(x) = e^x$ at $x=0$, in the sense that
% $$ g(0) = f(0), g'(0) = f'(0), \mbox{ and  } g''(0) = f''(0)$$
% \end{Question}
% \begin{Solution}
% \begin{align*}
% f(x) & = e^x \\
% \mbox{ so } f'(x) = e^x \\
% \mbox{ and } f''(x) = e^x \\
% \mbox{Evaluating at $x=0$,} \\
% f(0) = f'(0) = f''(0) & = 1 \\
%   \end{align*}
% Comparing with the derivatives of the quadratic,
% \begin{align*}
% g(x) & = ax^2 + bx + c \\
% \mbox{ so } g'(x) = 2ax + b \\
% \mbox{ and } g''(x) = 2a \\
% \mbox{Evaluating at $x=0$,} \\
% g(0) = c, g'(0) = b, & \mbox{ and } g''(0) = 2a
%   \end{align*}
%   For $g(x)$ to fit the shape of $f(x)$ near $x=0$, we would then pick
%   $c = 1$, $b = 1$ and $2a= 1$ or $a= 0.5$, so
% $$ g(x) = 0.5 x^2 + x + 1$$
% would be the best fit quadratic to $f(x) = e^x$ near $x=0$.

% Here is a graph of the two functions, $f(x) = e^x$ in black, $g(x) = 0.5 x^2 + x + 1$ in red.
% Notice how similar they look near their intersection.

% \includegraphics[width=0.8\linewidth]{graphics/Week02_TangentLines/Exp_quadratic_fit}

% \end{Solution}

% ***************************************************************
\item
  \begin{Question}
    Consider the graphs of $y = \sin(x)$ (regular sine graph), and $y
    = k e^{-x}$ (exponential decay, but scaled vertically by $k$).

    If $k \ge 1$, the two graphs will intersect.  What is the smallest
    value of $k$ for which two graphs will be {\em tangent} at that
    intersection point?

  \end{Question}
  \begin{Solution}
Let $f(x) = \sin(x)$ and $g(x) = k e^{-x}$.  They intersect
  when $f(x) = g(x)$, and they are tangent at that intersection if
  $f'(x) = g'(x)$ as well.  Thus we must have
  \begin{align*}
    \sin(x) & = k e^{-x} & \mbox{ and } \cos(x) & = -k e^{-x}
  \end{align*}
  We can't solve either equation on its own, but we can divide one by
  the other:
  \begin{align*}
    \frac{\sin(x)}{\cos(x)} & = \frac{k e^{-x}}{-ke^{-x}} \\
    \tan(x) & = -1 \\
    x & = \frac{3\pi }{4}, \frac{7 \pi}{4}, \ldots \\
  \end{align*}
  Since we only need one value of $k$, we try the first value, $x = 3
  \pi/4$.
\begin{align*}
\sin(3\pi/4) & = k e^{-3\pi/4} \\
\frac{1}{\sqrt{2}} e^{3\pi/4} & = k  \\
k & \approx 7.46
\end{align*}
We confirm our answer by verifying both the values and derivatives are
equal at $x = 3\pi/4$,
  \begin{align*}
    \sin(3 \pi / 4) & = 7.46 e^{-3\pi/4} \approx 0.7071  \mbox{ (same $y$: intersection)}\\
 \mbox{ and } \cos(3\pi/4) & = -7.46 e^{-3\pi/4} \approx -0.7071  \mbox{ (same derivative)}
  \end{align*}

  The actual point of tangency is at $\ds (x, y) = \left(\frac{3\pi}{4},
    \frac{1}{\sqrt{2}}\right)$.  A sketch is shown below.

  \includegraphics[width=0.8\linewidth]{graphics/Week02_TangentLines/Sine_exp_tangency}

  \end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    \begin{enumerate}[(a)]
    \item Show that $1 + kx$ is the local linearization of $(1+x)^k$ near $x=0$.
    \item Someone claims that the square root of 1.1 is about 1.05.
      Without using a calculator, is this estimate about right, and
      how can you decide using part (a)?
    \end{enumerate}

  \end{Question}
  \begin{Solution}
  \begin{enumerate}[(a)]
    \item\begin{align*}
       f(x) & = (1 + x)^k & f'(x) & = k (1+x)^{k-1}   \\
\mbox{ so at } x = 0, ~~~ f(0) & = 1^k = 1 & f'(0) &= k (1^{k-1}) = k\\
  \end{align*}
so the tangent line at $x=0$ will be
$$y = k (x-0) + 1 \mbox{ or } y = 1 + kx$$
\item As an estimate for the square root of $1.1$, we could note that
  $\sqrt{1.1} = (1 + 0.1)^{1/2}$. This matches exactly the form of
  $f(0.1)$ if we choose $k = \frac{1}{2}$. From our linearization
  above,
$$f(0.1) \approx 1 + \frac{1}{2}(0.1) = 1.05$$
so yes, a good approximation for $\sqrt{1.1}$ is 1.05.  (Calculator
gives the value of $\approx 1.0488$.
  \end{enumerate}
  \end{Solution}

  % ***************************************************************
\item
  \begin{Question}
    \begin{enumerate}
    \item Find the local linearlization of $e^x$ near $x=0$.
    \item Square your answer to part (a) to find an approximation to
      $e^{2x}$.
    \item Compare your answer in part (b) to the actual linearization
      to $e^{2x}$ near $x=0$, and discuss which is more accurate.
    \end{enumerate}
  \end{Question}
  \begin{Solution}
    \begin{enumerate}[(a)]
    \item $e^x$ has a tangent line/local linearization near $x=0$ of
      $y = x + 1$ (slope 1, point (0, 1)).

    \item Multiplying this approximation by itself, we get
      $(e^x)(e^x)$ or $e^{2x} \approx (x+1)(x+1) = x^2 + 2x + 1$

    \item To compare with the actual linearization of $g(x) = e^{2x}$,
      we find its derivative and value at $x=0$,
  \begin{align*}
    g(x) & = e^{2x} & g(0) & = 1 \\
g'(x) & = 2 e^{2x} & g'(0) & = 2 \\
  \end{align*}
  so a linearization of $g(x) = e^{2x}$ near $x=0$ is $y = 2 (x-0) + 1$ or
$$ y = 2x + 1$$
Note that his is the same as the approximation we obtained before,
except that our product version had an additional term, $x^2$.

These approximations give the same straight-line estimate of the
function, but I would expect the first (multiplication) version to be
more accurate because it contains more information (the squared term
that the pure linear approximation was missing).

We will see more of this idea in Taylor polynomials and Taylor series.
    \end{enumerate}
  \end{Solution}
  % ***************************************************************
\item
  \begin{Question}
    \begin{enumerate}
    \item Show that $1-x$ is the local linearization of $\ds
      \frac{1}{1+x}$ near $x=0$.
    \item From your answer to part (a), show that near $x=0$,
      $$\frac{1}{1+x^2} \approx 1-x^2.$$
    \item Without differentiating, what do you think the derivative of
      $\ds \frac{1}{1+x^2}$ is at $x=0$?
    \end{enumerate}

  \end{Question}
  \begin{Solution}

  \begin{enumerate}[(a)]
  \item Let $f(x) = 1/(1+x)$.  Then $f'(x) = \frac{-1}{(1+x)^2}$. \\
    At $x=0$, $f(0) = 1$ and $f'(0) = -1$. \\
    So near $x=0$, $f(x) \approx -1 x + 1 = -x + 1$ \\
  \item For small $x$ values (i.e. $x$ near zero), we can approximate
    $1/(1+x)$ with $1-x$.  Replace the variable $x$ with $y$ (because
    the name doesn't matter),
$$1/(1+y)  \approx 1-y$$
If we choose $y$ small but equal to $x^2$, then
$$\frac{1}{1 + x^2} \approx 1-x^2$$
\item The linearization of $1/(1+x^2)$ is the linear part of $1 -
  x^2$, or just $1$.  Since the derivative at $x=0$ is the coefficient
  for $x$ in the linear part, this means $\ds \ddx ~\frac{1}{1+x^2}$ at $x=0$
  must equal zero.
\end{enumerate}
  \end{Solution}
  % ***************************************************************
% \item
%   \begin{Question}
%     \begin{enumerate}[(a)]
%     \item Find the local linearization of

%       \[f(x) = \frac{1}{1 + 2 x}\] near \(x = 0\).
%     \item Using your answer to (a), what quadratic function would you
%       expect to approximate \(\displaystyle g(x) = \frac{1}{1 + 2
%         x^2}\)?
%       \par
%     \item Using your answer to (b), what would you expect the
%       derivative of \(\frac{1}{1 + 2 x^2}\) to be even without doing
%       any differentiation?
%     \end{enumerate}
%     \par \end{Question}
%   \begin{Solution}

%     \begin{enumerate}[(a)]
%     \item We know \(f(0) = 1\) and \(f'(0) = -\frac{2}{(1 + 2(0))^2} =
%       -2\), so the local linearization is \(f(x)\approx 1 - 2 x\).
%       \par
%     \item Next, \(g(x) = f(x^2)\), so we expect that \(g(x) \approx 1
%       - 2 x^2\).
%       \par
%     \item Noting that the approximation we found in (b) is downward
%       opening parabola with vertex on the \(y\)-axis, we expect that
%       the derivative of \(g(x)\) at \(x=0\) will be zero.
%     \end{enumerate}
%     \par\end{Solution}

  % ***************************************************************
\end{multicols}
\hrulefill

\subsection*{MATLAB Graphing}
\item
  \begin{Question}
Create a smooth-looking graph of the function $y = \cos(x)$, $x$
  in radians, on the interval $[-\pi, 5\pi]$.
  \end{Question}
  \begin{Solution}

\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W02GraphCos.m}{W02GraphCos.m}

\lstinputlisting{MATLAB/W02GraphCos.m}

Note that using \verb@x = -pi:(5*pi)@ does {\em not} create a smooth
graph, because too few points are used
($x = -3.14, -2.14, -1.14, \ldots$, etc.).  MATLAB plots {\em points},
and {\em not functions}, and if you use too few points in a graph, it
looks awful. That is why defining your graphing \verb@x@ coordinates
using \texttt{linspace}, which by default uses 100 points, is
recommended at is usually enough points for a smooth-looking graph.
  \end{Solution}

% ******************************
\item
  \begin{Question}
Create a smooth-looking graph of the function $y = e^{-x^2}$,
  over the interval $[-3, 3]$.
  \end{Question}
\begin{Solution}
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W02GraphBell.m}{W02GraphBell.m}

\lstinputlisting{MATLAB/W02GraphBell.m}
\end{Solution}

\item
  \begin{Question}
    It is common in scientific plots to draw functions as lines, and
    plot data as distinct points.

    The following points mark the distance between Saturn and several
    of its moons:

\begin{tabular}{cccccccccc}
Planet/Object & Mercury& 	Venus& 	Earth& 	Mars& 	Jupiter& 	Saturn& 	Uranus& 	Neptune& 	Pluto \\
Mean Distance (AU), $d$& 0.39& 	0.72& 	1& 	1.52& 	5.20& 	9.54& 	19.18& 	30.06& 	39.44 \\
Period (Earth years), $T$  & 0.24&	0.62&	1&	1.88&	11.86&	29.46&	84.01&	164.8&	247.7 \\
\end{tabular}

The best-fit curve to this data is given by the formula $T = d^{3/2}$.

Plot both the raw data (as points) and best fit curve (as a line) on a
single graph. The best-fit graph should look smooth.
\end{Question}

\begin{Solution}
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W02GraphPlanets.m}{W02GraphPlanets.m}

\lstinputlisting{MATLAB/W02GraphPlanets.m}
\end{Solution}

\hrulefill
\subsection*{Newton's Method}
\begin{multicols}{2}
  % ***************************************************************
\item
  \begin{Question}
    Consider the equation $e^x + x = 2$.  This equation has a solution
    near $x=0$.  By replacing the left side of the quation by its
    linearization near $x=0$, find an approximate value for the
    solution.

    (In other words, perform one step of Newton's method, starting at
    $x=0$, by hand.)

  \end{Question}
  \begin{Solution}
    Our equation is
\begin{align*}
\underbrace{e^x + x}_{f(x)} = 2
\end{align*}
To find the linearization of $f(x)$ near $x=0$, we need $f$ and its
derivative $f'$, both evaluated at $x=0$.
\begin{align*}
  f(x) & = e^x + x   & \mbox{ so } f(0) = e^0 + 0 = 1 \\
  f'(x) & = e^x + 1   & \mbox{ so } f'(0) = e^0 + 1 = 2 \\
\end{align*}
The linearization is then
$$ e^x + x \approx \underbrace{(2)}_{f'(0)}(x-0) + \underbrace{1}_{f(0)} = 2x + 1$$
We now replace the original (unsolvable) equation
\begin{align*}
  e^x + x & = 2 \\
\mbox{ with the simpler approximation: ~~~~~~} 2x + 1 & = 2 \\
\end{align*}
Solving this second version is straightforward, yielding $x=0.5$.
This is actually a fair approximation to the solution, since
$e^{0.5} + 0.5 \approx 2.149$ which is close to the equation RHS
value, 2.

(If we continued our linearizations and their approximations, we would
get values even closer to the real solution, which is (to 4 decimal
places) 0.4429.)

  \end{Solution}

  % ***************************************************************
\item
  \begin{Question}
    Use Newton's Method with the equation \(x^2=2\) and initial
    value \(x_0=3\) to calculate \(x_1 , x_2 , x_3\) (the next three
    solution estimates generated by Newton's method). Do the calculations by hand.
  \end{Question}
  \begin{Solution}

\par
Moving everything to the left side, we get $$ \underbrace{x^2 - 2}_{f(x)}  = 0$$
Differentiating, we have \(f'(x)= 2x\).  Therefore: \par
\(\ds x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}= x_0 - \frac{x_0^2 - 2}{2
  x_0} = 3 - \frac{3^2 - 2}{2 * 3} = 1.83333\) \par
\(\ds x_2 = x_1 - \frac{f(x_1)}{f'(x_1)}= 1.83333 - \frac{1.83333^2 -
  2}{2 \times 1.83333} \approx 1.46212\) \par
\(\ds x_3 = x_2 - \frac{f(x_2)}{f'(x_2)}= 1.46212 - \frac{1.46212^2 -
  2}{2 \times 1.46212} \approx 1.415\) \par
\par
This sequence provides successive approximations to the exactly
solution,which would equal \par
\(\sqrt 2 \approx 1.4142\)
\par\end{Solution}
% ***************************************************************
\item
  \begin{Question}
    Using MATLAB, write a script that applies Newton's Method to solve
    the equation \(x^3=5\).  Use 10 iterations of Newton's method. \\
    Compute the values of $x^3$ when you are done to confirm that it
    is close to 5.
  \end{Question}

    \begin{Solution}
Moving everything to the left side, we get
$$ \underbrace{x^3 - 5}_{f(x)} = 0$$ Differentiating, we have
\(f'(x)= 3x^2\).

Solution script:  \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W02Newton1.m}{W02Newton1.m}

\lstinputlisting[firstline=4]{MATLAB/W02Newton1.m}

\par\end{Solution}
% ***************************************************************
\item
  \begin{Question}
    Use Newton's Method to approximate \(4^{\frac{1}{3}}\) and compare
    with the value obtained from a calculator.

    (Hint: write out a simple equation that \(4^{\frac{1}{3}}\) would
    satisfy, and use Newton's method, with MATLAB, to solve that.)
    \par
    \par \end{Question}
  \begin{Solution}

\par
We need to find an approximation to \(4^{\frac{1}{3}}\) using Newton's
Method. An equation that would satisfy this relationship is
$$x = \sqrt[3]{4}$$, but that's something we can solve by inspection.
If we cube both sides though we get
$$x^3 = 4$$
which is a reasonable equation for solving.

Moving everything to the left side, we get the equivalent equation
$$x^3 - 4 = $$, which means for Newton's method we will use
\(f(x) = x^3-4\), and so \(f'(x) = 3x^2\).

Solution script:  \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W02NewtonCubeRoot.m}{W02NewtonCubeRoot.m}

\lstinputlisting[firstline=4]{MATLAB/W02NewtonCubeRoot.m}
\par\end{Solution}

% ***************************************************************
\item
  \begin{Question}
Consider the equation $ 10 x e^{-2x} = 0.4$.
\begin{enumerate}[(a)]
\item On a single set of axes, draw both the graphs $y = 10 x e^{-2x}$
  and $y = 0.4$.  The $x$ locations of the intersections between these
  two graphs are the solutions.
\item Continue your MATLAB script so that you use Newton's Method to
  find {\bf both} solutions to $10 x e^{-2x} = 0.4$.
\item Confirm both solutions by subbing them into the original
  equation and verifying that the left and right hand sides of the
  equation are equal.
\end{enumerate}
  \end{Question}

  \begin{Solution}
(a) and (b)  Solution script:  \\
\href{http://www.mast.queensu.ca/~apsc171/MNTCP01/PracticeProblems/MATLAB/W02NewtonXExp.m}{W02NewtonXExp.m}

\lstinputlisting[firstline=4,lastline=33]{MATLAB/W02NewtonCubeRoot.m}
\begin{enumerate}
\item[(c)]  The two solutions found by MATLAB were $x$ = 0.0436 and 1.9411. \\
  \begin{align*}
   x  = 0.0436: & \\    10 (0.0436) e^{(-2)(0.0436)} & = 0.3996 \mbox{ (very close to 0.4)} \\
   x  = 1.9411: &  \\  10 (1.9411) e^{(-2)(1.9411} & = 0.4000 \mbox{ (approx equal to 0.4)}
  \end{align*}
\end{enumerate}

\par\end{Solution}
\end{multicols}

\end{enumerate}
\end{document}


\section{haha}

	\lem{}{Let two rays $ h, i $ from point $ P $ and a fixed line $ l $. $ H_2 $ on $ h $ and $ E_2 $ be another point such that $ E_2\in i $ and $ H_2E_2\parallel l$. $ H_1 $ be another point on the plain. $ Z $ is a point on $ H_1H_2 $ such that $ E_2Z\parallel PH_1 $. Prove that as $ H_2 $ moves on $ h $, $ Z $ moves on a line parallel to $ h $}

	\proof{Let $ N\in PH_1 $ such that $ ZN\parallel h $. We will prove that as $ H_2 $ moves, $ \dfrac{PN}{NZ} $ stays constant.

		\figdf{.5}{ISL2009G6_lemma}{}

	If we take $ M = E_2Z\cap h $, we see that,
	\[\frac{PN}{NH_1}=\frac{H_2Z}{ZH_1}=\frac{H_2M}{MP}\]
	which is constant since $ PH_1 $ and $ l $ is constant. \hfill \qed}

	\bigskip

	Now looking at our main problem, we see that if we move $ C $ and $ D $ on $ H_1A $ and $ H_1B $, keeping $ CD $ parallel to a fixed line, we see that if for some $ C $ the problem is true, then it's true for all other $ C $. Because, moving $ C $, moves $ H_2 $, $ E_2 $ along two fixed lines going though $ P $, and the perpendicular from $ E_2 $ to $ AB $ is parallel to $ PH_1 $. So the intersection of the perpendicular from $ E_2 $ to $ AB $ with $ H_1, H_2 $ lies on a line perpendicular to $ CD $.

	\bigskip

	So we are done if we can show the result for $ C=A $.


\documentclass[letterpaper]{article}

\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[vmargin=1in,hmargin=1.25in]{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{microtype}
\usepackage{lmodern}

\title{ECE/CSE 576, Spring 2019 Homework 3: Content-Based Image Retrieval}
\author{Philip Pham}
\date{\today}

\begin{document}
\maketitle

\section{Algorithm}

For each image, we performed $k$-means clustering with $k = 8$ for 32
iterations.\footnote{A random seed of 2020 was used for reproducibility.}
Connected components was then applied to segment the image into contiguous
regions. Only regions that made up at least $1/256$ of the image were kept.

For each region, the following features were computed: (1) the proportion of the
image occupied the region, (2) the average red, green, and blue color levels
scaled to lie in range $[0,1]$, (3) the centroid, (4) the bounding box, and (5)
a normalized gray-level co-occurrence matrix (GLCM).

For the centroid and bounding box, coordinates were scaled to lie in range
$[0, 1]$. The gray-levels were binned into 8 buckets each of size 32. The
neighboring pixel of $(r, c)$ was the diagonal pixel at
$\left(r^\prime = r + 1, c^\prime = c + 1\right)$. The GLCM was initialized with
entries of $0.1$ which corresponds to putting a Dirichlet prior on
$\operatorname{GrayLevel}\left(r^\prime, c^\prime\right) \mid
\operatorname{GrayLevel}\left(r, c\right)$ with $\alpha = 0.1$. After counting
co-occurrences, the matrix was normalized to define a proper joint probability
distribution over the gray levels of a pixel and its neighbor.

\subsection{Distance 1}

Let $\mathbf{q}$ be the query feature vector and $\mathbf{p}$ be feature vector
for another image in the database. Distance 1 was simply the squared Euclidean
distance over the 5 classes of features:
\begin{equation}
  d_1\left(\mathbf{q}, \mathbf{p}\right) = \left\lVert \mathbf{q} - \mathbf{p}\right\rVert_2^2.
  \label{eqn:distance_1}
\end{equation}
For the vectors in Equation \ref{eqn:distance_1}, the first coordinate is the
volume, the colors are the next 3 entries, the centroid are the next 2 entries
in the vector, the top, right, bottom, and left of the bounding box make the
next 4 entries, and the normalized GLCM are the last 64 entries for a total of
$p = 74$ features per a feature vector.

\subsection{Distance 2}

The second distance function is more complex and uses several derived features.
\begin{equation}
  d_2\left(\mathbf{q}, \mathbf{p}\right) = V(\mathbf{q})\left[\left(V(\mathbf{q}) - V(\mathbf{p})\right)^2 +
  d_{2,\text{Color}}\left(\mathbf{p}, \mathbf{q}\right) +
  d_{2,\text{Position}}\left(\mathbf{p}, \mathbf{q}\right) +
  d_{2,\text{GLCM}}\left(\mathbf{p}, \mathbf{q}\right)\right],
  \label{eqn:distance_2}
\end{equation}
where $V: \mathcal{R} \rightarrow [0, 1]$ is a function mapping a region into
the percentage of the image occupied. Suppose the query vector has region
vectors $\left\{\mathbf{q}_i\right\}_{i=1}^{N}$ and another image has region
vectors $\left\{\mathbf{p}_j\right\}_{j=1}^{M}$. The total distance to the image
given a metric $d$ is computed as
\begin{equation}
  D_d\left(\left\{\mathbf{q}_i\right\}_{i=1}^{N}, \left\{\mathbf{p}_j\right\}_{j=1}^{M}\right)
  = \frac{1}{N}\sum_{i=1}^N\min_{j}\left\{d\left(\mathbf{q}_i, \mathbf{p}_j\right)\right\},
  \label{eqn:total_distance}
\end{equation}
so the leading $V\left(\mathbf{q}\right)$ factor in Equation
\ref{eqn:distance_2} assigns more importance to larger regions.

Let $\operatorname{rgb}: \mathcal{R}\rightarrow \left[0, 1\right]^3$ map a
region to the average color levels. Then, we define
\begin{equation}
  \begin{split}
  d_{2,\text{Color}}\left(\mathbf{q}, \mathbf{p}\right) =
  \left(\left\lVert \operatorname{rgb}\left(\mathbf{q}\right)\right\rVert_2 -
    \left\lVert \operatorname{rgb}\left(\mathbf{p}\right)\right\rVert_2\right)^2
  &+ \left\lVert \operatorname{rgb}\left(\mathbf{q}\right) -
    \operatorname{rgb}\left(\mathbf{p}\right)
  \right\rVert_1 \\ &+
  \left(1 - \frac{\operatorname{rgb}\left(\mathbf{q}\right)\cdot\operatorname{rgb}\left(\mathbf{p}\right)}
    {\left\lVert \operatorname{rgb}\left(\mathbf{q}\right)\right\rVert_2\left\lVert \operatorname{rgb}\left(\mathbf{p}\right)\right\rVert_2}\right),
\end{split}
  \label{eqn:distance_2_color}
\end{equation}
where the first term penalizes differing magnitude, the second term is the $l_1$
distance, and the third term is the cosine distance.

Let $\operatorname{Row}: \mathcal{R} \rightarrow \left[0, 1\right]$ and
$\operatorname{Col}: \mathcal{R} \rightarrow \left[0, 1\right]$ be the relative
row and columns for a region. Given two region bounding boxes, we can compute
the \href{https://en.wikipedia.org/wiki/Jaccard_index}{Jaccard index} also know
as \emph{intersection over union}. Denote the map
$J: \mathcal{R} \times \mathcal{R} \rightarrow [0,1]$. Based on the centroid and
bounding box, we define
\begin{equation}
  \begin{split}
  d_{2,\text{Position}}\left(\mathbf{q}, \mathbf{p}\right)
  = \frac{1}{2}\left(
    \operatorname{Row}\left(\mathbf{q}\right) - \operatorname{Row}\left(\mathbf{p}\right)
    \right)^2 &+
    \frac{1}{2}\left(
      \operatorname{Col}\left(\mathbf{q}\right) - \operatorname{Col}\left(\mathbf{p}\right)
    \right)^2 \\
    &+ \left(1 - J\left(\mathbf{p}, \mathbf{q}\right)\right)^2.
  \end{split}
  \label{eqn:distance_2_position}
\end{equation}
The first two terms penalize regions located in the different areas by their
centroids. The last term uses the region bounding boxes and penalizes regions
without a lot of overlap, whether because they are located in different parts of
the images or their sizes differ considerably.

From the normalized $8 \times 8$ GLCM, $N_{\text{GLCM}}\left(\mathbf{q}\right)$,
the auxiliary features \emph{Contrast}, \emph{Energy}, and \emph{Entropy} can
be defined:
\begin{align}
  \operatorname{Contrast}\left(
  \mathbf{q}
  \right) &= \sum_{i=1}^8\sum_{j=1}^8\left(i - j\right)^2
            N_{\text{GLCM}}\left(\mathbf{q}\right)(i, j) \\
  \operatorname{Energy}\left(
  \mathbf{q}
  \right) &= \sum_{i=1}^8\sum_{j=1}^8
            \left[N_{\text{GLCM}}\left(\mathbf{q}\right)(i, j)\right]^2 \\
  \operatorname{Entropy}\left(
  \mathbf{q}
  \right) &= -\sum_{i=1}^8\sum_{j=1}^8
            N_{\text{GLCM}}\left(\mathbf{q}\right)(i, j)\log_2N_{\text{GLCM}}\left(\mathbf{q}\right)(i, j).
\end{align}

Because of differing scales and levels of importance, we defined
\begin{equation}
  \begin{split}
  d_{2,\text{GLCM}}\left(\mathbf{q}, \mathbf{p}\right)
  &= 2\left[
    \operatorname{Contrast}\left(\mathbf{q}\right) -
    \operatorname{Contrast}\left(\mathbf{p}\right)
  \right]^2 \\
  &+ \frac{1}{2}\left[
    \operatorname{Energy}\left(\mathbf{q}\right) -
    \operatorname{Energy}\left(\mathbf{p}\right)
  \right]^2 \\
  &+ \frac{1}{2}\left[
    \operatorname{Entropy}\left(\mathbf{q}\right) -
    \operatorname{Entropy}\left(\mathbf{p}\right)
  \right]^2.
  \end{split}
  \label{eqn:distance_2_glcm}
\end{equation}
as a weighted sum of square differences.

\section{Discussion}

Both distances have the property that if $\mathbf{p} = \mathbf{q}$,
$d\left(\mathbf{p}, \mathbf{q}\right) = 0$, so if the image is in the
database, the image itself will always be returned as the top result.

Color features were found to be very important which explains why a simple
metric like $d_1$ can often be successful. In more complex images, weighting by
the region size, taking into account position with the bounding box, and using
contrast for texture analysis improved retrieval significantly. $d_2$ almost
always outperformed $d_1$ by taking into account these features.

Results of empirical validation are shown in the next section.

\section{Empirical Results}

\subsection{\texttt{beach}}
\begin{center}
  \includegraphics[width=\textwidth]{beach_1_distance1.png}

  \includegraphics[width=\textwidth]{beach_1_distance2.png}

  Query results for \texttt{beach\_1.jpg}.
\end{center}

The beach queries proved challenging. Euclidean distance completely fails, while
$d_2$ only manages to return $2/4$ beach images. Returning an additional beach
image in the top row, $d_2$ does better.

\subsection{\texttt{boat}}
\begin{center}
  \includegraphics[width=\textwidth]{boat_4_distance1.png}

  \includegraphics[width=\textwidth]{boat_4_distance2.png}

  Query results for \texttt{boat\_4.jpg}.
\end{center}

$d_1$ and $d_2$ both return other boat images for their top two results. One
might say that $d_2$ does slightly better since it has another boat result in
the top row. The boat in \texttt{boat\_1} is too different and not matched.

\subsection{\texttt{cherry}}

\begin{center}
  \includegraphics[width=\textwidth]{cherry_3_distance1.png}

  \includegraphics[width=\textwidth]{cherry_3_distance2.png}

  Query results for \texttt{cherry\_3.jpg}.
\end{center}

These queries were among the easiest. $d_1$ is near-perfect barely missing
$\texttt{cherry\_5}$, while $d_2$ retrieves all the relevant images as its top results.

\subsection{\texttt{crater}}

\begin{center}
  \includegraphics[width=\textwidth]{crater_3_distance1.png}

  \includegraphics[width=\textwidth]{crater_3_distance2.png}

  Query results for \texttt{crater\_3.jpg}.
\end{center}

$d_1$ completely fails here and doesn't return any relevant images in the top
row. $d_2$ does respectably retrieving $2/4$ crater images with an additional
crater image in the top row.

\subsection{\texttt{pond}}

\begin{center}
  \includegraphics[width=\textwidth]{pond_2_distance1.png}

  \includegraphics[width=\textwidth]{pond_2_distance2.png}

  Query results for \texttt{pond\_2.jpg}.
\end{center}

$d_1$ mostly fails here. While its top result is another pond image, the other 3
are nowhere to be found in the top row. $d_2$ does perfectly: its top 4 results
are the other 4 pond images.

\subsection{\texttt{stHelens}}

\begin{center}
  \includegraphics[width=\textwidth]{stHelens_5_distance1.png}

  \includegraphics[width=\textwidth]{stHelens_5_distance2.png}

  Query results for \texttt{stHelens\_5.jpg}.
\end{center}

$d_1$ does okay returning another image of Mount St. Helens as its top result
with another in the top row. $d_2$ does very well with its top 3
results being of Mount St. Helens and narrowly missing \texttt{stHelens\_3}.

\subsection{\texttt{sunset1}}

\begin{center}
  \includegraphics[width=\textwidth]{sunset1_1_distance1.png}

  \includegraphics[width=\textwidth]{sunset1_1_distance2.png}

  Query results for \texttt{sunset1\_1.jpg}.
\end{center}

Both $d_1$ and $d_2$ seem to do equally well here. The top row is all sunsets
except for one image in both cases.

\subsection{\texttt{sunset2}}

\begin{center}
  \includegraphics[width=\textwidth]{sunset2_2_distance1.png}

  \includegraphics[width=\textwidth]{sunset2_2_distance2.png}

  Query results for \texttt{sunset2\_2.jpg}.
\end{center}

This sunset is more challenging. $d_1$'s top two results are sunsets, but $d_2$
does better: its top 3 results are sunsets with an additional result in the top
row.

\section*{Appendix}

All code used to generate these images can be found at
\href{https://github.com/ppham27/cse576/blob/master/hw3}{\texttt{ppham27/cse576/hw3}}. The
embedded JPEG, PNG files, and the \LaTeX can be found in
\href{https://github.com/ppham27/cse576/blob/master/hw3/report}{\texttt{ppham27/cse576/hw3/report}}.

\end{document}


\subsection{Impact of QoI on Solution Quality }\label{sec:impact}

In the explicit (set-based) approach, a finite numerical approximation of (often uncountably many) events in $\sa$s is required.
Thus, there are two primary sources of approximation error: (1) partitioning the parameter space $\pspace$ to approximate events in $\pborel$, and (2) partitioning the data space $\dspace$ to approximate events in $\dborel$.

A non-intrusive sample-based algorithm is initially introduced in \cite{BET+14} and further analyzed in \cite{BET+14-arxiv}.
We direct the interested reader to \cite{BET+14-arxiv} for more detailed information and analysis of this algorithm, in which $\dspace$ is discretized by $M$ samples and $\pspace$ is discretized by $N$ samples.
If $\updatedP$ represents the updated probability measure, then we let $\updatedPxM$ be the exact solution to the approximate inverse problem using the discretization of $\predictedP$ by $M$ samples.
Finally, let $\updatedPxNM$ denote the approximate solution to the approximate problem under both aforementioned discretizations, so
\[
\updatedP = \lim\limits_{M\to\infty} \updatedPxM = \lim\limits_{M\to\infty} \lim\limits_{N\to\infty} \updatedPxNM.
\]

If numerical error in the evaluation of the QoI map $\qoi$ is inherent (e.g. owing to a mesh choice, surrogate model, or solution basis order), in the $N$ evaluations of samples in $\pspace$, then we let $\updatedPxNMh$ denote the approximate solution given the model discrepancy, and we have
\[
\updatedPxNM= \lim\limits_{h \downarrow 0} \updatedPxNMh.
\]

Here, the $h$ refers to a mesh or other numerical parameter that determines the accuracy of the numerical solution evaluation of the QoI map.

In \cite{BM17}, the focus is on proving the convergence of $\updatedPxNMh(A) \to \PP_{\pspace} (A)$ for some $A\in \pborel$ and on estimating the error in $\updatedPxNMh(A)$.
There, as well as in \cite{JWW17}, adjoint-based a posteriori estimates in the computed QoI are combined with a statistical analysis to both estimate and bound the error in $\updatedPxNMh (A)$.
In \cite{BM17}, adjoints are used to compute both error and derivative estimates of the QoI map to improve the accuracy in $\updatedPxNMh (A)$.
%However, no work has to date fully explored the \emph{convergence rates} of Algorithm \ref{alg:inv_density}.
%Furthermore, no work has yet to establish that these rates are independent of the choice of QoI map despite other studies establishing that the absolute error is very much affected by the geometric properties of the QoI maps \cite{BE13}.

As mentioned earlier, stability results are with respect to the Total Variation metric, which we use to study convergence as well.
Repeated application of the triangle inequality yields
\begin{equation}
\label{eq:triangleineq}
d_{\text{TV}}(\updatedPxNMh, \updatedP) \leq
\underset{ \text{(E1)} }{\underbrace{ d_{\text{TV}}(\updatedPxNMh, \updatedPxNM)}} +
\underset{ \text{(E2)} }{\underbrace{ d_{\text{TV}}(\updatedPxNM, \updatedPxM) }}+
\underset{ \text{(E3)} }{\underbrace{ d_{\text{TV}}(\updatedPxM, \updatedP) }}.
\end{equation}
The term (E1) describes the effect of the error in the numerically evaluated $Q_j$ on the solution to the stochastic inverse problem.
The term (E2) describes the effect of finite sampling error in $\pspace$, and (E3) describes the effect of discretization error of $\predictedP$ on the solution to the stochastic inverse problem.
In our experience, terms (E1) and (E3) are more easily controlled.
Thus, we limit our focus to (E2), where certain geometric properties of the QoI map are known to significantly impact this term, as we show below.


\documentclass{memoir}
\usepackage{notestemplate}
%\logo{./resources/pdf/logo.pdf}
%\institute{Rice University}
%\faculty{Faculty of Whatever Sciences}
%\department{Department of Mathematics}
%\title{Class Notes}
%\subtitle{Based on MATH xxx}
%\author{\textit{Author}\\Gabriel \textsc{Gress}}
%\supervisor{Linus \textsc{Torvalds}}
%\context{Well, I was bored...}
%\date{\today}

\begin{document}

% \maketitle

% Notes taken on 02/05/21

\section{Modules}
\label{sec:modules}

An \(R\)-module \(M\) is an abelian group that comes equipped with a binary operation \(\cdot \) that maps from \(R\times M\) to \(M\) that is compatible with operations of both \(M\) and \(R\). It is the natural generalization of vector spaces to rings, but with the key difference that we may not have multiplicative inverses for elements in our \(R\)-module.

\begin{defn}[Left \(R\)-module]
Let \(R\) be a ring. A \textbf{left \(R\)-module} is a pair \(\prescript{}{R}{M} := (M,\cdot :R\times M\to M)\) where \(M\) is an abelian group, and \(\cdot \) is a binary operation so that
	\begin{align*}
		\forall r,s \in R, \; m,n \in M:\\
		r\cdot (m+n) = (r\cdot m) + (r\cdot n)\\
		(r+s)\cdot m = (r\cdot m) + (s\cdot m)\\
		(rs)\cdot m = r\cdot(s\cdot m)
	\end{align*}
	If \(R\) is unital, then we also require
	\begin{align*}
		1_R \cdot  m = m.
	\end{align*}
	The map is called the (left) \textbf{\(R\)-action map}.
\end{defn}

\begin{exmp}[Free Module of Rank \(n\)]
	\begin{enumerate}
		\item If \(R\) is a field \(F\), then the \(R\)-module is an \(F\)-vector space.
		\item Take \(M = R^{n} := \left\{(t_1,\ldots,t_n) \mid t_i \in R \right\}\). Let the \(R\)-action map of \(\prescript{}{R}M\) be defined by
			\begin{align*}
				R\times M \to M\\
				(r,(t_1,\ldots,t_n)) \mapsto (rt_1,\ldots,rt_n).
			\end{align*}
			One can check that this satisfies the necessary properties of a left \(R\)-action on \(M = R^{n}\). This left \(R\)-module \(\prescript{}{R}R^{n}\) (which we will simply denote here on out by \(R^{n}\)) is called the \textbf{free left \(R\)-module of rank \(n\)}.
	\end{enumerate}
\end{exmp}

\begin{exmp}[\(\Z\)-Modules]
An abelian group \(M\) can be made into a module \(\prescript{}{\Z}M\) over the integers in exactly one way. Consider the \(\Z\)-action map defined by
\begin{align*}
	\Z\times M \to M\\
	(n,m) \mapsto  m + \ldots_{n} + m
\end{align*}
One can check that this indeed is a \(\Z\)-module over \(M\).
\end{exmp}

\begin{hw}
	Prove that the \(\Z\)-action given above is the unique \(\Z\)-action for any \(\Z\)-module. Furthermore, show that \(\prescript{}{\Z}M\) is isomorphic to an abelian group.
\end{hw}

\begin{exmp}[\(F{[}x{]}\) Modules]
	Let \(R = F[x]\) be a polynomial ring over a field \(F\), and let \(V\) be a vector space over \(F\) with a linear operator \(T \in \mathcal{L}(V)\). We can construct an \(F[x]\)-module on \(V\) via \(T\) (denoted \(\prescript{}{F[x]}V)\)). To see this, let \(p(x) \in F[x]\) be a polynomial given by
	\begin{align*}
		p(x) = a_nx^{n}+ a_{n-1}x^{n-1} + \ldots + a_1 x + a_0.
	\end{align*}
	For each \(v \in V\), we define the action of \(p(x)\) on \(v\) by
	\begin{align*}
		p(x)\cdot v &= (a_n T^{n} + a_{n-1}T^{n-1} + \ldots + a_1 T + a_0) (v)\\
		       &= a_n T^{n}(v) + a_{n-1}T^{n-1}(v) + \ldots + a_1 T(v) + a_0v
	\end{align*}
	Informally, we are defining an action of \(x\) on \(V\) by \(T\), and then extending it onto \(F[x]\) in a natural way.\\

	Recall that \(F\leq F[x]\) (as constant polynomials), and hence the action of \(F\) is exactly the same as constant polynomials, which correspond to the standard action of \(F\) on \(V\). In other words, this action is an extension of the action of \(F\) onto a larger ring \(F[x]\).\\

	Because this action is dependent on the choice of  \(T\), this gives us many different \(F[x]\)-module structures on the same vector space \(V\). One can check that \(T=0\) also yields us the standard action of \(F\) on \(V\).\\

	What is interesting to note is that the action of \(F[x]\) via \(T\) encapsules \textit{all} possible \(F[x]\)-modules-- this holds because the action of \(x \in F[x]\) on \(V\) is a linear transformation from \(V\) to \(V\), and hence must correspond to some \(T\) which all actions \(p(x)\) must adhere to.\\

	One might ask what \(F[x]\)-submodules look like. We can see immediately that an \(F[x]\)-submodule \(\prescript{}{F[x]}W \leq \prescript{}{F[x]}V\) must also be an \(F\)-submodule, and hence \(W<V\) as a vector subspace. Furthermore, in order for it to be well-defined, \(W\) must be \textbf{\(T\)-invariant}, that is, \(T(W) \subset  W\). In fact this too is a bijection, so that all \(F[x]\)-submodules of \(V\) correspond to \(T\)-invariant subspaces of \(V\).
\end{exmp}
This example shows that the ideal structure of \(F[x]\) greatly restricts the module structure on \(V\) (and in fact can be used to derive its Jordan canonical form). In fact, the reasonings above can be applied to any PID \(R\), and in the special case \(R = \Z\) we can obtain the fundamental theorem of finitely generated abelian groups. In general, it is always interesting to see how the structure of a ring \(R\) will affect its modules.

\end{document}

Abstract Algebra - Introductory/Algebra II/Notes/source/Lecture5 - IntroModules.tex


\documentclass[]{article}

\usepackage{graphicx}

\usepackage[margin=1in]{geometry}

\setlength\parindent{0pt}

\usepackage{physics}
\usepackage{amsmath, amsfonts, amssymb, amsthm}

\usepackage{listings}

\usepackage{enumitem}
\renewcommand{\theenumi}{\alph{enumi}}
\renewcommand*{\thesection}{Problem \arabic{section}}
\renewcommand*{\thesubsection}{\alph{subsection})}
\renewcommand*{\thesubsubsection}{\quad \quad \roman{subsubsection})}

%Custom Commands
\newcommand{\Rel}{\mathcal{R}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}

\newcommand{\toI}{\xrightarrow{\textsf{\tiny I}}}
\newcommand{\toS}{\xrightarrow{\textsf{\tiny S}}}
\newcommand{\toB}{\xrightarrow{\textsf{\tiny B}}}

\newcommand{\divisible}{ \ \vdots \ }

% Theorem Definition
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}

%opening

\title{MATH 5301 Elementary Analysis - Homework 4}

\author{Jonas Wagner}

\date{2021, September 24}

\begin{document}

\maketitle

% Problem 1
\section{}
Use the axioms of the ordered field, prove the following:
% Part a
\subsection{$(a > c) \land (b > d) \implies a + b > c + d$}
\begin{align*}
    (a > c) \land (b > d) &\implies (a + b) > (c + d)
\end{align*}
From (O3):
\begin{align*}
    (a > c) &\implies ((a + b) \geq (b + c)) \land ((a + d) \geq (c + d))\\
    (b > d) &\implies ((a + b) \geq (a + d)) \land ((b + c) \geq (c + d))\\
\end{align*}
From (02):
\begin{align*}
    ((a + b) \geq (b + c)) \land ((b + c) \geq (c + d))
        &\implies (a + b) > (c + d)
\end{align*}

% Part b
\subsection{$(a > c > 0) \land (b > d > 0) \implies ab > cd > 0$}
\begin{align*}
    (a > c > 0) \land (b > d > 0) &\implies ab > cd > 0
\end{align*}
From (O4):
\begin{align*}
    (a > c > 0) \land (b > 0) &\implies ab > bc > 0\\
    % (a > c > 0) \land (d > 0) &\implies ad > cd > 0\\
    % (b > d > 0) \land (a > 0) &\implies ab > ad > 0\\
    (b > d > 0) \land (c > 0) &\implies bc > cd > 0
\end{align*}
From (O2):
\begin{align*}
    (ab > bc > 0) \land (bc > cd > 0) &\implies ab > cd > 0
\end{align*}

\newpage
% Part c
\subsection{$a > b > 0 \implies \frac{1}{a} < \frac{1}{b}$}
\begin{align*}
    a > b > 0 &\implies \frac{1}{b} < \frac{1}{b}
\end{align*}
From
\begin{align*}
    a > 0 & \implies a^{-1} > 0\\
    b > 0 & \implies b^{-1} > 0
\end{align*}
From (O4):
\begin{align*}
    (a > b > 0) \land (a^{-1} > 0) &\implies a a^{-1} = 1 > b a^{-1} = \frac{b}{a}> 0\\
    (a > b > 0) \land (b^{-1} > 0) &\implies a b^{-1} = \frac{a}{b} > b b^{-1} = 1 > 0\\
    (\frac{a}{b} > 1 > 0) \land (a^{-1} > 0)
        &\implies \frac{a}{b} a^{-1} = \frac{1}{b} > (1)(a^{-1}) = \frac{1}{a} > 0
\end{align*}
Therefore, $$\frac{1}{a} < \frac{1}{b}$$

\newpage
% Part d
\subsection{
    Let,
    $$\abs*{x} =
        \begin{cases}
            x, & x \geq 0\\
            -x,& X < 0
        \end{cases}
    $$
    prove,
    $$\forall a, b \implies \abs*{a - b} \geq \abs*{\abs*{a} - \abs*{b}}$$
}

\begin{align*}
    \forall a, b \implies \abs*{a - b} \geq \abs*{\abs*{a} - \abs*{b}}
\end{align*}
When $a>b>0$ (or $b>a>0$),
\begin{align*}
    \abs*{a - b}&= a - b\\
    \abs*{a}    &= a\\
    \abs*{b}    &= b\\
    \abs*{\abs*{a} - \abs*{b}} &= a - b\\
    \abs*{a - b} = a-b &= \abs*{\abs*{a} - \abs*{b}}
\end{align*}
The same is true for $0<a<b$ and $0 < b < a$ by similar arguments.\\
For $a > 0 > b$,
\begin{align*}
    \abs*{a}    &= a\\
    \abs*{b}    &= -b\\
    \abs*{a - b}&= \abs*{a} + \abs*{b}\\
    \abs*{a} - \abs*{b} &= a - (-b) = a + b\\
    \abs*{\abs*{a} - \abs*{b}} &=
        \begin{cases}
            \abs*{a} - \abs*{b}   & \abs*{a} > \abs*{b}\\
            \abs*{b} - \abs*{a}   & \abs*{a} < \abs*{b}
        \end{cases}
    \intertext{From (03):}
    \abs*{a - b} = \abs*{a} + \abs*{b} &\geq \abs*{a} - \abs*{b}\\
    \abs*{a - b} = \abs*{a} + \abs*{b} &\geq \abs*{b} - \abs*{a}\\
    \therefore \ \abs*{a - b} &\geq \abs*{\abs*{a} - \abs*{b}}
\end{align*}
Therefore $\forall a, b$,
\begin{align*}
     \abs*{a - b} \geq \abs*{\abs*{a} - \abs*{b}}
\end{align*}

% Problem 2
\newpage
\section{}
Determine which of the axioms satisfied by the set of real numbers
are not satisfied by the following set:

% Part a
\subsection{Set $\Q$ of all rational numbers.}
Set $\Q$ of rational numbers can be an ordered field,
$\langle \Q, +, 0, \cdots, 1\rangle$, but lacks (C) completeness:
$$\forall A \subset \Q \not{\exists} c \in \Q : c = \sup A$$

% Part b
\subsection{Set $\Q(\sqrt{2})$ of all numbers of form $a + b\sqrt{2}$, where $a,b\in\Q$}
Set $\Q := \qty{a + b \sqrt{2} : a, b \in \Q}$ can be an ordered field,
$\langle \Q(\sqrt{2}), +, 0, \cdots, 1\rangle$, but lacks completeness (C):
$$\forall A \subset \Q(\sqrt{2}) \not{\exists} c \in \Q : c = \sup A$$

% Part c
\subsection{Set $\C$ of all pairs of real numbers $(a,b)$
    with addition ${(a,b) + (c,d) = (a+c,b+d)}$,
    multiplication $(a,b)\cdot(c,d) = (ac-bd,ad+bc)$,
    and ordered relation $(a,b)<(c,d)\iff(b \leq d)\land((b=d \lor a<c))$.
}
Set $\C := \qty{(a,b) : a,b \in \R}$ can satisfy the field conditions,
$\langle \C, +, 0, \cdots, 1\rangle$,
but it is not ordered because it does not satisfy (O1).

% Problem 3
\newpage
\section{}
Using the method of mathematical induction,
prove the following statements: $(n \in \N)$

% Part a
\subsection{Bernoulli inequality: $\forall n\in\N, \ \forall x > -1$,
    $(1+x)^n \geq 1 + nx$
}

\begin{theorem}
    $\forall n\in\N, \ \forall x > -1$,
        $$(1+x)^n \geq 1 + nx$$
\end{theorem}

\begin{proof}
    Proof by induction:\\
    For $n=1$,
    \begin{align*}
        (1+x)^n &\geq 1 + nx\\
        (1+x)^1 &\geq 1 + (1)x\\
        1+x &\geq 1 + x
    \end{align*}
    For $n > 1$,
    \begin{align*}
        (1+x)^n &\geq 1 + n x\\
        (1+x)^n (1+x) &\geq (1+nx) (1+x)\\
        (1+x)^{n+1} &\geq (1 + x + nx + nx^2)\\
            &\geq 1 + (n+1)x + nx^2\\
    \end{align*}
    Since $n \geq 2 \implies nx^2 > 0$
    \begin{align*}
        1 + (n+1)x + nx^2 &\geq 1 + (n+1)x\\
    \end{align*}
    From (O2):
        $$(1+x)^{n+1} \geq 1 + (n+1)x$$
    Therefore $\forall n > 1$,
        $$(1+x)^n \geq 1 + nx \implies (1+x)^{n+1} \geq 1 + (n+1)x$$
    Therefore $\forall n\in\N, \ \forall x > -1$,
        $$(1+x)^n \geq 1 + nx$$
\end{proof}

\newpage
% Part b
\subsection{For $n \in \N$,
    $\frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n} = 2 - \frac{n+2}{2^n}$
}
\begin{theorem}
    For $n \in \N$,
        $$\frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n} = 2 - \cfrac{n+2}{2^n}$$
\end{theorem}
\begin{proof}
    Proof by induction:
    For $n = 1$,
    \begin{align*}
        \frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n}
            &= 2 - \cfrac{n+2}{2^n}\\
        \frac{1}{2} = 2 - \cfrac{1+2}{2^1}
            &= 2 - \frac{3}{2}\\
        \frac{1}{2} &= \cfrac{1}{2}\\
    \end{align*}
    For $n > 1$,
    $$\frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n} = 2 - \cfrac{n+2}{2^n}
    \implies \frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^{n+1}} = 2 - \cfrac{n+2}{2^{n+1}}$$
    \begin{align*}
        \frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n}
            &= 2 - \cfrac{n+2}{2^n}\\
        \frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n} + \frac{n+1}{2^{n+1}}
            &= 2 - \cfrac{n+2}{2^n} + \cfrac{n+1}{2^{n+1}}\\
            &= 2 - \cfrac{n+2}{2^n}\cfrac{2}{2} + \cfrac{n+1}{2^{n+1}}\\
            &= 2 - \cfrac{2(n+2)}{2^{n+1}} + \cfrac{n+1}{2^{n+1}}\\
            &= 2 + \cfrac{n+1 - 2(n+2) }{2^{n+1}}\\
            &= 2 + \cfrac{n+1 - 2n - 2}{2^{n+1}}\\
            &= 2 + \cfrac{-n - 1}{2^{n+1}}\\
            &= 2 + \cfrac{-(n+1) -2}{2^{n+1}}\\
            &= 2 - \cfrac{(n+1) +2}{2^{n+1}}\\
    \end{align*}
    Therefore $\forall n > 1$,
    $$\frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n}
        = 2 - \cfrac{n+2}{2^n}
        \implies \frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n} + \frac{n+1}{2^{n+1}}
        = 2 - \cfrac{(n+1) +2}{2^{n+1}}$$
    Therefore For $n \in \N$,
    $$\frac{1}{2} + \frac{2}{2^2} + \cdots + \frac{n}{2^n} = 2 - \frac{n+2}{2^n}$$
\end{proof}

\newpage
% Part c
\subsection{For $q \in \R, n \in \N$,
    $(1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n}) = \frac{1-q^{2^{n+1}}}{1-q}$
}
\begin{theorem}
    For $q \in \R, n \in \N$,
    $$(1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n}) = \cfrac{1-q^{2^{n+1}}}{1-q}$$
\end{theorem}
\begin{proof}
    Proof by induction:\\
    For $n=1$,
    \begin{align*}
        (1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n})
            &= \cfrac{1-q^{2^{n+1}}}{1-q}\\
        (1+q)(1+q^{2^1})
            &= \cfrac{1-q^{2^{1+1}}}{1-q}\\
        (1+q^{2} + q + q^{3})
            &= \cfrac{1-q^{4}}{1-q}\\
        (1 + q + q^{2} + q^{3}) (1-q)
            &= \cfrac{1-q^{4}}{1-q}(1-q)\\
        1 + q + q^{2} + q^{3} - q - q^2 - q^3 -q^4
            &= 1-q^{4}\\
        1 - q^4
            &= 1-q^{4}\\
    \end{align*}
    For $n>1$
    \begin{align*}
        (1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n}) &= \cfrac{1-q^{2^{n+1}}}{1-q}\\
        (1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n})(1+q^{2^{n+1}})
            &= \cfrac{1-q^{2^{n+1}}}{1-q}(1+q^{2^{n+1}})\\
            &= \cfrac{\qty(1-q^{2^{n+1}})\qty(1+q^{2^{n+1}})}{1-q}\\
            &= \cfrac{1-q^{2^{n+1}} + q^{2^{n+1}} + \qty(-q^{2^{n+1}})\qty(q^{2^{n+1}})}{1-q}\\
            &= \cfrac{1 -q^{2^{n+1} + 2^{n+1}})}{1-q}\\
            &= \cfrac{1 -q^{2\qty(2^{n+1})}}{1-q}\\
        (1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n})(1+q^{2^{n+1}})
            &= \cfrac{1 -q^{2^{n+2}}}{1-q}\\
    \end{align*}
    Therefore $\forall n>1$,
    $$(1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n}) = \cfrac{1-q^{2^{n+1}}}{1-q}
    \implies (1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n})(1+q^{2^{n+1}}) = \cfrac{1 -q^{2^{n+2}}}{1-q}
    $$
    Therefore $\forall n \in \N$,
    $$(1+q)(1+q^2)(1+q^4)\cdots(1+q^{2^n}) = \cfrac{1-q^{2^{n+1}}}{1-q}$$
\end{proof}

\newpage
% Part d
\subsection{For $n \in \N$,
    $1^3 + 3^3 + \cdots + (2n + 1)^3 = (n+1)^2 (2n^2 + 4n + 1)$
}
\begin{theorem}
    For $n \in \N$,
    $$1^3 + 3^3 + \cdots + (2n + 1)^3 = (n+1)^2 (2n^2 + 4n + 1)$$
\end{theorem}
\begin{proof}
    Proof by induction:\\
    For $n = 1$,
    \begin{align*}
        1^3 + 3^3 + \cdots + (2n + 1)^3 &= (n+1)^2 (2n^2 + 4n + 1)\\
        1^3 + (2(1) + 1)^3 &= ((1)+1)^2 (2(1)^2 + 4(1) + 1)\\
        1^3 + 3^3 &= (2)^2 (2(1) + 4 + 1)\\
        1 + 27 &= (4) (2 + 4 + 1)\\
        28 &= (4)(7)\\
        28 &= (4)(7)\\
        28 &= 28
    \end{align*}
    For $n > 1$,
    \begin{align*}
        1^3 + 3^3 + \cdots + (2n + 1)^3 &= (n+1)^2 (2n^2 + 4n + 1)\\
        1^3 + 3^3 + \cdots + (2n + 1)^3 + (2(n+1)+1)^3
            &= (n+1)^2 (2n^2 + 4n + 1) + (2(n+1)+1)^3\\
            &= (n+1)^2 (2n^2 + 4n + 1) + (2n + 3)^3
    \end{align*}
    \begin{align*}
        &= (n+1)(n+1) (2n^2 + 4n + 1) + (2n + 3)(2n + 3)(2n + 3)\\
        &= (n^2 + 2n + 1) (2n^2 + 4n + 1) + 27 + 54 n + 36 n^2 + 8 n^3\\
        &= 2n^4 + 8n^3 + 11n^2 + 6n + 1 + 8n^3 + 36 n^2 + 54n + 27\\
        &= 2n^4 + 16n^3 + 47n^2 + 60n + 28\\
        &= (n+2)^2(2n^2 + 8n + 7)\\
        &= ((n+1)+1)^2 (2(n+1)^2 - 4n - 2 + 4(n+1) + 4n - 4 + 7)\\
        &= ((n+1)+1)^2 (2(n+1)^2 + 4(n+1) + 1)\\
    \end{align*}
    Therefore $\forall n > 1$,
    $$
    1^3 + 3^3 + \cdots + (2n + 1)^3 = (n+1)^2 (2n^2 + 4n + 1)\implies
    $$
    $$\implies 1^3 + 3^3 + \cdots + (2n + 1)^3 + (2(n+1)+1)^3
    = ((n+1)+1)^2 (2(n+1)^2 + 4(n+1) + 1)
    $$
    Therefore $\forall n \in \N$,
    $$1^3 + 3^3 + \cdots + (2n + 1)^3 = (n+1)^2 (2n^2 + 4n + 1)$$
\end{proof}

\newpage
% Part e
\subsection{For $n,k \in \N$,
    $\sum_{k=0}^{n} \qty(-1)^k \cfrac{n!}{k!(n-k)!} = 0,
    \sum_{k=0}^{n} \cfrac{n!}{k!(n-k)!} = 2^n$
}
\begin{definition}
    The factorial of a number, $n!$, is defined as
    $$n! := (1)(2)(3)\cdots(n-1)(n)$$
\end{definition}
\begin{definition}
    The combination of two numbers, $\mqty(n\\k)$, is defined as
    $$\mqty(n\\k) := \cfrac{n!}{k!(n-k)!}$$
\end{definition}
\subsubsection{$\sum_{k=0}^{n} \qty(-1)^k \cfrac{n!}{k!(n-k)!} = 0$}
\begin{theorem}
    For $n,k \in \N$,
    $$\sum_{k=0}^{n} \qty(-1)^k \mqty(n\\k) = 0$$
\end{theorem}
\begin{proof}
    For $n=1$,
    \begin{align*}
        \sum_{k=0}^{n} \qty(-1)^k \mqty(n\\k) &= 0\\
        \sum_{k=0}^{1} \qty(-1)^k \mqty(1\\k)
            &= (-1)^0 \mqty(1\\0) + (-1)^1 \mqty(1\\1)\\
            &= (1)(1) + (-1) (1)\\
            &=0
    \end{align*}
    Therefore,
    \begin{align*}
        \sum_{k=0}^{1} \qty(-1)^k \mqty(1\\k) &= 0
    \end{align*}
    For $n>2$,
    \begin{align*}
        \sum_{k=0}^{n} \qty(-1)^k \mqty(n\\k) &= 0\\
        \sum_{k=0}^{n} \qty(-1)^k \frac{n!}{k!(n-k)!} &= 0\\
        \qty(-1)^0 \frac{n!}{0!(n-0)!} + \qty(-1)^1 \frac{n!}{1!(n-1)!} + \cdots +
            \qty(-1)^n \frac{n!}{n!(n-n)!} &= 0\\
        (1)\frac{n!}{0!n!} + (-1) \frac{n!}{1!(n-1)!} + \cdots +
            \qty(-1)^{n-2} \frac{n!}{(n-2)!2!} + \qty(-1)^{n-1} \frac{n!}{(n-1)!1!} +
            \qty(-1)^n \frac{n!}{n!0!}&=0\\
        (1)\frac{n!}{n!} + (-1) \frac{n!}{(n-1)!} + \cdots +
            \qty(-1)^{n-2} \frac{n!}{(n-2)!2} + \qty(-1)^{n-1} \frac{n!}{(n-1)!}
            + \qty(-1)^n \frac{n!}{n!}&=0\\
        (1)\frac{n!}{n!} + (-1) \frac{n!}{(n-1)!} + \cdots +
            \qty(-1)^{n-1} \frac{n!}{(n-1)!} + \qty(-1)^{n} \frac{n!}{n!} +
            \qty(-1)^{n+1} \frac{n+1!}{n+1!}&= \qty(-1)^{n+1} \frac{n+1!}{n+1!}\\
    \end{align*}
    Therefore $\forall n \in \N, n \geq 2$,
    $$\sum_{k=0}^{n} \qty(-1)^k \mqty(n\\k) = 0$$
\end{proof}

\newpage
\subsubsection{$\sum_{k=0}^{n} \cfrac{n!}{k!(n-k)!} = 2^n$}
\begin{theorem}
    For $n,k \in \N$,
    $$\sum_{k=0}^{n} \mqty(n\\k) = 2^n$$
\end{theorem}
\begin{proof}
    By induction:\\
    For $n=2$,
    \begin{align*}
        \sum_{k=0}^{n} \mqty(n\\k) &= 2^n\\
        \sum_{k=0}^{2} \mqty(2\\k) &= 2^2\\
        \mqty(2\\0) + \mqty(2\\1) + \mqty(2\\2) &= 4\\
        1 + 2 + 1 &= 4\\
        4 &= 4
    \end{align*}
    For $n >2$,
    \begin{align*}
        \sum_{k=0}^{n} \mqty(n\\k) &= 2^n\\
        \sum_{k=0}^{n} \frac{n!}{k!(n-k)!} &= 2^n\\
        \frac{n!}{0!(n-0)!} + \frac{n!}{1!(n-1)!} + \cdots + \frac{n!}{n!(n-n)!} &= 2^n\\
        \frac{n!}{0!n!} + \frac{n!}{1!(n-1)!} + \cdots + \frac{n!}{(n-2)!2!}
            + \frac{n!}{(n-1)!1!} + \frac{n!}{n!0!}&=2^n\\
        \qty(\frac{n!}{0!n!} + \frac{n!}{1!(n-1)!} + \cdots + \frac{n!}{(n-2)!2!}
            + \frac{n!}{(n-1)!1!} + \frac{n!}{n!0!}) \frac{2(n+1)}{n+1}&=2^n2\\
        \frac{(n+1)!}{0!n!(n+1)} + \frac{(n+1)!}{1!(n-1)!(n+1)} + \cdots + \frac{(n+1)!}{(n-2)!2!(n+1)}
            + \frac{(n+1)!}{(n-1)!1!} + \frac{(n+1)!}{n!0!}&=2^{n+1}\\
        \frac{(n+1)!}{0!n!(n+1)} + \frac{(n+1)!}{1!(n-1)!(n+1)} + \cdots + \frac{(n+1)!}{(n-2)!2!(n+1)}
            + \frac{(n+1)!}{(n-1)!1!} + \frac{(n+1)!}{n!0!}&=2^{n+1}\\
        \sum_{k=0}^{n+1} \mqty(n\\k) &= 2^{n+1}
    \end{align*}
\end{proof}

% Problem 4
\newpage
\section{}
Show that $\forall n \in \N, n \geq 2$,

% Part a
\subsection{
    $\frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots + \frac{1}{\sqrt{n}} > \sqrt{n}$
}
\begin{theorem}
    For $n \in \N$ and $n \geq 2$,
    $\frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots + \frac{1}{\sqrt{n}} > \sqrt{n}$
\end{theorem}
\begin{proof}
    By Induction:\\
    For $n=2$,
    \begin{align*}
        \frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots + \frac{1}{\sqrt{n}} &> \sqrt{n}\\
        \frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} &> \sqrt{2}\\
        1 + \frac{1}{2} &> \sqrt{2}\\
        \frac{3}{2} &> \sqrt{2}\\
        \qty(\frac{3}{2})^2 &> \qty(\sqrt{2})^2\\
        \frac{9}{4} &> 2\\
        9 &> (4)(2)\\
        9 &> 8
    \end{align*}
    Therefore, for $n=2$,
    $$\frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots + \frac{1}{\sqrt{n}} > \sqrt{n}$$
    For $n>2$,
    \begin{align*}
        \frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots + \frac{1}{\sqrt{n}}
            &> \sqrt{n}\\
        \frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots +
            \frac{1}{\sqrt{n}} + \frac{1}{\sqrt{n+1}}
            &> \sqrt{n} + \frac{1}{\sqrt{n+1}}\\
        \qty(\frac{1}{\sqrt{1}} + \frac{1}{\sqrt{2}} + \cdots +
            \frac{1}{\sqrt{n}} + \frac{1}{\sqrt{n+1}}) \sqrt{n+1}
            &> \qty(\sqrt{n} + \frac{1}{\sqrt{n+1}})\sqrt{n+1}\\
        \frac{\sqrt{n+1}}{\sqrt{1}} + \frac{\sqrt{n+1}}{\sqrt{2}} + \cdots + \frac{\sqrt{n+1}}{\sqrt{n}} + \frac{\sqrt{n+1}}{\sqrt{n+1}}
            &> \sqrt{n} \sqrt{n+1} + 1\\
    \end{align*}
\end{proof}

\newpage
% Part b
\subsection{
    $\cfrac{1}{n+1} + \cfrac{1}{n+2} + \cdots + \frac{1}{3n+1} > 1$
}
\begin{theorem}$\forall n \in \N, n \geq 2$,
    $$\cfrac{1}{n+1} + \cfrac{1}{n+2} + \cdots + \frac{1}{3n+1} > 1$$
\end{theorem}
\begin{proof}
    For $n = 2$,
    \begin{align*}
        \cfrac{1}{n+1} + \cfrac{1}{n+2} + \cdots + \frac{1}{3n+1} > 1\\
        \cfrac{1}{(2)+1} + \cfrac{1}{(2)+2} + \cdots + \frac{1}{3(2)+1} > 1\\
        \cfrac{1}{3} + \cfrac{1}{4} + \cdots + \frac{1}{7} > 1\\
        \sum_{k=3}^{7} \frac{1}{k} > 1\\
        \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \frac{1}{6} + \frac{1}{7} > 1\\
        \frac{140}{420} + \frac{105}{240} + \frac{84}{240} + \frac{70}{240} +
            \frac{60}{420} > 1\\
        \frac{459}{420} > 1\\
        459 > 420
    \end{align*}
    Therefore for $n = 2$,
    $$\cfrac{1}{n+1} + \cfrac{1}{n+2} + \cdots + \frac{1}{3n+1} > 1$$
    For $n > 2$,
    \begin{align*}
        \cfrac{1}{n+1} + \cfrac{1}{n+2} + \cdots + \frac{1}{3n+1} &> 1\\
        \sum_{k=n+1}^{3n+1} \frac{1}{k} &> 1\\
        \sum_{k=n+1}^{3n+1} \frac{1}{k} + \sum_{k=3n+2}^{3(n+1) + 1} \frac{1}{k}
            &> 1 + \sum_{k=3n+2}^{3(n+1) + 1} \frac{1}{k}\\
        \frac{1}{n+1} + \sum_{k=(n+1) + 1}^{3(n+1)+1} \frac{1}{k}
            &> 1 + \sum_{k = 3n+2}^{3(n+1) + 1} \frac{1}{k}\\
    \end{align*}
    Since $\frac{1}{n+1} > \sum_{k = 3n+2}^{3(n+1) + 1} \frac{1}{k}$,
    by (O3) this implies that
    $$\sum_{k=(n+1) + 1}^{3(n+1)+1} \frac{1}{k} > 1$$
    Therefore for $n \geq 2$,
    $$ \cfrac{1}{n+1} + \cfrac{1}{n+2} + \cdots + \frac{1}{3n+1} > 1$$
\end{proof}

\newpage
% Part c
\subsection{
    $\qty(\cfrac{n+1}{2})^n > n!$
}
\begin{theorem} For $n \in \N, n \geq 2$,
    $$\qty(\cfrac{n+1}{2})^n > n!$$
\end{theorem}
\begin{proof}
    For $n=2$,
    \begin{align*}
        \qty(\cfrac{n+1}{2})^n &> n!\\
        \qty(\cfrac{2+1}{2})^2 &> 2!\\
        \qty(\frac{3}{2})^2 &> (2)(1)\\
        \frac{9}{4} &> 2\\
        9 &> 8
    \end{align*}
    For $n>2$,
    \begin{align*}
        \qty(\cfrac{n+1}{2})^n &> n!\\
        \qty(\cfrac{n+1}{2})^n (n+1) &> n! (n+1)\\
        \qty(\cfrac{n+1}{2})^n (n+1) &> (n+1)!\\
        \cfrac{(n+1)^{n+1}}{2^n} &> (n+1)!\\
        \cfrac{\frac{1}{2}((n+1)+1)^{n+1}}{2^n} &> (n+1)!\\
        \cfrac{((n+1)+1)^{n+1}}{2^{n+1}} &> (n+1)!\\
        \qty(\cfrac{(n+1)+1}{2})^{n+1} &> (n+1)!\\
    \end{align*}
    Therefore for $n\geq 2$,
    $$\qty(\cfrac{n+1}{2})^n > n!$$
\end{proof}

\newpage
% Part d
\subsection{
    $(2^{2^n} - 6) \divisible 10$
}
\begin{theorem}
    For $n \in \N, n \geq 2$,
    $$(2^{2^n} - 6) \divisible 10$$
\end{theorem}
\begin{proof}
    By induction,\\
    For $n=2$,
    \begin{align*}
        (2^{2^n} - 6) \divisible 10\\
        (2^{2^(2)} - 6) \divisible 10\\
        2^4 - 6 \divisible 10\\
        16 - 6 \divisible 10\\
        10 \divisible 10
    \end{align*}
    For $n>2$,
    \begin{align*}
        (2^{2^n} - 6) \divisible 10&\\
        (2^{2^n} - 6) \mod 10 &= 0\\
        2^{2^n} \mod 10 &= 6\\
        (2^{2^n})^2 \mod 10 &= 6^2 = 36\\
        (2^{2^n 2}) \mod 10 &= 6\\
        (2^{2^{n+1}} - 6) \mod 10 &= 0\\
        (2^{2^{n+1}} - 6) \divisible 10&\\
    \end{align*}
    Therefore $\forall n \in \N, n \geq 2$,
    $$(2^{2^n} - 6) \divisible 10$$
\end{proof}

% Problem 5
\newpage
\section{}

% Part a
\subsection{Show that $\sqrt{2} \notin \Q$}
\begin{definition}
    $\sqrt{2} := x > 0 : x^2 = 2$
\end{definition}
\begin{theorem}
    $\sqrt{2} \notin \Q$
\end{theorem}
\begin{proof}
    Assume $\sqrt{2} \in \Q$,
    $$\sqrt{2} \in \Q \implies \exists m,n \in \N : \frac{m}{n} = \sqrt{2}$$
    Also assume that $m,n$ are coprime. (i.e) $\gcd(m,n)=1$\\
    Let $m = \sqrt{2} n$,
    \begin{align*}
        m = \sqrt{2} n \implies m^2 = 2 n^2 \implies m^2 \divisible 2 \implies m \divisible 2\\
        m \divisible 2 \implies \exists k \in \N : m = 2k \implies m^2 = (2k)^2 = 4 k^2\\
        4k^2 = 2 n^2 \implies 2k^2 = n^2 \implies n^2 \divisible 2 \implies n \divisible 2
    \end{align*}
    This is false becouse with $\gcd(m,n)=1$, $m$ and $n$ cannot both be even.
\end{proof}

% Part b
\subsection{Show that
    $\forall a,b \in \Q, a < b \implies \exists x \in \R \backslash \Q : a < x < b$
}
\begin{theorem}
    $\forall a,b \in \Q, a < b \implies \exists x \in \R \backslash \Q : a < x < b$
\end{theorem}
\begin{proof}
    Since $\Q$ lacks completeness, some irrational element $x \in \R \backslash \Q$
    exists between all two rational numbers $a,b\in \Q : a \neq b$.
    Therefore, $a < b \implies \exists x : a < x < b$.
\end{proof}

% Part c
\subsection{Show that
    $\forall a,b \in \R \backslash \Q, a < b \implies \exists x \in Q : a < x < b$
}
\begin{theorem}
    $\forall a,b \in \R \backslash \Q, a < b \implies \exists x \in Q : a < x < b$
\end{theorem}
\begin{proof}
    Since the set of all irrational numbers, $\R \backslash \Q$, lacks completeness,
    some rational elements $x \in \Q$ must exists between each irrational numbers
    $a,b \in \R \backslash \Q$. Therefore $a < b \implies \exists x : a < x < b$.
\end{proof}

\newpage
% Problem 6
\section{}
Prove that for any $n$:
% Part a
\subsection{}
\begin{theorem}\label{thm:n_lines}
    For any configurations of $n$ straight lines on a plane, one could
    color the plane in two colors so that every two parts with the same boundary
    would have different colors.
\end{theorem}
\begin{proof}
    Proof by induction:\\
    For $n=1$,
    When one line splits up a plane there are two sections that
    can be painted into seperate colors. Therefore Theorem \ref{thm:n_lines} is true.
    For $n>1$,
    When $n$ lines split up a plane and each section is painted a different color,
    the when an additional line is added, all sections that it goes throug will be
    slit in two and then the sections can still be pained alternativly.
    Therefore Theroem \ref{thm:n_lines}$(n)$ $\implies$ Theorem \ref{thm:n_lines} $(n+1)$.
    Therefore, $\forall n \in \N$, Theorem \ref{thm:n_lines} is true.
\end{proof}

% Part b
\subsection{}
\begin{theorem}
    For any set of $n$ squares, one can partitian them into a finite amount of pieces
    and which will constitute one square.
\end{theorem}
\begin{proof}
    First, when $n=1$, the square is already a square.\\
    For every $n$ squares capable of becoming a square,
    a new square (of size $x^2$) can then be partitioned into a square and two
    rectangles making an $L$ around the $n$ square to be the $n+1$ square.
\end{proof}

% Part c
\subsection{What's wrong with this theorem?}
\textbf{Theorem 1.} All the numbers are equal. In other words,
the statement $P_n$ is true for all $n\in \N$, where $P_n$ is
``if $\{a_1,a_2,\dots,a_n\}$ is a collection of $n$ numbers,
then $a_1 = a_2 = \cdots = a_n$''.\\

\textit{Proof.} $P_1$ is true. Let $\{a_1,a_2,\dots,a_{n+1}\}$ be a collection of
$n+1$ numbers. Consider the collection $\{a_1,a_2,\dots,a_n\}$. Thanks to $P_n$
it follows that $a_1 = \cdots = a_n$ denote this number by $b$.
Now, consider the collection $\{a_2,a_4,\dots,a_{n+1}\}$.
It contains $n$ numbers, annd hence by $P_n$ we get $a_2 = \cdots = a_n = a_{n+1}$.
But $a_2 = \cdots = a_n = b$, therefore $a_{n+1} = a_n = b$.
So $a_1 = \cdots = a_{n+1} = b$ and $P_{n+1}$ follows.\\

A lot of issues exist, but one obvious one is that $P_n$ saying a collection
is equal to $b$ does not also indicate a different collection is $b$.
The ``numbers'' also doesn't indicate what numbers $a_i$ are selected from.

\end{document}


\section{Measure and Outer Measure}
\subsection{Outer Measure and Measurability}
  \paragraph{1.}
  \begin{proof}
    Suppose that $E\subset X$ and there is a measurable $B$ with $\bar{\mu}B=0$
    such that $E\subset B$. We show that $E$ is measurable, that is, for every
    $A\subset X$ with finite outer measure, $\mu^*(A)\ge\mu^*(A\cap E)+\mu^*(
    A\cap E^c)$. Since $A\cap E\subset E\subset B$ and $\mu^*$ is monotone,
    $\mu^*(A\cap E)\le\mu^*(B)=\bar{\mu}B=0$. Again by the monotonicity, $\mu^*(
    A)\ge\mu^*(A\cap E^c)$. Thus, $E$ is measurable, implying that $\bar{\mu}$
    is complete.
  \end{proof}

  \paragraph{2.}
  \begin{proof}
    From the countable subadditivity we obtain that $\mu^*(A\cap E)\le\sum\mu^*
    (A\cap E_i)$. For the converse, first we consider just $E_1$ and $E_2$.
    Since $E_1$ is measurable,
    \[
      \mu^*(A\cap E)=\mu^*(A\cap E\cap E_1)+\mu^*(A\cap E\cap E_1^c)
      \ge\mu^*(A\cap E_1)+\mu^*(A\cap E_2).
    \]
    By induction on $n$ we get $\mu^*(A\cap E)\ge\sum_{i=1}^n\mu^*(A\cap E_i)$.
    Let $n\to\infty$ and the proof is completed.
  \end{proof}
% end
\subsection{The Extension Theorem}
  \paragraph{4.}
  \begin{proof}
    $\,$\par
    (a) Since $\{D_j\}$ partitions $A$, $C_i\subset A$ for each $i$ and
    $\mcal{C}$ is closed under intersection, by condition (i), $\mu C_i=\sum_j
    \mu(C_i\cap D_j)$. Similarly for $\mu D_j$. Thus,
    \[
      \sum_i\mu C_i=\sum_{i,j}\mu(C_i\cap D_j)=
      \sum_j\sum_i\mu(C_i\cap D_j)=\sum_j\mu D_j.
    \]
    This result implies that the definition of $\mu$ on $\mcal{A}$ is
    well-defined. \par
    (b) Since every $A\in\mcal{A}$ is a finite union of sets of $\mcal{C}$, it
    suffices to show that $\mu C\ge\sum\mu C_i$. Then, from this condition, the
    countably additivity follows. Since $\mu$ is nonnegative and monotone,
    $\mu C\ge\sum_{i=1}^n\mu C_i$ for all positive integer $n$. Let $n\to\infty$
    and we get $\mu C\ge\sum\mu C_i$.
  \end{proof}

  \paragraph{7.}
  \begin{proof}
    To prove the "if" part, let $\vep_n=1/n$ and $A_n\in\mcal{A}_\delta$ be such
    that $\mu^*(E\setminus A_n)<\vep_n$. Put $A=\bigcup A_n$. Since the
    collection of $\mu^*$-measurable sets is a $\sigma$-algebra, $A$ is
    measurable. Meanwhile, since $\mu^*(E\setminus A)\le\mu^*(E\setminus
    A_n)<\vep_n$, $E\setminus A$ is of $\mu^*$-measure zero. Hence, it is
    measurable. Thus, $E=A\cup(E\setminus A)$ is also measurable.\par
    For the converse, suppose that $E$ is measurable and let $\vep>0$ be fixed.
    Note that $E^c$ is also measurable. Hence, by Prop. 6, there is a set $A\in
    \mcal{A}_\sigma$ with $E^c\subset A$ and
    \[
      \vep>\mu^*(A\setminus E^c)=\mu^*(A\cap E).
    \]
    Then, $A^c\in\mcal{A}_\delta$, $A^c\subset E$ and $\mu^*(E\setminus A^c)=
    \mu^*(E\cap E)<\vep$.
  \end{proof}
% end


\chapter{Kepler data processing}
\label{Chapter3}

\section{Fitting eclipsing binary minima}
To obtain precise time of minima in eclipsing binary systems we need to define function that will fit minima shape with best precision.
There is phenomenological and physical methods that allow fo fit all light curve. Because we have a large number of eclipsing binary systems in Kepler EB catalogue we prefer to use phenomenological fitting of only minima parts of light curves.

\subsection{Gauss and Lorentzian fit}
The main advantage of this two function is their simplicity and ability to get coordinates of centre ($x_{c}$) after fitting light curve.
With another more complex functions that are discussed below we must to derivative it before we can find $x_{c}$.

Gaussian function:
\begin{equation}\label{eq:gaus}
F(\varphi)= A\cdot \exp(-\frac{(\varphi - x_{c})^2}{2\sigma^2})
\end{equation}

Lorentzian function:
\begin{equation}\label{eq:lorentz}
F(\varphi)= A \frac{w^2}{w^2 + (\varphi - x_{c})^2}
\end{equation}

Functions perform good fit when EB minima has shape similar to normal distribution. In case of narrow minima such functions have a slightly larger error. Also function perform good fit when we fit only minima part but not all light curve.

\subsection{Mikulasek phenomenological model}
Method is aimed to establish a general model of LCs of eclipsing
systems (ES; both eclipsing binaries and stars with transiting
planets) that could fit the LCs with an accuracy of 1\% of their
amplitudes or better.

The model function of a monochromatic light curve (expressed in magnitudes) of eclipsing
systems $F(\varphi, \lambda)$, can be assumed as the sum of three particular functions:

\begin{equation} \label{eq:mik_general}
F(\varphi, \lambda) = F_{e}(\varphi, \lambda) + F_{p}(\varphi, \lambda) + F_{c}(\varphi, \lambda)
\end{equation}

where $F_{e}$ describes the mutual eclipses of the components, $F_{p}$ models the proximity effects,
while $F_{c}$ approximates the O’Connell effect (irrespectively of its physical cause)

The profiles of both minima
are complex functions determined primarily by the geometry
of the system and the relative brightness of components in
a given spectral region centred at the effective wavelength $\lambda_{eff}$.
The contribution of eclipses $F_{e}(\vartheta, \lambda_{eff})$ to an ES light curve can
be approximated by a sum of two special periodic functions of
phase function $\vartheta$. In the case of circular orbits, eclipses are exactly
symmetrical around their centres at phases $\varphi_{01}$ and $\varphi_{02}$. If
we put the origin of the phase function $M_{0}$ at the time of the
primary minimum, then $\varphi_{01} = 0$, $\varphi_{02} = 0.5$.
The model function was selected so that it describes as aptly
as possible those parts of LCs that are in the vicinity of their
inflex points, where their slopes are maximum. The functions
are parameterized by their widths $D_{1}, D_{2}$, eclipse LC kurtosis
coefficients $\Gamma_{1}, \Gamma_{2}$, dimensionless correcting factors $C_{1},C_{2}$, and
central depths $A_{1}(\lambda_{eff}), A_{2}(\lambda_{eff})$:

\begin{equation} \label{eq:mik_main}
F_{e}(\vartheta, \lambda_{eff})=\sum_{k=1}^{n_{e}} A_{k} \left( 1+C_{k} \frac{\varphi_{k}^2}{D_{k}^2}\right)
\left\lbrace 1-\left\lbrace
1-exp\left[ 1-\cosh\left(\frac{\varphi_{k}}{D_{k}}\right)\right]
\right\rbrace^{\Gamma_{k}}\right\rbrace
\end{equation}

\begin{equation} \label{eq:mik_2}
\varphi_{k} = \vartheta - 0.5 (k - 1) - round \left[ \vartheta - 0.5 (k - 1)\right] ,
\end{equation}

where the summation is over the number of eclipses during one
cycle, $n_{e}$: $n_{e} = 2$ or $n_{e} = 1$ (the common situation for exoplanet
transits). Each eclipse in a given colour is thus described by only
four parameters – its depth $A$, width $D$, kurtosis $\Gamma$, and the correcting
parameter $C$. \parencite{mikulasek2015}

In the case of EBs with two minima in a cycle ($n_{e} = 2$), we
need eight parameters, but sometimes the number of needed parameters
can be smaller. Inspecting the parameters $D, \Gamma$, and
$C$ for both eclipses of many EBs, we have concluded that they
are as a rule nearly the same: especially $D1 \cong D2, \Gamma_{1} \cong \Gamma_{2}$, and
$C_{1} \cong C_{2}$. We therefore usually need only five monochromatic parameters
($A_{1}, A_{2}, D, \Gamma,C$). The parameter $C$ is mostly comparable
to its uncertainty, so we can neglect it entirely. Then we need
just four parameters! On the other hand, in EBs with totalities
we see that the bottoms of their occultations are flat whilst transits
are convex. It can be described by introducing of different
parameters $C_{1},C_{2}$.

The LCs of the exoplanet transits ($n_{e} = 1$) need only
four parameters ($A, D, \Gamma,C$; in cases of very precise
measurements, we add another dimensionless parameter $K$:

\begin{equation}\label{eq:mik_3}
F_{e} = A\left( 1+C \frac{\varphi^2}{D^2}+K\frac{\varphi^4}{D^4}\right)
\left\lbrace 1- \left\lbrace 1-exp\left[ 1-\cosh \left( \frac{\varphi}{D}\right) \right] \right\rbrace ^{\Gamma} \right\rbrace
\end{equation}

Testing several dozens of LCs of various types of ESs, we found
that the standard deviation of the fit is typically well below one percent.
The only minor inconvenience is the existence of a spike (a jump in derivatives) in
the mid-eclipses for LCs with $\Gamma < 1$.

The contribution of proximity effects $F_{p}(\vartheta)$ should be an
even function symmetric with the phases 0.0 and 0.5, consequently
they can be satisfactorily expressed as a linear combination of $n_{p}$ elementary cosine functions $\cos(2\pi \vartheta)$,
$\cos(4\pi \vartheta)$, $\cos(6\pi \vartheta)$, etc. The even terms are the consequence
of the ellipticity of tidally interacting components, whilst the odd
terms result from the differences between the near and far sides
of components. As a rule we can limit ourselves only to the first
two or three terms in the $F_{p}$ \parencite{russell1952,kallrath1999}.
The O’Connell effect contribution $F_{c}(\vartheta)$ can be modelled well by a simple sinusoid \parencite{davidge1984, wilsey2009}:

\begin{equation}\label{eq:mik_Fp}
F_{p}  = \sum_{k=n_{e}+1}^{n_{p}+n_{e}} A_{k}\cos \left[ 2\pi(k-n_{e})\vartheta\right]
\end{equation}

\begin{equation}\label{eq:mik_Fc}
F_{c}  = \sum_{k=n_{p}+n_{e}+1}^{n_{c}+n_{p}+n_{e}} A_{k}\cos(2\pi\vartheta)
\end{equation}

where $n_{p}$ is the number of terms in $F_{p}(\vartheta)$: $n_{p} = 0, 1, 2, 3,\ldots $,
$n_{c} = 0$, if the O’Connell asymmetry is not present, otherwise $n_{c} = 1$.

\subsection{Andronov phenomenological model}
The basic function („special shape“) for the eclipse is $H(z)=(1-\left| z\right|^\beta)^{3/2}$, $-1\leq z \geq +1$, where $\beta=C_{5}$
is the parameter describing behaviour close to the mid-eclipse (0 – very narrow, 1 – triangular, 2 – parabolic, $\gg2$ – flat).

The complete function includes a TP2 part (a trigonometrical polynomial of the second order), which
approximates three effects: reflection, ellipticity and O’Connell and has 12 parameters, including two for the
corrected initial epoch and the period (Andronov, Tkachenko \& Chinarova, 2016):

\begin{equation}\label{eq:andronov}
\begin{split}
x(\phi)=C_{1}+C_{2}\cos(2\pi(\phi-\phi_{0}))+ C_{3}\sin(2\pi(\phi-\phi_{0}))+C_{4}\cos(4\pi(\phi-\phi_{0}))+ \\
C_{5}\sin(4\pi(\phi-\phi_{0}))+ C_{6}H((\phi-\phi_{0})/C_{8};C_{9})+ C_{7}H((\phi-\phi_{0}-0.5)/C_{8};C_{10})
\end{split}
\end{equation}

In previous works \parencite{andronov2012}, $\phi_{0}=0$ was used but, in \cite{andronov2016}, authors added two parameters
(C11, C12) to correct the initial epoch and the period. Of course, when needed, it is possible to add more
parameters to describe the possible period changes.

Even if more complicated models may be comparable in accuracy, the
smallest possible number of the NAV (“New Algol Variable”)  parameters and their clear physical sense is the advantage of this method.