\documentclass[main.tex]{subfiles}
\begin{document}

\section{T-products and Wick's theorem}

\marginpar{Saturday\\ 2020-6-13, \\ compiled \\ \today}

We have shown up to now that in order to describe an interacting QFT it is sufficient to:
\begin{enumerate}
    \item know the free evolution of the fields, which is governed by \(H_0 \) and described in the Heisenberg picture;
    \item be able to calculate the time-evolution operator up to an arbitrary perturbative order with \eqref{eq:dyson-series}.
\end{enumerate}

When we write the Hamiltonian, we always mean the \textbf{normal-ordered} Hamiltonian.

\begin{definition}
The \(S\)-matrix evolution operator is given by:
%
\begin{subequations} \label{eq:s-matrix}
\begin{align}
S = U_I (- \infty , \infty )
&= T \qty[\exp(-i \int_{- \infty }^{\infty } \dd{\tau }H _{\text{int}}^{I} (\tau ))]  \\
&= T \qty[\exp(-i \int \dd[4]{x} \mathscr{H} _{\text{int}}^{I} (x))]
\,.
\end{align}
\end{subequations}
\end{definition}

This object describes all the interaction that can happen over all of time (this is used when describing actual interactions, temporal infinity is asymptotically the same as the particles flying away and not interacting anymore).

In the calculation of such an object, we will need to compute products such as
%
\begin{align}
T \qty[\mathscr{H} _{\text{int}}^{I}(x_1 ) \mathscr{H} _{\text{int}}^{I}(x_2 )]
= T \qty[ N[\overline{\psi} \slashed{A} \psi ]_{x_1 }N[\overline{\psi} \slashed{A} \psi ]_{x_2 }]
\,,
\end{align}
%
where we wrote the QED interaction Hamiltonian density. The way to compute these objects is to make use of \textbf{Wick's theorem}.

\subsection{Wick theorem for a real scalar field}

We start from the simplest case and then generalize to more complex ones.

\begin{definition}
The \textbf{Feynman propagator} for a real scalar field is defined as
%
\begin{align}
D_F (x-y) = \bra{0} T[\varphi (x) \varphi (y)] \ket{0}
= \contraction{}{\varphi}{(x)}{\varphi }
\varphi (x) \varphi (y)
\,.
\end{align}
\end{definition}

Now, from the definition of the time-ordered product we have that
%
\begin{subequations}
\begin{align}
D_F (x-y) &=
[x_0 > y_0 ]
\bra{0} \varphi (x) \varphi (y) \ket{0}
+
[x_0 < y_0 ]
\bra{0} \varphi (y) \varphi (x) \ket{0}  \\
&=
[x_0 > y_0 ]
\bra{0} \varphi_{+} (x) \varphi_{-} (y) \ket{0}
+
[x_0 < y_0 ]
\bra{0} \varphi_{+} (y) \varphi_{-} (x) \ket{0}  \\
&=
[x_0 > y_0 ]
D_+ (x-y)
-
[x_0 < y_0 ]
D_- (x-y)
\,,
\end{align}
\end{subequations}
%
since \(\varphi_{+} \ket{0} = 0\) and \(\bra{0} \varphi_{-} = 0 \), as \(\varphi_{+} \sim a\) and \(\varphi_{-} \sim a ^\dag\).

Here \(D_{\pm}\) are the components of the covariant commutator defined in section \ref{sec:covariant-commutators}.

Then, the crucial statement is that
\begin{claim}
\begin{align}
T [\varphi (x) \varphi (y)] = N[\varphi (x) \varphi (y)] + D_F (x-y)
\,.
\end{align}
\end{claim}

\begin{proof}
We prove this by writing the term \(T[\varphi \varphi ] - N[ \varphi \varphi ]\) explicitly: we get
%
\begin{subequations}
\begin{align}
& T[\varphi (x)\varphi (y)] - N[\varphi (x) \varphi (y)] = \\
\begin{split}
&= [x_0 > y_0 ] \qty(\varphi (x) \varphi (y)) + [x_0 < y_0 ] \qty(\varphi (y) \varphi (x)) \\
&
- \qty([x_0 > y_0 ] + [x_0 < y_0 ]) N [\varphi (x)\varphi (y)]
\end{split}  \\
\begin{split}
&=
[x_0 > y_0 ] \qty(\varphi_{-} (x) \varphi_{-} (y) + \varphi_{+} (x) \varphi_{+} (y) + \varphi_{-} (x) \varphi_{+} (y) + \hlc{teal}{\varphi_{+} (x) \varphi_{-} (y)}) \\
&
+
[x_0 < y_0 ] \qty(\varphi_{-} (y) \varphi_{-} (x) + \varphi_{+} (y) \varphi_{+} (x) + \varphi_{-} (y) \varphi_{+} (x) + \hlc{teal}{\varphi_{+} (y) \varphi_{-} (x)})
\\
&
-
[x_0 > y_0 ]
\qty(\varphi_{-} (x) \varphi_{-} (y) + \varphi_{+} (x) \varphi_{+} (y) + \varphi_{-} (x) \varphi_{+} (y) + \hlc{teal}{\varphi_{-} (y) \varphi_{+} (x)} )
\\
&
-
[x_0 < y_0 ]
\qty(\varphi_{-} (x) \varphi_{-} (y) + \varphi_{+} (x) \varphi_{+} (y) + \varphi_{-} (x) \varphi_{+} (y) + \hlc{teal}{\varphi_{-} (y) \varphi_{+} (x)} )
\end{split}  \\
&= [x_0 > y_0 ] \qty(\varphi_{+} (x) \varphi_{-} (y) - \varphi_{-} (y) \varphi_{+} (x))
- [x_0 < y_0 ] \qty(\varphi_{-} (x) \varphi_{+} (y) - \varphi_{+}(y) \varphi_{-}(x))  \\
&=
[x_0 > y_0 ]
D_+ (x-y)
-
[x_0 < y_0 ]
D_- (x-y) \\
&= D_F (x-y)
\,.
\end{align}
\end{subequations}
\end{proof}

Wick's theorem for scalar fields is the generalization of this result to \(n\) fields:
It states that
%
\begin{subequations}
\begin{align}
\begin{split}
T [\varphi (x_1 ) \varphi (x_2 ) \dots \varphi (x_n)]
&=
N [\varphi (x_1 ) \varphi (x_2 )\dots \varphi (x_n)] \\
&+ \sum_{i} N[\varphi (x_1 )\dots \varphi (x_{i-1}) D_F (x_i- x_{i+1}) \varphi (x_{i+2}) \dots \varphi (x_n)]  \\
&+ \sum _{ij}
N[\varphi (x_1 )\dots \varphi (x_{i-1}) D_F (x_i- x_{i+1}) \varphi (x_{i+2}) \dots \\
& \dots \varphi (x_{j-1}) D_F (x_j- x_{j+1}) \varphi (x_{j+2}) \dots \varphi (x_n)]  \\
&+ \text{all possible contractions}
\,.
\end{split}
\end{align}
\end{subequations}

A \textbf{corollary} of Wick's theorem states that contractions of fields evaluated at the same time do not contribute to the \(T\)-product. Formally, this is stated as:
%
\begin{align}
T \qty[N[\varphi (x) \varphi (x)] \varphi (x_1 )\dots \varphi (x_n)]
= T \qty[\varphi^2(x) \varphi (x_1 )\dots \varphi (x_n)] _{\text{NCET}}
\,,
\end{align}
%
where the left hand side contains No Contractions at Equal Time --- that is, when we compute the time-ordered product using Wick's theorem we ignore the contractions we would have to compute at equal time.

\begin{proof}
The product \(N[\varphi (x) \varphi (x)]\) can be written, by Wick's theorem, as
%
\begin{align}
N[\varphi (x) \varphi (x)] = T[\varphi (x) \varphi (x)] - D_F (x - x)
\,,
\end{align}
%
where \(T[\varphi (x) \varphi (x)] = \varphi (x) \varphi (x)\). So, if we multiply by the field at the other times and take the time-ordering we find
%
\begin{align}
T \qty[N[\varphi (x) \varphi (x)] \varphi (x_1 )\dots \varphi (x_n)]
= T[\varphi^2(x) \varphi_1 (x) \dots \varphi_n (x)]
- D_F(x-x) T[\varphi_1 (x) \dots \varphi_n (x)]
\,,
\end{align}
%
and the term containing \(D_F( x-x)\) is precisely a contraction at equal time, which we ignore.
\end{proof}

This statement can be \textbf{generalized} to complex scalar fields and to vector fields.

\begin{definition}
For a complex scalar field \(\varphi \), the Feynman propagator is given by
%
\begin{align}
D_F (x-y) = \bra{0} T [\varphi (x) \varphi ^\dag (x)] \ket{0}
\,.
\end{align}
\end{definition}

\begin{claim}
This is the same function which was calculated for the real scalar field; one can show that the other contractions vanish:
%
\begin{align}
\bra{0} T[\varphi (x) \varphi (x)] \ket{0}
= 0 =
\bra{0} T[\varphi ^\dag(x) \varphi ^\dag (x)] \ket{0}
\,.
\end{align}
\end{claim}

\begin{proof}
\todo[inline]{Still to state properly, but this is due to the fact that \(a\) (\(a ^\dag\)) and \(b\) (\(b ^\dag\)) commute with each other, whereas \(a\) does not commute with \(a ^\dag\).}
\end{proof}

\begin{definition}
For a real vector field \(A^{\mu }\) and a complex vector field \(\omega^{\mu }\) the Feynman propagator reads:
%
\begin{subequations}
\begin{align}
D^{\mu \nu }_{F, \text{ real}} (x-y) &= \bra{0} T[A^{\mu }(x) A^{\nu }(y) ]\ket{0} \\
D^{\mu \nu }_{F, \text{ complex}} (x-y) &= \bra{0} T[\omega^{\mu }(x) \omega^{\nu \dag}(y) ]\ket{0}
\,.
\end{align}
\end{subequations}
\end{definition}

\begin{claim}
In the Feynman gauge \(\xi = 1\) we have that
%
\begin{align}
D^{\mu \nu }_{F} (x-y) = [x_0 > y_0 ]
D^{\mu \nu }_{+ } (x-y)
+
[x_0 < y_0 ]
D^{\mu \nu }_{-}(x-y)
= - \eta^{\mu \nu } D_F (x-y)
\,.
\end{align}
\end{claim}

Note that for a complex vector field the propagators between \(\omega^{\mu } \omega^{\nu }\) and \(\omega^{\mu \dag} \omega^{\nu \dag}\) vanish.

The Wick theorem generalizes to the complex scalar, and to the real and complex vector: we have
%
\begin{subequations}
\begin{align}
T[\varphi (x) \varphi ^\dag (y)] &= N[\varphi (x) \varphi ^\dag (y)] + D_F (x-y) \\
T[A^{\mu } (x) A^{\nu } (y)] &= N[A^{\mu } (x) A^{\nu } (y)] + D_F^{\mu \nu } (x-y) \\
T[\omega^{\mu } (x) \omega^{\nu  \dag} (y)] &= N[\omega^{\mu } (x) \omega^{\nu \dag } (y)] + D_F^{\mu \nu } (x-y)
\,.
\end{align}
\end{subequations}

\subsection{Feynman propagator for fermions}

For fermionic fields the discussion gets a little more complicated because of the minus signs coming from the anticommutators.

\begin{definition}
The Feynman propagator for fermions is defined as
%
\begin{align}
S^{F}_{\alpha \beta } (x-y)
&= \bra{0}T[\psi_{\alpha }(x) \overline{\psi}_{\beta }(y)] \ket{0}
= - \bra{0} T[\overline{\psi}_\alpha (x) \psi_{\beta }(y)] \ket{0}
\,.
\end{align}
\end{definition}

\begin{claim}
We have the following expression for the propagator:
%
\begin{subequations}
\begin{align}
S_F(x-y) &= [x_0 > y_0 ] S_+ (x-y) - [x_0 < y_0 ] S_- (x-y)  \\
&= \qty(i \slashed{\partial} + m) D_F (x-y)
\,.
\end{align}
\end{subequations}
\end{claim}

\begin{claim}
Wick's theorem holds in this case as well:
%
\begin{align}
T[\psi_{\alpha }(x) \overline{\psi}_{\beta }(y)]
= N [\psi_{\alpha }(x) \overline{\psi}_{\beta }(y)]
+ S^{F}_{\alpha \beta }
\,.
\end{align}
\end{claim}

\begin{proof}
Let us write explicitly the difference \(T[\psi \overline{\psi}] - N[\psi \overline{\psi}]\). We find something that is similar to the scalar case, but there is a crucial difference: instead of commuting operators when we switch them around for normal or time ordering, we anticommute them, so we swap their positions and change the sign. This then yields:
%
\begin{subequations}
\begin{align}
&T[\psi_{\alpha } (x) \overline{\psi}_{\beta } (y)] - N[\psi_{\alpha } (x) \overline{\psi}_{\beta } (y)] = \\
\begin{split}
&=
[x_0 > y_0 ] \qty(
    \psi_{\alpha }^{-} (x) \overline{\psi}^{-}_{\beta }(y)+
    \psi_{\alpha }^{+} (x) \overline{\psi}^{+}_{\beta }(y)+
    \psi_{\alpha }^{-} (x) \overline{\psi}^{+}_{\beta }(y)+
    \psi_{\alpha }^{+} (x) \overline{\psi}^{-}_{\beta }(y)
) \\
&-
[x_0 < y_0 ]\qty(
    \overline{\psi}_{\beta }^{-} (y) \psi^{-}_{\alpha } (x)+
    \overline{\psi}_{\beta }^{+} (y) \psi^{+}_{\alpha } (x)+
    \overline{\psi}_{\beta }^{-} (y) \psi^{+}_{\alpha } (x)+
    \overline{\psi}_{\beta }^{+} (y) \psi^{-}_{\alpha } (x)
)  \\
&-
[x_0 > y_0 ] \qty(
    \psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{-}(y)+
    \psi_{\alpha }^{+}(x) \overline{\psi}_{\beta }^{+}(y)+
    \psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)-
    \overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
)\\
&-
[x_0 < y_0 ] \qty(
    \psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{-}(y)+
    \psi_{\alpha }^{+}(x) \overline{\psi}_{\beta }^{+}(y)+
    \psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)-
    \overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
)
\end{split}\\
\begin{split}
&= [x_0 > y_0 ]\qty(
    \psi_{\alpha }^{-} (x) \overline{\psi}^{+}_{\beta }(y)+
    \psi_{\alpha }^{+} (x) \overline{\psi}^{-}_{\beta }(y)-
    \psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)+
    \overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
) \\
&+
[x_0 < y_0 ]\bigg(-
    \overline{\psi}_{\beta }^{-} (y) \psi^{-}_{\alpha } (x)-
    \overline{\psi}_{\beta }^{+} (y) \psi^{+}_{\alpha } (x)-
    \overline{\psi}_{\beta }^{-} (y) \psi^{+}_{\alpha } (x)-
    \overline{\psi}_{\beta }^{+} (y) \psi^{-}_{\alpha } (x)+\\
    &\phantom{=}\
    -\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{-}(y)-
    \psi_{\alpha }^{+}(x) \overline{\psi}_{\beta }^{+}(y)-
    \psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)+
    \overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
\bigg)
\end{split}
\,.
\end{align}
\end{subequations}

\todo[inline]{To finish calculation}
\end{proof}

\subsection{General statement of Wick's theorem}

We denote by \(B_i (x_i)\) a generic field, which may be real or complex, of spin 0, \(1/2\) or 1. Then, Wick's theorem states that \textbf{the \(T\)-product of \(n\) such fields can be written as}:
%
\begin{subequations}
\begin{align}
\begin{split}
& T[B_1 (x_1 ) B_2 (x_2 ) \dots B_n (x_n)]= \\
&= N[B_1 (x_1 ) B_2 (x_2 ) \dots B_n (x_n)]  \\
&+ \sum _{ij} (-)^{P_{ij}}
 N[ \dots \bcontraction{}{B}{_i (x_i)}{B}
 B_i(x_i)B_j(x_j) \dots]  \\
&+ \sum _{ijkl} (-)^{P_{ij}+P_{kl}} N[\dots  \bcontraction{}{B}{_i (x_i)}{B}
B_i(x_i)B_j(x_j) \dots \bcontraction{}{B}{_k (x_k)}{B}
B_k(x_k)B_l(x_l) \dots]  \\
&+ \dots \,,
\end{split}
\end{align}
\end{subequations}
%
where \(P_{ij}\) is the number of fermion operator swaps we need to perform to bring \(B_i\) and \(B_j\) to the front; the normal-ordered product with \(\hat{B}_i\) means that it is taken removing \(B_i\).

Note that, while we are summing over all possible pairings, the only nonvanishing propagators are those between two copies of the same field.

We have the same \textbf{corollary} as before: normal-ordered contractions of fields at the same time do not contribute; we have
%
\begin{align}
T \qty[N[B_1 (x) B_2 (x)] B_3 (x_3 ) \dots B_n (x_n)]
= T \qty[B_1 (x) B_2 (x) B_3 (x_3) \dots B_n (x_n)]_{NCET}
\,.
\end{align}

\subsection{Feynman propagators}

The Feynman propagators play a central role in the perturbative expansion. What is their physical interpretation?

\subsubsection{Real scalar}

As we saw, the propagator for a real scalar field can be written in terms of the Vacuum Expectation Value of the fields as:
%
\begin{align}
D_F(x-y) = [x_0 > y_0 ] \bra{0} \varphi_+ (x) \varphi_{-} (y) \ket{0}
+ [x_0 < y_0 ] \bra{0}\varphi_{+} (y) \varphi_{-}(x) \ket{0}
\,.
\end{align}

What do these pieces mean? Let us first consider the case where \(x_0 > y_0 \): then we only have
%
\begin{align}
D_F (x-y) = \bra{0} \varphi_{+} (x) \varphi_{-} (y) \ket{0} \sim \bra{0} a a ^\dag \ket{0}
\,,
\end{align}
%
which can be read from right to left as:
\begin{enumerate}
    \item we start from the vacuum \(\ket{0}\);
    \item we apply the operator \(\varphi_{-} (y)\), which creates a particle of indeterminate momentum at the position \(y\);
    \item the particle is destroyed at the position \(x\) by the operator \(\varphi_{+}(x)\);
    \item we return to the vacuum state \(\bra{0}\).
\end{enumerate}

This can be represented graphically as shown in

\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{feynman}
\vertex (y) {\(y\)};
\vertex [below right = 2cm and 2cm of y] (x) {\(x\)};
\vertex [right = 4cm of y] (y0) {\(y_0 \)};
\vertex [below right = 2cm and 4cm of y] (x0) {\(x_0 \)};
\diagram*{
    (y)  -- [scalar, momentum] (x),
    (y0) -- [fermion, edge label = \(t\)] (x0)
};
\end{feynman}
\end{tikzpicture}
\caption{Virtual scalar particle. Time is shown as going downward, the diagram shows the virtual scalar particle being created at \(y\) and then destroyed at \(x\).}
\label{fig:virtual-scalar-particle-diagram-1}
\end{figure}

Now, let us consider the other case: \(x_0 < y_0 \). Now, the second term contributes, so we have
%
\begin{align}
D_F (x-y) = \bra{0} \varphi_{+} (y) \varphi_{-} (x) \ket{0} \sim \bra{0} a a ^\dag \ket{0}
\,,
\end{align}
%
so we can interpret it again as:
\begin{enumerate}
    \item we start from the vacuum \(\ket{0}\);
    \item we apply the operator \(\varphi_{-} (x)\), which creates a particle of indeterminate momentum at the position \(x\);
    \item the particle is destroyed at the position \(y\) by the operator \(\varphi_{+}(y)\);
    \item we return to the vacuum state \(\bra{0}\).
\end{enumerate}

\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{feynman}
\vertex (x) {\(x\)};
\vertex [below left = 2cm and 2cm of x] (y) {\(y\)};
\vertex [right = 2cm of x] (x0) {\(x_0 \)};
\vertex [below right = 2cm and 2cm of x] (y0) {\(y_0 \)};
\diagram*{
    (x)  -- [scalar, momentum] (y),
    (x0) -- [fermion, edge label = \(t\)] (y0)
};
\end{feynman}
\end{tikzpicture}
\caption{Virtual scalar particle. Time is shown as going downward, the diagram shows the virtual scalar particle being created at \(x\) and then destroyed at \(y\).}
\label{fig:virtual-scalar-particle-diagram-2}
\end{figure}

Neither of these two is Lorentz invariant; however the full propagator is. So, we depict it as shown in figure \ref{fig:virtual-scalar-particle-diagram}.

\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = y to x]{
    y [particle=\(y\)] -- [scalar, momentum=\(a\), reversed momentum'=\(a\)] x [particle=\(x\)]
};
\caption{Scalar virtual particle. Time goes either upward or downward.}
\label{fig:virtual-scalar-particle-diagram}
\end{figure}

% \todo[inline]{What does \(a\) mean here?}

A note of caution: the diagrammatic approach is nice but it does not represent the physical trajectory of a particle, since it does not enforce it being on shell.
Nevertheless, just like a quantum particle can tunnel through a potential barrier higher than its energy, the propagator describes a probabilistic physical process.

\subsubsection{Explicit calculation of the scalar propagator}

Starting from the expression we derived in an earlier chapter for the propagator \eqref{eq:scalar-field-propagator} as an integral in momentum space, we can write
%
\begin{subequations}
\begin{align}
D_F (x-y) &= [x_0 > y_0 ] D_+ (x-y) + [x_0 < y_0 ] D_- (x-y)  \\
&= \frac{1}{(2 \pi )^3} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\qty[[x_0 > y_0 ] e^{-ik(x-y)} + [x_0 < y_0 ] e^{ik(x-y)}]  \\
&= i \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}}\frac{e^{-ik(x-y)}}{k^2-m^2}\\
&= \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}} \widetilde{D}_{F} (k) e^{-ik (x-y)} \label{eq:fermion-propagator-momentum-space}
\,.
\end{align}
\end{subequations}

This defines the scalar propagator in momentum space
%
\begin{align}
\widetilde{D}_{F}(k) = \frac{i}{k^2- m^2}
\,,
\end{align}
%
while the integration region is \(\mathbb{R}^{3}\) for the coordinates \(\vec{k}\), and for the coordinate \(k^{0}\) it is a contour following the real axis rightward, except for circling the singularity \(k_0 = - \omega_{k}\) from below, and \(k^{0} = \omega_{k}\) from above.

This shows explicitly that the propagator \emph{must} represent an \textbf{off-shell} particle: we must have \(k^2 \neq m^2\), otherwise the propagator diverges.

\subsubsection{Complex scalar field}

For the complex scalar field we have that
%
\begin{subequations}
\begin{align}
\varphi_{+} &\sim a(k) e^{-ikx}
&
\varphi_{-} &\sim b ^\dag(k) e^{ikx}  \\
\varphi_{+}^\dag &\sim b(k) e^{-ikx}
&
\varphi_{-}^\dag &\sim a ^\dag(k) e^{ikx}
\,.
\end{align}
\end{subequations}

So, the propagator is given by
%
\begin{subequations}
\begin{align}
D_F (x-y) &= \bra{0} T [\varphi (x) \varphi ^\dag (y)] \ket{0}  \\
&= [x_0 > y_0 ] \bra{0} \varphi_{+} (x) \varphi_{-}^\dag(y) \ket{0}
+ [x_0 < y_0 ] \bra{0} \varphi_{+}^\dag(y) \varphi_{-}(x) \ket{0}
\,,
\end{align}
\end{subequations}
%
since we get the only nonvanishing contributions when we have coupled operators together, such as \(a \) and \(a ^\dag\).

So, if \(x_0 > y_0 \) we have the particle \(a\) propagating from \(y\) to \(x\), while if \(x_0 < y_0 \) the antiparticle \(b\) propagates from \(x\) to \(y\).
Then, we can draw our diagram as shown in figure \ref{fig:virtual-charged-scalar-particle-diagram}: the arrow denotes the direction of propagation of the virtual particle \(a\), while the antiparticle \(b\) propagates in the other direction.

\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = x to y]{
    x [particle=\(x\)] -- [charged scalar, momentum=\(a\), reversed momentum'=\(b\)] y [particle=\(y\)]
};
\caption{Scalar charged virtual particle. Time goes either upward or downward.}
\label{fig:virtual-charged-scalar-particle-diagram}
\end{figure}

\begin{claim}
While the real scalar particle propagator is symmetric:
%
\begin{align}
D_F^{\mathbb{R}} (x-y)  =D_F^{\mathbb{R}} (y-x)
\,,
\end{align}
%
the complex scalar particle propagator is not:
%
\begin{align}
D_F^{\mathbb{C}} (x-y) \neq D_F^{\mathbb{C}} (y-x)
\,.
\end{align}
\end{claim}

\begin{proof}
The expression for the real scalar field propagator is explicitly symmetric under \(x \leftrightarrow y\), while for the complex field the term with \(x_0 > y_0 \) depends on \(a\), while the other one depends on \(b\).
\end{proof}

Because of this, we need to have an arrow to represent the direction of the particle flow.

\subsubsection{Propagator for a real vector}

The interpretation in this case is similar to the real scalar: the propagator is written as
%
\begin{subequations}
\begin{align}
D^{\mu \nu }_{F} (x-y) &= \bra{0} T[A^{\mu }(x) A^{\nu }(y)] \ket{0}  \\
&= [x_0 > y_0 ] \bra{0} A^{\mu }_{+}(x) A^{\nu }_{-}(y) \ket{0}
+ [x_0 < y_0 ] \bra{0} A^{\nu }_{+} y A^{\mu }_{-}(x) \ket{0}
\,.
\end{align}
\end{subequations}

This is represented diagrammatically as shown in figure \ref{fig:virtual-photon-diagram}.

\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = y to x]{
    y [particle={\(y\), \(\nu \)}] -- [photon, momentum=, reversed momentum'=] x [particle={\(x\), \(\mu \)}]
};
\caption{Virtual photon.}
\label{fig:virtual-photon-diagram}
\end{figure}

Since the vector field has an index, this index must be attached to both of the points.

The explicit expression for the photon propagator is given by
%
\begin{align}
D^{\mu \nu }_{F} (x-y) = \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}}
e^{-ik(x-y)} \widetilde{D}^{\mu \nu }_{F} (k) \overset{\xi = 1}{=} - \eta^{\mu \nu } D_F (x-y)
\,,
\end{align}
%
where the momentum-space propagator is generally given by
%
\begin{align}
\widetilde{D}^{\mu \nu }_{F} (k) = - \frac{i}{k^2} \qty(\eta^{ \mu \nu } - (1 - \xi ) \frac{k^{\mu }k^{\nu }}{k^2})
\overset{\xi = 1}{=}
- i \frac{\eta^{\mu \nu }}{k^2}
\,.
\end{align}

The integration circuit is the same one we had in the scalar case; now \(\omega_{k} = \abs{k}\) since the photon is massless.

The \textbf{complex vector} does not have any more complications than those found in combining the complex scalar and the real vector.

\subsubsection{Propagator for a fermion}

We have seen that the definition of the propagator for a Dirac fermion is
%
\begin{subequations}
\begin{align}
S^{\alpha \beta }_{F}(x-y)
&= \bra{0} T \qty[ \psi^{\alpha } (x) \overline{\psi}^{\beta }(y)] \ket{0}  \\
&= [x_0 > y_0 ]
\bra{0} \psi_{+}^{\alpha }(x) \overline{\psi}_{-}^{\beta } (y)\ket{0}
- [x_0 < y_0 ]
\bra{0} \overline{\psi}^{\beta }_{+}(y) \psi^{\alpha }_{-}(x) \ket{0}
\,.
\end{align}
\end{subequations}

The interpretation now follows that of the complex scalar field, since the fermion is complex-valued.
If \(x_0 > y_0 \), we only have the first piece:
%
\begin{align}
S^{\alpha \beta }_{F} (x-y) = \bra{0} \psi_{+}^{\alpha }(x) \overline{\psi}_{-}^{\beta } (y)\ket{0}
\,,
\end{align}
%
and since \(\psi_{+} \sim c\), while \(\psi_{-} \sim c ^\dag\), this represents a particle of type \(c\) being created and then annihilated.

We represent this with a full line with an arrow, going in the same direction as the particle.
The contribution we have when \(x_0 < y_0 \), on the other hand, is given by
%
\begin{align}
S^{\alpha \beta }_{F}(x- y) =
- \bra{0} \overline{\psi}^{\beta }_{+}(y) \psi^{\alpha }_{-}(x) \ket{0}
\,.
\end{align}

This is represented with a full line as well, and now the arrow goes in the opposite direction to the antiparticle. This is because \(\overline{\psi}_{+} \sim d\), while \(\psi_{-} \sim d ^\dag\). So, the total (Lorentz-invariant) propagator is represented as shown in figure \ref{fig:virtual-photon-diagram}.

\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = y to x]{
    y [particle={\(y\), \(\beta\)}] -- [fermion, momentum={\(e^{-} = c\)}, reversed momentum'={\(e^{+} = d\)}] x [particle={\(x\), \(\alpha \)}]
};
\caption{Virtual fermion.}
\label{fig:virtual-fermion-diagram}
\end{figure}

The analytic expression for the propagator in position and momentum space is given by:
%
\begin{subequations}
\begin{align}
S_F (x-y) &= \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}} e^{-ik (x-y)}
\widetilde{S}_{F} (k) = \qty(i \slashed{\partial} + m )D_F(x-y) \\
S_F (k) &= \frac{i}{\slashed{k} - m} = i \frac{\slashed{k} + m }{k^2- m^2} \label{eq:fermion-propagator-momentum-space-explicit}
\,.
\end{align}
\end{subequations}

Note that these integrals are often written in an \textbf{equivalent} way, using the \(+i \epsilon \) prescription:
%
\begin{subequations}
\begin{align}
D_F (x-y) &= \int \frac{ \dd[4]{k}}{(2 \pi )^{4}} \frac{e^{-ik(x-y)}}{k^2- m^2 + i \epsilon }  \\
\widetilde{D}_{F} &= \frac{i}{k^2- m^2 + i \epsilon }
\,,
\end{align}
\end{subequations}
%
where the integral is now straight along the real axis for the coordinate \(k_0 \); this way of writing is equivalent as long as we send \(\epsilon \to 0 \). Instead of integrating around the poles, we integrate straight and move the poles out of the way.\footnote{Like a galactic highway.}

\subsection{Uncontracted fields: physical interpretation}

In the expansion of the time-ordered product with the use of Wick's theorem we get contractions of fields (propagators) and normal-ordered products of uncontracted fields. What is the physical interpretation oof the latter?

\subsubsection{Uncontracted real scalar field}

We only have two possible terms: \(\varphi_{+}\) and \(\varphi_{-}\).
The first of these can be written as
%
\begin{subequations}
\begin{align}
\varphi_{+}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a(k) e^{-ikx}  \\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
    a -- [scalar, momentum = \(a\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}

So, we interpret it as a particle of intederminate momentum being annihilated at \(x\).
On the other hand, we have
\begin{subequations}
\begin{align}
\varphi_{-}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a ^\dag(k) e^{ikx}  \\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
    x [particle = \(x\)] -- [scalar, reversed momentum = \(a\)] a
};
\end{align}
\end{subequations}

So, \(\varphi_{-} (x)\) represents a particle being created ad \(x\) with indeterminate momentum.

\subsubsection{Uncontracted complex scalar field}

Now we have:
\begin{subequations}
\begin{align}
\varphi_{+}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a(k) e^{-ikx}  \\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
    a -- [charged scalar, momentum = \(a\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\varphi_{-} ^\dag(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a ^\dag(k) e^{ikx}  \\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
    x [particle = \(x\)] -- [charged scalar, reversed momentum = \(a\)] a
};
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\varphi_{+} ^\dag(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
b(k) e^{-ikx}  \\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
    a -- [anti charged scalar, momentum = \(b\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\varphi_{-} (x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
b ^\dag(k) e^{ikx}  \\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
    x [particle = \(x\)] -- [anti charged scalar, reversed momentum = \(b\)] a
};
\end{align}
\end{subequations}

Notice that the arrow tracks the direction in which the charge flows.

\subsubsection{Uncontracted real vector field}

The interpretation is always the same, I will write all the diagrams for completeness.
%
\begin{subequations}
\begin{align}
A^{\mu }_{+}(x) &= \frac{1}{(2\pi )^{3/2}}
\int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{\lambda } \epsilon^{\mu}_{\lambda } (k )a_{\lambda }(k) e^{-ikx}  \\
&= \feynmandiagram[inline=(a.base), horizontal = a to x]{
    a -- [photon, momentum] x [particle={\(x\), \(\mu \)}]
};
\end{align}
\end{subequations}
%
%
\begin{subequations}
\begin{align}
A^{\mu }_{-}(x) &= \frac{1}{(2\pi )^{3/2}}
\int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{\lambda } \epsilon^{\mu, *}_{\lambda } (k )a ^\dag_{\lambda }(k) e^{ikx}  \\
&= \feynmandiagram[inline=(x.base), horizontal = x to a]{
    x [particle={\(x\), \(\mu \)}] -- [photon, momentum] a
};
\end{align}
\end{subequations}

\subsubsection{Uncontracted Dirac fermion}

\begin{subequations}
\begin{align}
\psi_{+}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} c_r (k) u_r (k) e^{-ikx}
\\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
    a -- [fermion, momentum = \(c\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\overline{\psi}_{-}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} c_r ^\dag (k) \overline{u}_r (k) e^{+ikx}
\\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
    x [particle = \(x\)] -- [fermion, reversed momentum = \(c\)] a
};
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\overline{\psi}_{+} (x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} d_r (k) \overline{v}_r (k) e^{-ikx}
\\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
    a -- [anti fermion, momentum = \(d\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\psi_{-} (x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} d_r ^\dag (k) v_r (k) e^{ikx}
\\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
    x [particle = \(x\)] -- [anti fermion, reversed momentum = \(d\)] a
};
\end{align}
\end{subequations}

\end{document}


% Created 2016-04-08 fre 09:13
% Intended LaTeX compiler: pdflatex
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{khpreamble}
\author{Kjartan Halvorsen}
\date{2016-04-06}
\title{Computerized control - Partial exam 2 (20\%)}
\hypersetup{
 pdfauthor={Kjartan Halvorsen},
 pdftitle={Computerized control - Partial exam 2 (20\%)},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 24.5.1 (Org mode 8.3.4)},
 pdflang={English}}
\begin{document}

\maketitle

\section*{Instructions}
\label{sec:orgheadline1}
\begin{itemize}
\item The exam is a take-home exam scheduled from Wednesday 2016-04-06 12:00 to Thursday 2016-04-07 23:59.
\item Write your answers clearly and motivate well! You can write by hand or on a computer. If you write by hand, you may scan your pages using, for instance, the app CamScanner that can produce pdf-documents.
\item You are allowed to talk to your fellow students about concepts in the course, about problem solving in general, and about the particular problems in the exam. \textbf{You are, however, not allowed to show or share partial or complete solutions to the problems.}
\item For acute questions, I can be reached by WhatsApp: 55 62 19 4048
\end{itemize}

\section*{Problem 1 RST-design}
\label{sec:orgheadline4}
The plant in figure \ref{fig:2dof} is described by the pulse-transfer function
\begin{equation}
H(z) = \frac{0.8}{z(z-0.8)},
\end{equation}
which is a first order system followed by a time-delay of one sampling period.

Let the desired characteristic polynomial of the closed-loop system be
\begin{equation}
A_{cl}(z) = \underbrace{z(z-0.7)}_{A_c(z)}\underbrace{(z-0.5)}_{A_o(z)}.
\end{equation}

\subsection*{(a) 40p}
\label{sec:orgheadline2}
Determine the polynomials \(R(z)\), \(S(z)\) and \(T(z)\) in an RST controller of the form in figure \ref{fig:2dof}. The pulse transfer function of the closed-loop system from the command signal \(u_c\) to \(y\) should be
\begin{equation}
H_{c}(z) = \frac{0.3}{z(z-0.7)}.
\end{equation}
\begin{figure}
\begin{center}
\includegraphics[width=0.7\linewidth]{../../homework/rst-block}
\caption{RST controller}
\label{fig:2dof}
\end{center}
\end{figure}

\subsection*{(b) 10p}
\label{sec:orgheadline3}
\begin{enumerate}
\item Calculate the pulse transfer function \(H_d(z)\) from the disturbance signal \(d\) to the output \(y\) for the closed-loop system using the controller you designed in (a).
\item Use matlab to calculate a response to a step in the disturbance \(d\). This can be done in a few lines:
\begin{verbatim}
num = % Your code here
den = % Your code here
Hd =  tf(num, den, -1); % Discrete-time system, undetermined sampling period
step(Hd)
\end{verbatim}
Include the step-response in your solution.
\item Bonus question (will give +5 points if correct, but no subtracted points if not correct): Why is the disturbance not eliminated by our control system? Hint: \(H_d(z)\) has \(R(z)\) as factor in the numerator. How could a \(R\) - polynomial suppress the step/constant disturbance?
\end{enumerate}

\section*{Problem 2 Discretization}
\label{sec:orgheadline7}
Consider the PD-controller
\begin{equation}
F(s) = 1 + \frac{s}{1 + \frac{s}{20}}.
\label{eq:pd}
\end{equation}

\subsection*{(a) 10p}
\label{sec:orgheadline5}
Determine a discrete-time controller \(F_d(z)\) using forward difference approximation (Euler's approximation).

\subsection*{(b) 20p}
\label{sec:orgheadline6}
\begin{enumerate}
\item What are the poles and zeros of the discrete-time controller?
\item For which values of the sampling time \(h>0\) is the discrete-time controller stable?
\end{enumerate}

\section*{Problem 3 Sampling and time-delay 20p}
\label{sec:orgheadline8}
A discrete-time controller involves sample-and-hold of the input signal to the controller. The sample-and-hold can be modelled as the transfer function (see Å\&W eq 7.27)
\begin{equation}
G_{zoh}(s) = \frac{1}{s} \left( 1 - \mexp{-sh} \right).
\end{equation}
This block gives, approximately, a delay of half the sampling period, i.e.
\begin{equation}
G_{zoh} (s) \approx h \mexp{-\frac{h}{2}s}.
\end{equation}

Choose  \(h=0.AB\), where \(AB\) are the last two digit of your matricula. Use matlab to generate the Bode diagrams of both \(G_{zoh}(s)\) and its approximation.

To help you get started, here is some code.
\begin{verbatim}
s = tf('s');
h = 0.62; % Use your own last two digits here!

G_zoh = 1/s * (1 - exp(-h * s) )
G_approx =   % Your code

figure(1)
clf
bode(G_zoh, G_approx, logspace(-1, log10(10*2*pi/h), 500));
legend('Sample-and-hold', 'Approximation', 'Location', 'Best')
\end{verbatim}

\begin{enumerate}
\item What is the Nyquist frequency?
\item Motivate why the approximation is reasonable for freqencies up to the Nyquist frequency (2-3 sentences).
\item Include the Bode diagram in your answer.
\end{enumerate}

\section*{Solutions}
\label{sec:orgheadline16}
\subsection*{Problem 1}
\label{sec:orgheadline11}
\subsubsection*{(a)}
\label{sec:orgheadline9}

The Diophantine equation
\[ A(z)R(z) + B(z)S(z) = A_c(z)A_o(z) \]
becomes
\[ \underbrace{z(z-0.8)}_{\text{order } 2}R(z) + \underbrace{0.8}_{\text{order } 0} S(z) = \underbrace{z^3-1.2z^2+0.35z }_{\text{order } 3}, \]
It is clear that to obtain the desired characteristic polynomial on the right hand side of the equation, we must choose a first-order controller:
\begin{align*}
R(z) &= z + r_1\\
S(z) &= s_0z + s_1.
\end{align*}
This gives the Diophantine equation
\[ z^3 + (r1 - 0.8)z^2 - 0.8r1z + 0.8s_0z + 0.8s_1 = z^3-1.2z^2+0.35z, \]
which gives the three equations
\begin{align*}
r_1 -0.8 &= -1.2\\
-0.8r_1 + 0.8s_0 &= 0.35\\
0.8s1 &= 0,
\end{align*}
with solution
\begin{align*}
r_1  &= -0.4\\
s_0 &= 0.0375\\
s_1 &= 0.
\end{align*}

The pulse transfer function from \(u_c\) to \(y\) is
\begin{equation*}
 \begin{split}
 H_c(z) &= \frac{\frac{T}{R}\frac{B}{A}}{1 + \frac{B}{A}\frac{S}{R}}\\
        &= \frac{TB}{AR+BS} = \frac{TB}{A_cA_o}.
 \end{split}
\end{equation*}
The polynomial \(T(z)\) is chosen to cancel the observer pole, so we have
\[ T(z) = t_0 A_o(z)\]
and
\[ H_c(z) = \frac{t_0B(z)}{A_c{z}} = \frac{0.8t_0}{z(z-0.7)}. \]
The  latter expression should be equal to
\[ \frac{0.3}{z(z-0.7)}, \]
So,
\[t_0 = 0.3/0.8 = 0.375. \]

In summary, the controller is given by the three polynomials
\begin{align*}
R(z) &= z+r_1 = z-0.4\\
S(z) &= s_0z + s_1 = 0.0375z\\
T(z) &= t_0A_o(z) = 0.375(z - 0.5).
\end{align*}
\subsubsection*{(b)}
\label{sec:orgheadline10}
\begin{enumerate}
\item The pulse transfer function from \(d\) to \(y\) is given by
\begin{equation*}
 \begin{split}
  H_d &= \frac{1}{1 + \frac{B}{A}\frac{S}{R}} = \frac{AR}{AR + BS}\\
    &= \frac{z(z-0.8)(z-0.4)}{z(z-0.7)(z-0.5)}.
 \end{split}
\end{equation*}
\item The importance of the zeros of a pulse transfer function is that signals with frequency corresponding to the zeros will be blocked by the pulse transfer function. In order to eliminate the step disturbance, the corresponding frequency
\[ \omega=0 \;\Rightarrow\; z=\mexp{i0h} = 1\]
should be a zero of the pulse transfer function \(H_d(z)\). In the RST-controller of figure \ref{fig:2dof}, the zeros of \(H_d\) are the roots of \(A(z)R(z)\). So, in order to eliminate the step disturbance, we must have at least one integration (pole in \(z=1\)) either in the plant \(\frac{B}{A}\) or in the controller \(\frac{S}{R}\).
\end{enumerate}

\subsection*{Problem 2}
\label{sec:orgheadline14}

\subsubsection*{(a)}
\label{sec:orgheadline12}
Euler's approximation of the differentiation operator is
\[ p \approx \frac{q-1}{h}. \]
This gives the approximate discrete PD-controller
\begin{equation*}
 \begin{split}
 F_d(z) &= F(s)|_{s = \frac{z-1}{h}} = 1 + \frac{\frac{z-1}{h}}{1 + \frac{z-1}{h}/20}\\
 &= 1 + \frac{20(z-1)}{20h + z - 1}\\
 &= \frac{z + 20h - 1 + 20z - 20}{z - (1-20h)}\\
 &= \frac{21z - (21 - 20h)}{z - (1-20h)}.
 \end{split}
\end{equation*}

\subsubsection*{(b)}
\label{sec:orgheadline13}
\begin{enumerate}
\item The pole is \(z_p=1-20h\) and the zero is \(z_z = \frac{21-20h}{21}\).
\item For the controller to be stable, the pole must be inside the unit circle. The pole is real, so we have
\[ -1 < 1-20h < 1. \]
Since \(h>0\), it is the lower inequality that we need to worry about. This gives
\[ 1-20h > -1 \quad \Rightarrow \quad h < 0.1. \]
\end{enumerate}

\subsection*{Problem 3}
\label{sec:orgheadline15}
\begin{enumerate}
\item The Nyquist frequency is
\[ \omega_N = \frac{\pi}{h}. \]
\item With \(h=0.62\), I obtained the Bode-diagram in figure \ref{fig:bode}. Clearly, the phase plots (lower graph), which tells us about the delay in the filter, are not possible to distinguish for frequencies upto the Nyquist frequency. So the approximation is giving the correct delay. On the other hand, the magnitude differs significantly for frequencies that approach the Nyquist frequency. The approximation is a pure time-delay that does not change the magnitude of the signals, but the sample-and-hold circuit attenuates the signals.
\item See figure \ref{fig:bode}
\end{enumerate}

\begin{figure}
\begin{center}
\includegraphics[width=0.7\linewidth]{bode-crop}
\caption{Bode-diagram of sample-and-hold circuit and of approximation}
\label{fig:bode}
\end{center}
\end{figure}
\end{document}


%% -*- coding:utf-8 -*-
\chapter{Finite fields. Separability, perfect fields}
We recall the construction and basic properties of finite fields. We
prove that the multiplicative group of a finite field is cyclic, and
that the automorphism group of a finite field is cyclic generated by
the Frobenius map. We introduce the notions of separable (resp. purely
inseparable) elements, extensions, degree. We briefly discuss perfect
fields.

\section{An example (of extension)s. Finite fields}

\begin{corollary}
  \mynameref{def:algebraicclosure} of $K$ is unique up to
  \mynameref{def:isomorphism} of K-algebras
  \footnote{
    There is a redefinition of corollary
    \ref{col:algebraic_closure_isomorphism}.
  }
  \label{col:lec3_1}
\end{corollary}

\begin{corollary}
  Any \mynameref{def:algebraicextension} of $K$ embeds  (see
  definition \ref{def:embedding}) into the
  \mynameref{def:algebraicclosure} \footnote{
    i.e. $\forall E$ - algebraic extension of $K$,
    $\exists \phi: E \to \bar{K}$ - \mynameref{def:homomorphism}. The
    statement is  a reformulation
    of theorem \ref{thm:lec2_3}}
  \label{col:lec3_2}
\end{corollary}

\begin{example}[Of extension of homomorphism]
  Let $K = \mathbb{Q}$ and $\overline{\mathbb{Q}}$ is the
  \mynameref{def:algebraicclosure} of $K$. For instance we can consider
  $\overline{\mathbb{Q}} \subset \mathbb{C}$.
  \footnote{
    Really $\overline{\mathbb{Q}} = \mathbb{A}$ - the set of all algebraic
    numbers, i.e. roots of polynomials $P \in
    \mathbb{Q}\left[X\right]$.
  }

  Let
  \[
  L = \mathbb{Q}\left(\sqrt{2}\right) =
  \mathbb{Q}\left[X\right]/\left(X^2 - 2\right),
  \]
  $\alpha$ is a \mynameref{def:class} of $X$ in $L$. $L$ has 2
  \mynameref{def:embedding}s into
  $\overline{\mathbb{Q}}$
  \begin{enumerate}
  \item $\phi_1: \alpha \to \sqrt{2}$
  \item $\phi_2: \alpha \to -\sqrt{2}$
  \end{enumerate}

  Let
  \[
  M = \mathbb{Q}\left(\sqrt[4]{2}\right) =
  \mathbb{Q}\left[Y\right]/\left(Y^4 - 2\right),
  \]
  $\beta$ is a \mynameref{def:class} of $Y$ in $M$. $M$ has 4
  \mynameref{def:embedding}s into
  $\overline{\mathbb{Q}}$
  \begin{enumerate}
  \item $\psi_1: \beta \to \sqrt[4]{2}$ (extends $\phi_1$)
  \item $\psi_2: \beta \to -\sqrt[4]{2}$ (extends $\phi_1$)
  \item $\psi_3: \beta \to i\sqrt[4]{2}$ (extends $\phi_2$)
  \item $\psi_4: \beta \to -i\sqrt[4]{2}$ (extends $\phi_2$)
  \end{enumerate}
  This (``extends'') is because
  \footnote{
    I.e. in our case we have $\mathbb{Q} \subset L \subset M$. We have
    $\phi_{1,2} : L \to \overline{\mathbb{Q}}$ which can be extended
    (accordingly theorem \ref{thm:lec2_3}) to
    $\psi_{1,2,3,4} : M \to \overline{\mathbb{Q}}$
  }
  \[
  M = L\left[Y\right]/\left(Y^2 - \alpha\right)
  \]
  \label{ex:homomorphismext}
\end{example}

\subsection{Finite fields}

\begin{definition}[Finite field]
  $K$ is a finite field if it's \mynameref{def:fieldcharacteristic}
  $char K = p$, where $p$
  - prime number
  \label{def:finitefield}
\end{definition}

\begin{remark}[$\mathbb{F}_{p^n}$]
  If $K$ is a finite extension of $\mathbb{F}_p$
  \footnote{
    i.e. $\left[K:\mathbb{F}_p\right] < \infty$
  }
  and
  $n = \left[K:\mathbb{F}_p\right]$ then number of elements of $K$:
  $\left|K\right| = p^n$. The following notation is also used for a
  finite extension of a finite field: $\mathbb{F}_{p^n}$
  \footnote{
    As we know $\mathbb{F}_p = \mathbb{Z}/p \mathbb{Z}$. From other
    side $\mathbb{F}_{p^n} \ne \mathbb{Z}/p^n \mathbb{Z}$.
    For example $\mathbb{F}_4 \ne \mathbb{Z}/4 \mathbb{Z}$ because
    $\mathbb{Z}/4 \mathbb{Z}$ is not a field ($2 \cdot 2 = 0$
    i.e. zero divisors exist). You have to look at example
    \ref{ex:F2overP} to see exact structure of $\mathbb{F}_4$.
  }
  \label{rem:fpn}
\end{remark}

\begin{remark}[Frobenius homomorphism]
  If $char K = p$, then exists a \mynameref{def:homomorphism}
  $F_p: K \to K$ such that $F_p\left(x\right) = x^p$.
  Really if we consider $\left(x+y\right)^p$ and $\left(xy\right)^p$
  then we can get $\left(x+y\right)^p = x^p + y^p$
  \footnote{
    \[
    \left(x+y\right)^p = \sum_{k=0}^p {p \choose k} x^k y^{p-k}  =
    x^p + y^p + p \cdot \left( \sum_{k=1}^{p-1} a_k x^k y^{p-k} \right),
    \]
    where $a_k \in \mathbb{Z}$. I.e.
    \[
    \left(x+y\right)^p \equiv
    \left(x^p + y^p\right)  \mod p
    \]
  }
  and
  $\left(xy\right)^p = x^p y^p$. The second property is the truth in
  the all fields (of course) but the first one is the special property
  of $\mathbb{F}_p$ fields.
  \label{rem:frobeniushomomorphism}
\end{remark}

\begin{remark}
  Also $F_{p^n} : K \to K$ such that $F_{p^n}\left(x\right) = x^{p^n}$
  is also homomorphism (a power of \mynameref{rem:frobeniushomomorphism}.
  \label{rem:frobeniuspowerhomomorphism})
\end{remark}

\section{Properties of finite fields}

\begin{theorem}
  Lets fix $\mathbb{F}_p$ and it's \mynameref{def:algebraicclosure}
  $\overline{\mathbb{F}_p}$.

  The \mynameref{def:splittingfield} of $x^{p^n} - x$ has $p^n$
  elements. Conversely any field of $p^n$ elements is a splitting
  field of $x^{p^n} - x$. Moreover there is an unique sub extension of
  $\overline{\mathbb{F}_p}$ with $p^n$ elements.
  \begin{proof}
    Note that $F_{p^n} : x \to x^{p^n}$ is a
    \mynameref{def:homomorphism} (see remark
    \ref{rem:frobeniuspowerhomomorphism}) as result the following set
    $\{
    x \mid F_{p^n}\left(x\right) = x
    \}$ is a field containing $\mathbb{F}_p$
    \footnote{
      For $x \in \mathbb{F}_p^{\times} = \mathbb{F}_p \setminus \{0\}$ we
      have that (see theorem \ref{thm:abelianelement})
      \[
      x^{\left|\mathbb{F}_p^{\times}\right|} = x^{p-1} = 1
      \]
      and therefore $\forall x \in \mathbb{F}_p: x^p = x$ ($x = 0$
      also satisfied the equation). We can continue as follows
      \begin{eqnarray}
        x^{p^2} = \left(x^p\right)^p = x^p = x,
        \nonumber \\
        x^{p^3} = \left(x^{p^2}\right)^p = x^p = x
        \nonumber \\
        \dots
        \nonumber \\
        x^{p^n} = \left(x^{p^{n-1}}\right)^p = x^p = x
        \nonumber
      \end{eqnarray}
      and finally get
      $F_{p^n}\left(x\right) = x$.
      Thus $\forall x \in \mathbb{F}_p$ we also have
      $x \in \{
      x \mid F_{p^n}\left(x\right) = x
      \}$
    }
    i.e.
    \[
    \mathbb{F}_p \subset
    \left\{
    x \mid F_{p^n}\left(x\right) = x
    \right\}
    \]
    or, in other words, the considered set is a \mynameref{def:fextension1} of
    $\mathbb{F}_p$.

    If $Q_n\left(X\right) = X^{p^n} - X$ then the considered set
    consists of the root of the polynomial $Q_n$. The polynomial has
    no multiple roots because $gcd(Q_n, Q_n') = 1$.
    \footnote{
      If $Q_n$ has a multiple root $\beta$ then it is divisible by
      $\left(X - \beta\right)^2$ and the $Q_n'$ is divisible by (at
      least) $\left(X - \beta\right)$ thus the $\left(X -
      \beta\right)$ should be a part of gcd.
    }
    This is because $Q_n' \equiv 1 \mod p$.
    \footnote{
      Really we have the following one $Q_n' = p^n X^{p^n - 1} - 1
      \equiv -1 \mod p$ but the sign is not really matter because
      $\gcd\left(Q_n, -1\right) = \gcd\left(Q_n, 1\right) = 1$.
    }
    As soon as $Q_n$ has no multiple roots then there are $p^n$
    different roots and therefore the splitting field is the field
    with $p^n$ elements.

    Conversely lets $\left|K\right| = p^n$ and
    $\alpha \ne 0 \in K$.
    Using the fact that the multiplication group of $K$ has $p^n - 1$
    elements: $\left|K^\times\right| = p^n - 1$
    \footnote{
      $K^\times = K \setminus \{0\}$
    }
    as result the multiplication of all the elements should give us
    $1$: $\alpha^{p^n-1} = 1$ or $\alpha^{p^n} - \alpha = 0$
    (see theorem \ref{thm:abelianelement}).
    Therefore $\alpha$ is a root of $Q_n$. Thus the splitting field of
    $Q_n$ consists of elements of $K$.

    The uniqueness
    \footnote{
      up to \mynameref{def:isomorphism}
    }
    of sub-extension of
    $\mathbb{F}_p$ with $p^n$ elements is a result of uniqueness of
    the splitting field (see theorem \ref{thm:lec2_1}).
  \end{proof}
  \label{thm:lec3_1}
\end{theorem}

\begin{theorem}
  $\mathbb{F}_{p^d} \subset \mathbb{F}_{p^n}$ if and only if $d \mid n$.
  \begin{proof}
    Let $\mathbb{F}_{p^d} \subset \mathbb{F}_{p^n}$ in this case
    $\mathbb{F}_p \subset \mathbb{F}_{p^d} \subset \mathbb{F}_{p^n}$
    and
    \[
    \left[\mathbb{F}_{p^n}:\mathbb{F}_{p}\right] =
    \left[\mathbb{F}_{p^n}:\mathbb{F}_{p^d}\right]
    \left[\mathbb{F}_{p^d}:\mathbb{F}_{p}\right]
    \]
    or $n = x \cdot d$ i.e. $d \mid n$

    Conversely if $d \mid n$ then $n = x \cdot d$ or
    $p^n = \prod^x_{i=1} p^d$ thus if $x^{p^d} = x$ then
    \[
    x^{p^n} = x^{\prod^x_{i=1} p^d}
    \left(x^{p^d}\right)^{\prod^x_{i=2} p^d} = x^{\prod^x_{i=2} p^d} =
    \dots = x^{p^d} = x,
    \]
    i.e. $\forall \alpha \in \mathbb{F}_{p^d}$ we also have
    $\alpha \in \mathbb{F}_{p^n}$ or in other notation:
    $\mathbb{F}_{p^d} \subset \mathbb{F}_{p^n}$.
  \end{proof}
  \label{thm:lec3_1_2}
\end{theorem}

\begin{theorem}
  $\mathbb{F}_{p^n}$ is a \mynameref{def:stemfield} and a
  \mynameref{def:splittingfield} of any \mynameref{def:irreducible}
  $P \in \mathbb{F}_p$ of degree $n$.
  \begin{proof}
    \mynameref{def:stemfield} $K$ has to have degree $n$ over
    $\mathbb{F}_p$ i.e.
    $\left[K:\mathbb{F}_p\right] = n$ (see remark \ref{rem:lec2_1})
    i.e. it should have $p^n$
    elements (see remark \ref{rem:fpn})
    and therefore $K=\mathbb{F}_{p^n}$
    (see theorem \ref{thm:lec3_1}).

    About \mynameref{def:splittingfield}. Using the just proved result
    we can say that if $\alpha$ is a root of $P$
    then $\alpha \in \mathbb{F}_{p^n}$ thus
    $Q_n\left(\alpha\right) = 0$. Therefore $P$ divides $Q_n$
    \footnote{as soon as any root of $P$ also a root of $Q_n$} and as
    result $P$ splits in $\mathbb{F}_{p^n}$.
  \end{proof}
  \label{thm:lec3_1_3}
\end{theorem}

\begin{corollary}
  Let $\mathcal{P}_d$ is the set of all irreducible,
  \mynameref{def:monicpolynomial}s of degree $d$ such that
  $\mathcal{P}_d \subset \mathbb{F}_p\left[X\right]$ then
  \[
  Q_n = \prod_{d \mid n} \prod_{P \in \mathcal{P}_d} P
  \]
  \begin{proof}
    As we just seen if $P \in \mathcal{P}_d$ and $d \mid n$ then
    $P \mid Q_n$.
    \footnote{
      Since stem field is $\mathbb{F}_{p^d} \subset \mathbb{F}_{p^n}$
      (see theorem \ref{thm:lec3_1_2} and proof at the theorem
      \ref{thm:lec3_1_3})
    }
    Since all such polynomials are relatively prime of course
    \footnote{
      As soon as $\mathbb{F}_p\left[X\right]$ is \mynameref{def:ufd}
      then any polynomial can be written as a product of irreducible
      elements, uniquely up to order and units this means that each
      $P \in \mathcal{P}_d$ (where $d \mid n$) should be in the
      factorization of $Q_n$. It should be only one time because there
      is no multiply roots.
    }
    \footnote{
      We also can say that 2 irreducible polynomial
      $P_1, P_2 \in \mathbb{F}_p\left[X\right]$ should not have same
      roots. For example if $\alpha$ is the same root - it cannot be
      in $\mathbb{F}_p$ because in the case the polynomials will be
      reducible. Thus it can be only in an extension of $\mathbb{F}_p$
      from other side $gcd(P_1,P_2) = 1$ and therefore with
      \mynameref{lem:bezout} one can get that $\exists Q,R \in
      \mathbb{F}_p\left[X\right]$ such that
      \(
      P_1 Q + P_2 R = 1
      \) and setting $\alpha$ into the equation leads to fail
      statement that $0 = 1$.
      }
    and $Q_n$ have no multiple roots (as result no multiple factors)
    then
    \[
    \left(\prod_{d \mid n} \prod_{P \in \mathcal{P}_d} P \right)\mid Q_n
    \]

    From other side let $R$ is an irreducible factor of $Q_n$.
    $\alpha$ is a root of $R$ then $Q_n\left(\alpha\right) = 0$ thus
    $\mathbb{F}_p\left(\alpha\right) \subset \mathbb{F}_{p^n}$.
    From remark \ref{rem:lec2_1} we have
    \[
    \left[\mathbb{F}_p\left(\alpha\right) : \mathbb{F}_p\right] = \deg
    R = d.
    \]
    From remark \ref{rem:fpn}
    $\mathbb{F}_p\left(\alpha\right) = \mathbb{F}_{p^d}$.
    Theorem \ref{thm:lec3_1_2} says that $d \mid n$.
    As result $R \in \mathcal{P}_d$. Thus the
    polynomial should be in the product
    $\prod_{d \mid n} \prod_{P \in \mathcal{P}_d} P$.
  \end{proof}
\end{corollary}

\begin{example}
  Let $p = n = 2$. The monic irreducible polynomials in $\mathbb{F}_2$
  whose degree divides $2$ are: $X$, $X+1$ and $X^2 +X + 1$.
  As you can see
  \begin{equation}
    X\left(X+1\right)\left(X^2+X+1\right) = X^4 + X = X^4 - X
    \nonumber
  \end{equation}
  because $2x = 0 \mod 2$ or $x = -x$.
  \label{ex:lec3_ex1}
\end{example}

Just another example \cite{bib:KeithConradFiniteFields}:
\begin{myexample}[Polynomial factorization over a finite field]
  \label{ex:lec3_polfactorization}
  In $\mathbb{F}_2\left[X\right]$, the irreducible factorization of
  $X^{2^n} -X$ for $n=1,2,3,4$ is as follows
  \begin{eqnarray}
    X^2 -X = X \left(X-1\right),
    \nonumber \\
    X^4 -X = X \left(X-1\right)\left(X^2 + X + 1\right),
    \nonumber \\
    X^8 -X = X \left(X-1\right)\left(X^3 + X + 1\right)
    \left(X^3 + X^2 + 1\right),
    \nonumber \\
    X^{16} -X = X \left(X-1\right)\left(X^2 + X + 1\right)
    \nonumber \\
    \left(X^4 + X + 1\right)\left(X^4 + X^3 + 1\right)
    \left(X^4 + X^3 + X^2 + X + 1\right).
    \nonumber
  \end{eqnarray}

  You can compare the example with example \ref{ex:lec3_ex1} but you
  have to take into consideration the following fact
  $1 = -1 \mod 2$
\end{myexample}

\begin{gapexample}[Polynomial factorization over a finite field in GAP]
  At the moment GAP provides only methods to factorize polynomials
  over finite fields, over subfields of cyclotomic
  fields, and over algebraic extensions of these \cite{bib:gap}.

  There is an example of such factorization in
  $\mathbb{F}_2\left[X\right]$ similar to \autoref{ex:lec3_polfactorization}
  \begin{verbatim}
    gap> x:=Indeterminate(GF(2),"x");;
    gap> Factors(x^8-x);
    [ x, x+Z(2)^0, x^3+x+Z(2)^0, x^3+x^2+Z(2)^0 ]
    gap> x:=Indeterminate(GF(2),"x");;
    gap> Factors(x^2-x);
    [ x, x+Z(2)^0 ]
    gap> Factors(x^4-x);
    [ x, x+Z(2)^0, x^2+x+Z(2)^0 ]
    gap> Factors(x^8-x);
    [ x, x+Z(2)^0, x^3+x+Z(2)^0, x^3+x^2+Z(2)^0 ]
    gap> Factors(x^16-x);
    [ x, x+Z(2)^0, x^2+x+Z(2)^0, x^4+x+Z(2)^0, x^4+x^3+Z(2)^0,
      x^4+x^3+x^2+x+Z(2)^0 ]
    gap>
  \end{verbatim}
\end{gapexample}

\section{Multiplicative group and automorphism group of a finite
  field}
\begin{theorem}
  Let $K$ be a field and and $G$ be a finite \mynameref{def:subgroup} of
  $K^\times$ (see definition \ref{def:multiplicativegroup}) then $G$
  is a \mynameref{def:cyclicgroup}
  \footnote{
    Not every finite group is cyclic. For instance the non-abelian
    group $S_3$ (see example \ref{ex:s3group}) consists of 6 elements
    but it is not cyclic.

    If we want to have a cyclic group it should be
    \mynameref{def:abeliangroup} in the case it can be represented in
    the form of a cyclic group or a direct sum of cyclic groups
    accordingly \mynameref{thm:fgagroup}. Another important requirement
    is that the orders of the cyclic group have to be coprime.

    For example there are 2 groups of order 4:
    the cyclic one - $\mathbb{Z}/4\mathbb{Z}$ and $V_4$ -
    \mynameref{def:v4}
    $V_4 = \mathbb{Z}/2\mathbb{Z} \oplus \mathbb{Z}/2\mathbb{Z}$ is
    non-cyclic because the orders are not coprime: $gcd(2,2) = 2 \ne
    1.$

    (From the staff) But a product of two
    cyclic groups is
    again cyclic, if their orders are coprime. For example, consider
    the element $\left(1,1\right) \in \mathbb{Z}/2\mathbb{Z} \times
    \mathbb{Z}/3\mathbb{Z}$. It's order is 6, so it generates the
    whole group. Thus as it's mentioned
    $\mathbb{Z}/N\mathbb{Z}$ is a cyclic group.
  }
  \begin{proof}
    Idea is to compare $G$ and the \mynameref{def:cyclicgroup}
    $\mathbb{Z}/N\mathbb{Z}$ where $N = \left|G\right|$.
    \footnote{
      We also will use the fact that any cyclic group of order $N$ is
      isomorphic to $\mathbb{Z}/N\mathbb{Z}$
    }

    Let $\psi\left(d\right)$ - is the number of elements of order $d$
    ( see also \mynameref{def:grouporder}) in $G$. We need
    $\psi\left(N\right) \ne 0$
    \footnote{
      In this case we will have at least one element $x$ of order $N$
      i.e. $N$ different elements of $G$ is generated by the $x$
      i.e. the $G$ is cyclic.
    }
    and we know that
    $N = \sum \psi\left(d\right)$.

    Let also $\phi\left(d\right)$ - is the number of elements of order $d$
    ( see also \mynameref{def:grouporder}) in $\mathbb{Z}/N\mathbb{Z}$.
    \footnote{
      The function $\phi\left(d\right)$ is also called as
      \mynameref{def:eulerfuction}
      and it
      counts the positive integers up to a given integer $d$ that are
      relatively prime to $d$
    }
    As $\mathbb{Z}/N\mathbb{Z}$ contains a single (cyclic) subgroup of
    order $d$ for each $d \mid N$.
    \footnote{
      The one generated by $N/d$. Let $N = r \cdot d$ in the case
      $x^N = 1$ there $x$ is a $\mathbb{Z}/N\mathbb{Z}$ group
      generator. From other side
      \[
      x^N = x^{r \cdot d} = \prod_{i=1}^r x^d
      \]
      thus $x^d = 1$ i.e. there is a cyclic subgroup of order $d$.
    }
    $\phi\left(d\right)$ is the number of generators of
    $\mathbb{Z}/d\mathbb{Z}$ i.e. the number of elements between $1$
    and $d-1$ that are prime to $d$. We know that
    $\phi\left(N\right) \ne 0$.

    We claim that either $\psi\left(d\right) = 0$ or
    $\psi\left(d\right) = \phi\left(d\right)$
    \footnote{
      suffices since $\sum \psi\left(d\right) = \sum
      \phi\left(d\right) = N$
    }
    If no element of order $d$ in $G$ then $\psi\left(d\right) = 0$
    otherwise if $x \in G$ has order $d$ then $x^d = 1$ or $x$ is a
    root of the following polynomial $x^d - 1$. The roots of the
    polynomial forms a cyclic subgroup of $G$ (by
    \mynameref{def:cyclicgroup} definition).
    So $G$ as well as
    $\mathbb{Z}/N\mathbb{Z}$ has a single cyclic subgroup of order
    $d$ (which is cyclic) or no such group at all.
    \footnote{
      Several comments about the subgroup. There is a group
      because multiplication of any elements is in the set. It's
      cyclic because it's generated by one element.
      All $x^i$ where $i \le d$ are different (in other case the group
      should have an order less than $d$). Each element of the group
      $x^i$ is a root of $x^d - 1$ because $(x^i)^d = (x^d)^i = 1^i =
      1$. And the group is unique as well as we have $d$ different
      roots of $x^d-1$ in the group.
    }

    If $\psi\left(d\right) \ne 0$ then exists such a subgroup and
    $\psi\left(d\right)$ is equal to the number of generators of that
    group or $\phi\left(d\right)$
    \footnote{
      Because the group is cyclic and any cyclic group is isomorphic
      to $\mathbb{Z}/d\mathbb{Z}$ and as result has the same number of
      generators.
    }
    In particular $\psi\left(d\right) \le \phi\left(d\right)$
    \footnote{
      because $\psi\left(d\right) = 0$ or
      $\psi\left(d\right) = \phi\left(d\right)$
    }
    but there should be equality because the sum of both $\sum
    \psi\left(d\right) = \sum \phi\left(d\right) = N$.
    In particular $\psi\left(N\right) \ne 0$ and we proved the
    theorem.
  \end{proof}
  \label{thm:lec3_2}
\end{theorem}
\begin{corollary}
  If $\mathbb{F}_p \subset K$ and
  $\left[K:\mathbb{F}_p\right] = n$ then $\exists \alpha$ such that
  $K = \mathbb{F}_p\left(\alpha\right)$. In particular $\exists$ an
  \mynameref{def:irreducible} of degree $n$ over $\mathbb{F}_p$
  \footnote{
    The theorem \ref{thm:lec3_1_3} and remark \ref{rem:fpn} says that
    the stem field for any
    polynomial of degree $n$ over $\mathbb{F}_p$ exists and there is
    $\mathbb{F}_{p^n}$ and
    $\left[\mathbb{F}_{p^n}:\mathbb{F}_{p}\right] = n$ i.e.
    $K = \mathbb{F}_{p^n}$.
    But we had not proved yet that an
    irreducible polynomial of degree $n$ exists.
  }
  \begin{proof}
    We can take $\alpha = \mbox{ generator of } K^\times$
    \footnote{
      This is because from theorem \ref{thm:lec3_2}
      $K^\times = \left<\alpha\right>$ i.e. any element of $K$ except $0$
      can be got as a power of $\alpha$. Moreover $\alpha \notin
      \mathbb{F}_p$ (in other case we will got $K = \mathbb{F}_p$)
      i.e. we really got
      $K = \mathbb{F}_p\left(\alpha\right)$.
      $\alpha$ is an \mynameref{def:algebraicelement} because we can
      consider
      $1, \alpha, \dots, \alpha^{n-1}$
      as a basis and $\alpha^n$ can be represented via
      the basis. I.e. $\exists P \in \mathbb{F}_p\left[X\right]$ such
      that $P\left(\alpha\right) = 0$.
      By lemma \ref{lem:minpolynomial}
      there exists an irreducible polynomial
      $P_{min}\left(\alpha, \mathbb{F}_p\right)$.
      }
  \end{proof}
  \label{cor:lec3_1}
\end{corollary}

\begin{corollary}
  The group of automorphism of $\mathbb{F}_{p^n}$ over
  $\mathbb{F}_{p}$ is cyclic and generated by Frobenius map:
  $F_p: x \to x^p$
  (see remark \ref{rem:frobeniushomomorphism} where we showed that the
  Frobenius map is a field automorphism)
  \label{cor:lec3_2}
  \begin{proof}
    As we know from theorem \ref{thm:lec3_1}:
    $\forall x \in \mathbb{F}_{p^n}: x^{p^n} = x$ so
    \footnote{
      because
      \[
      \left(F_p\right)^n\left(x\right) =
      \left(F_p\right)^{n-1}\left(F_p\left(x\right)\right) =
      \left(F_p\right)^{n-1}\left(x^p\right) = \dots = x^{p^n} = x
      \]
    }
    $F_p^n = id$. As result the order of $\left<F_p\right>$ is no
    greater than $n$. Lets prove that the $ord F_p = n$.
    Really if $m < n$ then
    $x^{p^m} - x =0$ has $p^m < p^n$ roots and
    \footnote{
      because operates only with $p^m$ elements i.e. not of all
      elements of $\mathbb{F}_{p^n}$.
    }
    $F_p^m$ cannot be identity.
    Finally (from corollary \ref{cor:lec3_1} ) we have
    $\mathbb{F}_{p^n} = \mathbb{F}_p\left(\alpha\right)$ where
    $\alpha$ is a root of an irreducible polynomial of degree
    $n$. I.e. there cannot be more than $n$ automorphism
    \footnote{
      Each automorphism converts the root $\alpha$ into another one
      of $n$ roots of the irreducible polynomial
    }
    so
    \[
    \left|
    Aut\left(
    \mathbb{F}_{p^n}/\mathbb{F}_{p}
    \right)
    \right| \le n
    \]
    and as we have $n$ of them (\mynameref{def:automorphism}s)
    \footnote{
      We have $n$ different elements of cyclic group
      $\left<F_p\right>$. The generator of the group is an
      automorphism and as result each of $n$ elements is also an
      automorphism.
    }
    then
    \[
    \left|
    Aut\left(
    \mathbb{F}_{p^n}/\mathbb{F}_{p}
    \right)
    \right| = n
    \]
    and the group is cyclic generated by $F_p$.
  \end{proof}
\end{corollary}

\section{Separable elements}
\label{sec:lec3_separable_elements}
Let $E$ is a \mynameref{def:splittingfield} of an irreducible polynomial
$P$. We would like to say that it ``has many
\mynameref{def:automorphism}s''. What does this mean? This means the
following thing:
Let $\alpha$ and $\beta$ be 2 roots of $P$ then we have 2 extensions
$K\left(\alpha\right) \subset E$ and
$K\left(\beta\right) \subset E$.

There exists an \mynameref{def:isomorphism} (see proposition
\ref{prop:stemfield}) over $K$
\[
\phi: K\left(\alpha\right) \to K\left(\beta\right)
\]
that is also extended to an \mynameref{def:automorphism} on $E$
(see theorem \ref{thm:isomorphismextension}).

There is one problem with it: is that truth that an irreducible
polynomial of degree $n$ has ``many'' i.e. exactly $n$ ( it cannot
have more than $n$) roots.

The answer is yes if $char K = 0$, but not always if $char K = p$
(where $p$ is a prime number). $P$ can have multiple roots in the case
i.e. $gcd(P, P') \ne 1$.

Why it's not a case for $char K = 0$ - it is because
$\deg P' < \deg P$ and $P \nmid P'$ for $P' \ne 0$ (non constant
polynomial)
\footnote{
  Let $P$ has multiply roots. As soon as it's irreducible a multiply
  root is in an extension of $K$. In this case the root should be also
  a root for $P'$ thus by lemma \ref{lem:minpolynomial} (or
  theorem \ref{thm:irreduciblediv}) one can get
  that $P \mid P'$ in $K\left[X\right]$ but that is impossible because
  $\deg P' < \deg P$ and can be only possible if $P' = 0$.
}

But for $char K = p$ there can be a case when $P' = 0$ for a non
constant polynomial thus $P \mid P'$ and as result $gcd(P, P') = P$.
The $P' = 0$ i.e. it vanishes $P$ is a polynomial in $X^p$. I.e. if
$P = \sum a_i x^i$ and $p \mid i$ or $a_i = 0$. In that case ($P' =
0$) let $r = \max h$ such that $P$ is a polynomial in $X^{p^h}$ that
is $a_i = 0$ whenever $p^h \nmid i$. See the following example
\begin{myexample}
  Let $p = 2$. The polynomial $P\left(X\right) = X^{16} + 1$ has the
  required property ($P' = 0$). The polynomial can be present in the
  following form
  \[
  P\left(X\right) = X^{2^4} + 1 = Q(Y)
  \]
  where $Y = X^{16}$ and $Q(Y) = Y + 1$. In the case
  $r=4, p^r = 16 \mid 16$

  For polynomial $P\left(X\right) = X^{12} + 1$ we have
  \[
  P\left(X\right) = \left(X^{2^2}\right)^3 + 1 = Q(Y)
  \]
  where $Y = X^4$ and $Q(Y) = Y^3 + 1$. In the case
  $r=2, p^2 = 4 \mid 12$ because $h = 3 > 2$ does not fit into
  the requirements: $p^h = 2^3 = 8 \nmid 12$.
\end{myexample}

\begin{proposition}
  Let $P\left(X\right) = Q\left(X^{p^r}\right)$ and $Q' \ne 0$ i.e.
  $gcd(Q, Q') = 1$ then $Q$ does not have multiple roots but
  all roots of $P$ have multiplicity $p^r$.
  \begin{proof}
    If $\lambda$ is a root of $P$ then $\lambda$:
    $P(X) = (X - \lambda)R$
    Thus $\mu = \lambda^{p^r}$ is the root of $Q$
    \footnote{
      $Q\left(\mu\right) = Q\left(\lambda^{p^r}\right) =
      P\left(\lambda\right) = 0$
    }
    as result
    $Q(Y) = (Y - \lambda^{p^r}) S(Y)$ therefore
    \[
    P(X) =
    \left(X^{p^r} - \lambda^{p^r}\right)S\left(X^{p^r}\right) =
    \left(X - \lambda\right)^{p^r}S\left(X^{p^r}\right)
    \]
    and $\lambda$ is not a root of $S\left(X^{p^r}\right)$.
    \footnote{
      This is because $Q$ does not have multiply roots and as result
      $\mu = \lambda^{p^r}$ is not a root of $S$ or in other words
      $S\left(X^{p^r}\right)_{X=\lambda} \ne 0$
      }
    Thus we just got that multiplicity of $\lambda$ is $p^r$.
  \end{proof}
  \label{prop:lect3_1}
\end{proposition}

\begin{definition}[Separable polynomial]
  $P\in K\left[X\right]$ irreducible polynomial is called separable if
  $\gcd\left(P, P'\right) = 1$
  \label{def:separablepolynomial}
\end{definition}

\begin{definition}[Degree of separability]
  $d_{sep}(P) = \deg Q$ (as above)
  \footnote{
    It requires some explanation compare to that one was got on the
    lecture video.
    If $P$ is a \mynameref{def:separablepolynomial} then
    $d_{sep}(P) = \deg P$. In other case $P$ should be represented as
    $P\left(X\right) = q_1(X^p)$. If $q_1\left(Y\right)$ is separable
    than $Q = q_1$ otherwise we continue and represent
    $q_1\left(X\right) = q_2\left(X^p\right)$. We should stop on some
    $q_r$ for which we will have $Q = q_r$ and $P\left(X\right) =
    Q\left(X^{p^r}\right)$. In the case $d_{sep}(P) = \deg Q$.
  }
  \label{def:degsep}
\end{definition}

\begin{definition}[Degree of inseparability]
  $d_{i}(P) = \frac{\deg P}{\deg Q}$ ( $=p^r$ in proposition
  \ref{prop:lect3_1})
  \label{def:deginsep}
\end{definition}

\begin{definition}[Pure inseparable polynomial]
  $P$ is pure inseparable if $d_i = \deg P$.
  Then $P = X^{p^r} - a$
  \footnote{
    In the case $\deg Q = 1$ i.e. $Q\left(Y\right) = Y- a$ or
    $P = X^{p^r} - a$.
  }
  \label{def:deginseppol}
\end{definition}

\begin{definition}[Separable element]
  Let $L$ be an \mynameref{def:algebraicextension} of $K$ then $\alpha \in L$ is
  called separable(inseparable) if it's
  \mynameref{def:minpolynomial} $P_{min}\left(\alpha, K\right)$ has
  the property.
  Note: the separable element is also \mynameref{def:algebraicelement}
  because it has minimal polynomial.
  \label{def:degsepelem}
\end{definition}

\begin{proposition}[On number of homomorphisms]
  If $\alpha$ is separable on $K$ then the number of
  \mynameref{def:homomorphism}s over $K$ from $K$ to $\bar{K}$
  \[
  \left|Hom_K\left(K\left(\alpha\right), \bar{K}\right)\right| =
  \deg P_{min}\left(\alpha, K\right)
  \]
  in general
  \[
  \left|Hom_K\left(K\left(\alpha\right), \bar{K}\right)\right| =
  d_{sep} P_{min}\left(\alpha, K\right)
  \]
  \begin{proof}
    It's obvious because $d_{sep}$ is the number of distinct roots.
  \end{proof}
  \label{prop:lec3_2}
\end{proposition}

\section{Separable degree, separable extensions}

We want to generalize the proposition \ref{prop:lec3_2} for any field
extension (not necessary $K\left(\alpha\right)$).
Let $L$ be a finite extension of $K$

\begin{definition}[Separable degree]
  $\left[L:K\right]_{sep} = \left|Hom_K\left(L, \bar{K}\right)\right|$
  \label{def:separabledegree}
\end{definition}

As we know if $L = K\left(\alpha\right)$ then
\mynameref{def:separabledegree} is a number of distinct roots of
minimal polynomial $P_{min}\left(\alpha, K\right)$

\begin{definition}[Separable extension]
  $L$ is separable over $K$ if
  $\left[L:K\right]_{sep} = \left[L:K\right]$
  \label{def:separableextension}
\end{definition}

\begin{definition}[Inseparable degree]
  \[
  \left[L:K\right]_i =
  \frac{\left[L:K\right]}{\left[L:K\right]_{sep}}
  \]
  \label{def:inseparabledegree}
\end{definition}

\begin{theorem}[About separable extensions]
  \begin{enumerate}
  \item If $K \subset L \subset M$ then
    $\left[M:K\right]_{sep} = \left[M:L\right]_{sep}
    \left[L:K\right]_{sep}$
    and $M$ is \mynameref{def:separableextension} over $K$ if and only
    if $M$ is separable over $L$ and $L$ is separable over $K$
  \item The following things are equivalent
    \begin{enumerate}
    \item $L$ is separable over $K$ \label{thm:lec3_3:itm:1}
    \item $\forall \alpha \in L$ $\alpha$ \mynameref{def:degsepelem}
      over $K$ \label{thm:lec3_3:itm:2}
    \item $L$ is generated over $K$ by a finite number of
      \mynameref{def:degsepelem}s i.e.
      $L = K\left(\alpha_1, \alpha_2, \dots, \alpha_n\right)$, there
      $\alpha_i$ is separable over $K$
      \label{thm:lec3_3:itm:3}
    \item   $L = K\left(\alpha_1, \alpha_2, \dots, \alpha_n\right)$, there
      $\alpha_i$ is separable over
      $K\left(\alpha_1, \alpha_2, \dots, \alpha_{i-1}\right)$
      \label{thm:lec3_3:itm:4}
    \end{enumerate}
  \end{enumerate}
  \begin{remark}
    That holds if we replace separability with pure inseparability.
  \end{remark}
  \label{thm:lec3_3}
  \begin{proof}
    About 1st part:
    If we have a \mynameref{def:homomorphism} $\phi: L \to \bar{K}$ then
    it is extended to $\tilde{\phi}: M \to \bar{K}$ (by extension
    theorem \ref{thm:lec2_3}) it can be done with one way per each
    homomorphism from $L$ to $M$ i.e. it can be done by
    $\left|Hom_L\left(M, \bar{K}\right)\right|$ ways but we have
    \[
    \left|Hom_L\left(M, \bar{K}\right)\right| =
    \left|Hom_L\left(M, \bar{L}\right)\right| = \left[M:L\right]_{sep}
    \]
    because $\bar{K}$ is also
    $\bar{L}$ (\mynameref{def:algebraicclosure} over $L$) thus for the
    total number of homomorphisms one can get the following
    equations
    \begin{eqnarray}
      \left[M:K\right]_{sep} =
      \left|Hom_K\left(M, \bar{K}\right)\right| =
      \left|Hom_K\left(L, \bar{K}\right)\right|
      \left|Hom_L\left(M, \bar{K}\right)\right| =
      \nonumber \\
      \left|Hom_K\left(L, \bar{K}\right)\right|
      \left|Hom_L\left(M, \bar{L}\right)\right| =
      \left[M:L\right]_{sep} \left[L:K\right]_{sep}
      \nonumber
    \end{eqnarray}

    We have the following inequality
    \footnote{
      The inequality can be proved by induction using the fact that
      it's true for $K\left(\alpha\right)$ because from general case
      of proposition \ref{prop:lec3_2}
      \[
      \left|Hom_K\left(K\left(\alpha\right), \bar{K}\right)\right| =
      d_{sep} P_{min}\left(\alpha, K\right) \le
      \deg P_{min}\left(\alpha, K\right) =
      \left[K\left(\alpha\right): K \right]
      \]
      Then let it was proved for $E = K\left(\alpha_1, \dots,
      \alpha_{n-1}\right)$ and we want to prove it for
      $K\left(\alpha_1, \dots,
      \alpha_{n-1}, \alpha_n\right) = E\left(\alpha_n\right)$.
      It's easy because $\bar{E} = \bar{K}$  and we can use the same
      approach as for the first induction step.
    }
    \begin{equation}
      \left[E:K\right]_{sep} \le \left[E:K\right].
      \label{eq:sepineq}
    \end{equation}

    With the inequality (\ref{eq:sepineq}) we also have
    \begin{eqnarray}
    \left[M:K\right]_{sep} =
    \left[M:L\right]_{sep} \left[L:K\right]_{sep} \le
    \left[M:L\right] \left[L:K\right] = \left[M:K\right]
    \nonumber
    \end{eqnarray}
    The equality is possible if
    $\left[M:L\right]_{sep} = \left[M:L\right]$ and
    $\left[L:K\right]_{sep} = \left[L:K\right]$ i.e. if
    $M$ is separable over $L$ and $L$ is
    separable over $K$.
    This finishes the proof of the first part.

    About 2d part:

    \ref{thm:lec3_3:itm:1} $\Rightarrow$ \ref{thm:lec3_3:itm:2}:
    Part 1 implies that a separable sub extension
    $K\left(\alpha\right)$ or a separable extension $L$ is separable.
    \footnote{
      I.e. in the case we have $K \subset K\left(\alpha\right) \subset
      L$ and if $L$ is separable then $K\left(\alpha\right)$ is
      separable and as result $\alpha$ is a
      \mynameref{def:degsepelem} because $P_{min}\left(\alpha, K\right)$
      is separable.
    }

    \ref{thm:lec3_3:itm:2} $\Rightarrow$ \ref{thm:lec3_3:itm:3}:
    obvious
    \footnote{
      We consider finite extensions (see remark \ref{rem:fpn})
      i.e. which consists of finite number of elements
    }

    \ref{thm:lec3_3:itm:3} $\Rightarrow$ \ref{thm:lec3_3:itm:4}:
    We know that
    $P_{min}\left(\alpha_i, K\left(\alpha_1, \dots,
    \alpha_{i-1}\right)\right)$ divides
    $P_{min}\left(\alpha_i, K\right)$.
    \footnote{
      Let $K\left(\alpha_1, \dots, \alpha_{i-1}\right) = L$
      then $K \subset L$ and
      $P_{min}\left(\alpha_i, K\right) \in L\left[ X \right]$
      From other side $P_{min}\left(\alpha_i, L\right)$ is the minimal
      irreducible polynomial  in $L\left[X\right]$ and any other
      polynomial with $\alpha_i$ as root has to by divisible by it
      (see also lemma \ref{lem:minpolynomial}).
    }
    Thus if
    $P_{min}\left(\alpha_i, K\right)$ is separable (i.e. have distinct
    roots) then it's divisor $P_{min}\left(\alpha_i, K\left(\alpha_1, \dots,
    \alpha_{i-1}\right)\right)$ also should have distinct roots i.e.
    $\alpha_i$ is a \mynameref{def:degsepelem} over
    $K\left(\alpha_1, \dots,\alpha_{i-1}\right)$

    \ref{thm:lec3_3:itm:4} $\Rightarrow$ \ref{thm:lec3_3:itm:1}:
    Induction as above
    \footnote{
      The first induction step is trivial: $L=K\left(\alpha\right)$
      where $\alpha$ is separable over $K$ in this case
      $K\left(\alpha\right)$ is also separable.
      Now we have that $\forall k < n$:
      if $L = K\left(\alpha_1, \alpha_2, \dots, \alpha_k\right)$, there
      $\alpha_i$ is separable over
      $K\left(\alpha_1, \alpha_2, \dots, \alpha_{i-1}\right)$ then $L$
      is separable over $K$. Thus we have
      $K\left(\alpha_1, \alpha_2, \dots, \alpha_{n-1}\right)$
      separable and $\alpha_n$ is separable over $K\left(\alpha_1,
      \alpha_2, \dots, \alpha_{n-1}\right)$ thus using the first part
      of the theorem we can conclude that
      $K\left(\alpha_1, \alpha_2, \dots, \alpha_{n}\right)$ is also
      separable over $K$
    }
  \end{proof}
\end{theorem}

What's about not finite extension? For that case we can define
separable extension as follows.
\begin{definition}[Separable closure]
  If $L$ over $K$ not necessary finite (but algebraic over $K$) we can
  define
  \[
  L^{sep} = \left\{x \vert x \mbox{ separable over } K \right\}
  \]
  $L^{sep}$ is a sub extension
  \footnote{
    $K \subset L^{sep} \subset L$
  }
  called separable closure of $K$ over
  $L$
  \label{def:separableclosure}
\end{definition}
$L$ is pure inseparable over $L^{sep}$.

\begin{remark}
  \begin{enumerate}
  \item If $char K = 0$ then any extension of $K$ is separable
  \item If $char K = p$ then pure inseparable extension has degree
    $p^r$ and always degree of inseparability
    $\left[L:K\right]_i = p^r$
  \end{enumerate}
\end{remark}

\section{Perfect fields}

\begin{definition}[Perfect field]
  Let $K$ is a field and $char K = p > 0$. $K$ is perfect if
  \mynameref{rem:frobeniushomomorphism} is a \mynameref{def:surjection}
  \label{def:perfectfield}
\end{definition}

\begin{example}
  \begin{enumerate}
    \item Finite field is perfect because an \mynameref{def:injection}
      of a set into itself is always a \mynameref{def:surjection}
    \item Algebraically closed fields are perfect because
      $X^p - a$ has a root $\alpha$ for any $a$ particularly
      $a = F_p\left(\alpha\right)$
      \footnote{
        $\alpha^p -a =0$ as soon as $\alpha$ is a root of $X^p - a$.
        Thus $a = \alpha^p = F_p\left(\alpha\right)$.
      }
    \item Not perfect field example. Let
      $K=\mathbb{F}_p\left(X\right)$ be a field of rational fractions
      in 1 variable over $\mathbb{F}_p$. I.e. elements of the field
      are $\frac{f(X)}{g(X)}$ where
      $f,g \in \mathbb{F}_p\left[X\right]$. It's not perfect because
      $Im\left(F_p\right) = \mathbb{F}_p\left(X^p\right) \ne
      \mathbb{F}_p\left(X\right)$ \label{ex:lec3_notperfect}
  \end{enumerate}
  \label{ex:lec3_1}
\end{example}

\begin{theorem}
  $K$ is a \mynameref{def:perfectfield} if and only if all irreducible
  polynomial over $K$
  are separable or in other words all
  \mynameref{def:algebraicextension}s of $K$ are separable.
  \begin{proof}
    Let $K$ is perfect and $P \in K\left[X\right]$ is an irreducible
    polynomial. Let also
    \[
    P\left(X\right) = Q\left(X^{p^r}\right) =
    \sum_i a_i \left(X^{p^r}\right)^i
    \]
    but as soon as my field is perfect then I can extract $p$-root of
    $a_i$
    \footnote {
      The root $b_i$ is a root of the following equation $X^p - a_i$
      i.e. $b_i^p -a_i = 0$ or $a_i = F_p\left(b_i\right)$.
    }
    and do it repeatedly. I.e. $\exists b_i \in K$ such that
    $b_i^{p^r} = a_i$. Therefore
    \[
    P\left(X\right) =
    \sum_i b_i^{p^r} \left(X^{p^r}\right)^i =
    \sum_i \left(b_i X^i\right)^{p^r} =
    \left( \sum_i b_i X^i\right)^{p^r}.
    \]
    The polynomial is not irreducible unless $r=0$
    \footnote{
      In other case each root will have at least multiplicity $p^r$.
    } so irreducible means separable.

    If $K$ is not perfect but all irreducible polynomial are
    separable. $K$ is not perfect means that $\exists a \notin
    Im\left(F_p\right)$ and lets consider the following polynomial:
    $X^{p^r} - a$. It is irreducible and not separable.

    About separability:
    in fact all roots are in $\bar{K}$ are
    the same $x$ with $x^{p^r} = a$
    \footnote{
      We have $x^{p^r} = a$ thus polynomial
      $X^{p^r} - a$ can be written as
      $X^{p^r} - a = X^{p^r} - x^{p^r} = \left(X - x\right)^{p^r}$
      thus $x$ has multiplicity $p^r$
    }
    and of course
    $x^{p^{r-1}} \notin K$.
    \footnote{
      as soon as any power of $x$ (little $x$ but not the big one $X$)
    }

    About the polynomial is irreducible.
    We have already seen that in the case
    $\left[K\left(x\right): K\right] = p^r$ so the polynomial is
    irreducible
    \footnote {
      Corollary \ref{cor:lec3_1} says that there exists an irreducible
      polynomial of degree $p^r$ with $x$ as the root. Theorem
      \ref{thm:irreduciblediv} says that the polynomial should divide
      our polynomial $X^{p^r} -a$ as soon as they have the same
      root. The two polynomial have same degree and as result they are
      the same (up to a constant). Therefore the considered polynomial
      is irreducible.
    }
    and this finishes
    \footnote{
      Because we found an irreducible polynomial that is not
      separable because has a root of multiplicity $p^r$
    }
    the proof.
  \end{proof}
  \label{thm:lec3_4}
\end{theorem}


\section{What is \periodname?}

\period is a program
to search for and fit sinusoidal patterns within a time series
of data in which one suspects periodic behavior.

This kind of data sets commonly occur in observational science such as
astronomy (light curves of stars),
meteorology (daily temperature measurements)
or physics.

\period has been written to solve problems of large
astronomical data sets containing huge gaps.
But as mentioned earlier, in other fields such data
also occur and thus often a similar approach can be taken.
So even though most examples are taken from astronomical data
the basics will apply to all kind of data, even if these are
from an entirely different field.

Some commonly used techniques to solve such problems are:
\myitemize{
\item Minimization of residuals of sinusoidal fits to the data
\item Fourier analysis and Fast Fourier analysis
\item Clean
\item Wavelet
\item Maximum entropy
\item Phase dispersion minimization
\item etc.
}

Many thanks to Julian Smart and Markus Helmholz for the wxWindows GUI library.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "period98"
%%% End:


% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
  \usepackage{amssymb}
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  pdftitle={Chaff},
  pdfauthor={Megan Clark},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{longtable,booktabs}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\ifluatex
  \usepackage{selnolig}  % disable illegal ligatures
\fi

\title{Chaff}
\author{Megan Clark}
\date{04/11/2020}

\begin{document}
\maketitle

{
\setcounter{tocdepth}{2}
\tableofcontents
}
\#Intro
\#We decided to look into if the mean mass of chaffinches differ between male and female

\#Methods
\#We collected 20 samples of both male and female chaffinches and weighed them

\#Discussion

\hypertarget{importing-chaff-data}{%
\section{importing chaff data}\label{importing-chaff-data}}

chaff \textless- read.table(``chaff.txt'', header = TRUE)
chaff

\#tidying data
chaff\textless- chaff\%\textgreater\%
pivot\_longer(names\_to = ``sex'',
values\_to = ``mass'',
cols = everything())

\#summary of data
chaffsummary \textless- summarySE(chaff, measurevar = ``mass'',
groupvars = ``sex'')

\#calculate the SS(x) for each group like this:
sum\_sq \textless- function(df, measure, group) \{
df \%\textgreater\% group\_by(\{\{ group \}\}) \%\textgreater\%
summarise(ss = sum((\{\{measure\}\} - mean(\{\{measure\}\}))\^{}2))
\}

sum\_sq(chaff, mass, sex)

\#summarising the masses by sex -
\#include the mean, standard deviation, sample size and the standard error
chaffsummary2 \textless- chaff \%\textgreater\%
group\_by(sex) \%\textgreater\%
summarise(mean\_mass = mean(mass),
n = length(mass),
sd = sd(mass),
se = sd/sqrt(n))

\#create a function called data\_summary() that carries out that summarising?
\#You will need to use the double braces,\{\{ \}\}
chaffsummaryfunc \textless- function(ds, measure, group) \{
chaff \%\textgreater\% group\_by(sex) \%\textgreater\%
summarise(mean\_mass = mean(mass),
n = length(mass),
sd = sd(mass),
se = sd/sqrt(n))
\}
chaffsummaryfunc(chaff, mass, sex)

\end{document}


\chapter{Zermelo–Fraenkel set theory}