\section{Conclusion}

Formal methods in cryptocurrency space are growing significantly.
Companies like \gls{iohk}, creator of Cardano, and Tezos are investing a lot in it.
This work contributes to the formal specification and definition of Bitcoin.

A good way of defining Bitcoin is by creating a model of it in a language with dependent types.
Agda looks like a good language for it, but other languages like CoQ, Lean can do this work too.

In this work, we define a lot of functionalities about Bitcoin.
There were definitions of transactions, transactions tree, block, and blockchain.
They were all defined in data constructors and records.
Most of the model definition was in the transaction tree
because of the state of Bitcoin changes after every transaction.
There are other ways of doing the same thing,
but I thought that this way is easier to define.
Another way could be defining more characteristics of the block and blockchain in their
types instead of doing all of it in the transaction tree (what was done in this work).

Some part of this code is not just for modeling the Bitcoin,
but to validates inputs that can be wrong.
They were functions that transform terms with simpler types (without dependent types)
to terms with more complex types (with them).
For example, transforming raw transactions into possible valid transactions.

\subsection{Future Work}

In this work, there was a code that transforms a raw transaction into a possible valid transaction.
It is not a decidable function, because there is no definition of what it is an invalid transaction.
From future work, it should have a definition of what is an invalid raw transaction.
So it will avoid that valid transaction will be discarded.

There is no definition of crypto functions like SHA-256 and elliptic curves in this work.
One thing that can be done is importing these functions from some Agda or Haskell packages
(\emph{cryptohash} in \emph{Hackage}).

In this cryptocurrency, there is no nonce and mining either.

This work does not have any IO operation.
So it is not possible to add transactions in the blockchain from the command line or the network.

The cryptocurrency of this work does not have any smart contract.
It would be good to define some of them in it.


\subsubsection{CrossValidation}
\label{CVPP}
The \textbf{CrossValidation} post-processor is specifically used to evaluate estimator (i.e., ROMs) performance.
Cross-validation is a statistical method of evaluating and comparing learning algorithms by dividing data into
two portions: one used to `train' a surrogate model and the other used to validate the model, based on specific
scoring metrics. In typical cross-validation, the training and validation sets must crossover in successive
rounds such that each data point has a chance of being validated against the various sets. The basic form of
cross-validation is k-fold cross-validation. Other forms of cross-validation are special cases of k-fold or involve
repeated rounds of k-fold cross-validation. \nb It is important to notice that this post-processor currently can
only accept \textbf{PointSet} data object.
%
\ppType{CrossValidation}{CrossValidation}
%
\begin{itemize}
  \item \xmlNode{SciKitLearn}, \xmlDesc{string, required field}, the subnodes specifies the necessary information
    for the algorithm to be used in the post-processor. `SciKitLearn' is based on algorithms in SciKit-Learn
    library, and currently it performs cross-validation over \textbf{PointSet} only.
  \item \xmlNode{Metric}, \xmlDesc{string, required field}, specifies the \textbf{Metric} name that is defined via
    \textbf{Metrics} entity. In this xml-node, the following xml attributes need to be specified:
    \begin{itemize}
      \item \xmlAttr{class}, \xmlDesc{required string attribute}, the class of this metric (e.g. Metrics)
      \item \xmlAttr{type}, \xmlDesc{required string attribute}, the sub-type of this Metric (e.g. SKL, Minkowski)
    \end{itemize}
    \nb Currently, cross-validation post-processor only accepts \xmlNode{SKL} metrics with \xmlNode{metricType}
    \xmlString{mean\_absolute\_error}, \xmlString{explained\_variance\_score}, \xmlString{r2\_score},
    \xmlString{mean\_squared\_error}, and \xmlString{median\_absolute\_error}.
\end{itemize}

\textbf{Example:}

\begin{lstlisting}[style=XML]
<Simulation>
 ...
  <Files>
    <Input name="output_cv" type="">output_cv.xml</Input>
    <Input name="output_cv.csv" type="">output_cv.csv</Input>
  </Files>
  <Models>
    ...
    <ROM name="surrogate" subType="SciKitLearn">
      <SKLtype>linear_model|LinearRegression</SKLtype>
      <Features>x1,x2</Features>
      <Target>ans</Target>
      <fit_intercept>True</fit_intercept>
      <normalize>True</normalize>
    </ROM>
    <PostProcessor name="pp1" subType="CrossValidation">
        <SciKitLearn>
            <SKLtype>KFold</SKLtype>
            <n_splits>3</n_splits>
            <shuffle>False</shuffle>
        </SciKitLearn>
        <Metric class="Metrics" type="SKL">m1</Metric>
    </PostProcessor>
    ...
  </Models>
  <Metrics>
    <SKL name="m1">
      <metricType>mean_absolute_error</metricType>
    </SKL>
  </Metrics>
  <Steps>
    <PostProcess name="PP1">
        <Input class="DataObjects" type="PointSet">outputDataMC</Input>
        <Input class="Models" type="ROM">surrogate</Input>
        <Model class="Models" type="PostProcessor">pp1</Model>
        <Output class="Files" type="">output_cv</Output>
        <Output class="Files" type="">output_cv.csv</Output>
    </PostProcess>
  </Steps>
 ...
</Simulation>
\end{lstlisting}

In order to access the results from this post-processor, RAVEN will define the variables as ``cv'' +
``\_'' + ``MetricName'' + ``\_'' + ``ROMTargetVariable'' to store the calculation results, and these
variables are also accessible by the users through RAVEN entities \textbf{DataObjects} and \textbf{OutStreams}.
In previous example, variable \textit{cv\_m1\_ans} are accessible by the users.

\paragraph{SciKitLearn}

The algorithm for cross-validation is chosen by the subnode \xmlNode{SKLtype} under the parent node \xmlNode{SciKitLearn}.
In addition, a special subnode \xmlNode{average} can be used to obtain the average cross validation results.

\begin{itemize}
  \item \xmlNode{SKLtype}, \xmlDesc{string, required field}, contains a string that
    represents the cross-validation algorithm to be used. As mentioned, its format is:

    \xmlNode{SKLtype}algorithm\xmlNode{/SKLtype}.
  \item \xmlNode{average}, \xmlDesc{boolean, optional field}, if `True`, dump the average cross validation results into the
    output files.
\end{itemize}

Based on the \xmlNode{SKLtype} several different algorithms are available. In the following paragraphs a brief
explanation and the input requirements are reported for each of them.

\paragraph{K-fold}
\textbf{KFold} divides all the samples in $k$ groups of samples, called folds (if $k=n$, this is equivalent to the
\textbf{Leave One Out} strategy), of equal sizes (if possible). The prediction function is learned using $k-1$ folds,
and fold left out is used for test.
In order to use this algorithm, the user needs to set the subnode:
\xmlNode{SKLtype}KFold\xmlNode{/SKLtype}.
In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{n\_splits}, \xmlDesc{integer, optional field}, number of folds, must be at least 2. \default{3}
  \item \xmlNode{shuffle}, \xmlDesc{boolean, optional field}, whether to shuffle the data before splitting into
    batches.
  \item \xmlNode{random\_state}, \xmlDesc{integer, optional field}, when shuffle=True,
    pseudo-random number generator state used for shuffling. If not present, use default numpy RNG for shuffling.
\end{itemize}

\paragraph{Stratified k-fold}
\textbf{StratifiedKFold} is a variation of \textit{k-fold} which returns stratified folds: each set contains approximately
the same percentage of samples of each target class as the complete set.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}StratifiedKFold\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{labels}, \xmlDesc{list of integers, (n\_samples), required field}, contains a label for each sample.
  \item \xmlNode{n\_splits}, \xmlDesc{integer, optional field}, number of folds, must be at least 2. \default{3}
  \item \xmlNode{shuffle}, \xmlDesc{boolean, optional field}, whether to shuffle the data before splitting into
    batches.
  \item \xmlNode{random\_state}, \xmlDesc{integer, optional field}, when shuffle=True,
    pseudo-random number generator state used for shuffling. If not present, use default numpy RNG for shuffling.
\end{itemize}

\paragraph{Label k-fold}
\textbf{LabelKFold} is a variation of \textit{k-fold} which ensures that the same label is not in both testing and
training sets. This is necessary for example if you obtained data from different subjects and you want to avoid
over-fitting (i.e., learning person specific features) by testing and training on different subjects.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}LabelKFold\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{labels}, \xmlDesc{list of integers with length (n\_samples, ), required field}, contains a label for
    each sample. The folds are built so that the same label does not appear in two different folds.
  \item \xmlNode{n\_splits}, \xmlDesc{integer, optional field}, number of folds, must be at least 2. \default{3}
\end{itemize}

\paragraph{Leave-One-Out - LOO}
\textbf{LeaveOneOut} (or LOO) is a simple cross-validation. Each learning set is created by taking all the samples
except one, the test set being the sample left out. Thus, for $n$ samples, we have $n$ different training sets and
$n$ different tests set. This is cross-validation procedure does not waste much data as only one sample is removed from
the training set.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}LeaveOneOut\xmlNode{/SKLtype}.

\paragraph{Leave-P-Out - LPO}
\textbf{LeavePOut} is very similar to \textbf{LeaveOneOut} as it creates all the possible training/test sets by removing
$p$ samples from the complete set. For $n$ samples, this produces $(^n_p)$ train-test pairs. Unlike \textbf{LeaveOneOut}
and \textbf{KFold}, the test sets will overlap for $p > 1$.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}LeavePOut\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{p}, \xmlDesc{integer, required field}, size of the test sets
\end{itemize}

\paragraph{Leave-One-Label-Out - LOLO}
\textbf{LeaveOneLabelOut} (LOLO) is a cross-validation scheme which holds out the samples according to a third-party
provided array of integer labels. This label information can be used to encode arbitrary domain specific pre-defined
cross-validation folds. Each training set is thus constituted by all samples except the ones related to a specific
label.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}LeaveOneLabelOut\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{labels}, \xmlDesc{list of integers, (n\_samples,), required field}, arbitrary
    domain-specific stratificatioin of the data to be used to draw the splits.
\end{itemize}

\paragraph{Leave-P-Label-Out}
\textbf{LeavePLabelOut} is imilar as \textit{Leave-One-Label-Out}, but removes samples related to $P$ labels for
each training/test set.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}LeavePLabelOut\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{labels}, \xmlDesc{list of integers, (n\_samples,), required field}, arbitrary
    domain-specific stratificatioin of the data to be used to draw the splits.
  \item \xmlNode{n\_groups}, \xmlDesc{integer, optional field}, number of samples to leave out in the test split.
\end{itemize}

\paragraph{ShuffleSplit}
\textbf{ShuffleSplit} iterator will generate a user defined number of independent train/test dataset splits. Samples
are first shuffled and then split into a pair of train and test sets. it is possible to control the randomness for
reproducibility of the results by explicitly seeding the \xmlNode{random\_state} pseudo random number generator.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}ShuffleSplit\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{n\_splits}, \xmlDesc{integer, optional field}, number of re-shuffling and splitting iterations
    \default{10}.
  \item \xmlNode{test\_size}, \xmlDesc{float or integer, optional field}, if float, should be between 0.0 and 1.0 and
    represent the proportion of the dataset to include in the test split. \default{0.1}
    If integer, represents the absolute number of test samples. If not present, the value is automatically set to
    the complement of the train size.
  \item \xmlNode{train\_size}, \xmlDesc{float or integer, optional field}, if float, should be between 0.0 and 1.0 and represent
    the proportion of the dataset to include in the train split. If integer, represents the absolute number of train
    samples. If not present, the value is automatically set to the complement of the test size.
  \item \xmlNode{random\_state}, \xmlDesc{integer, optional field}, when shuffle=True,
    pseudo-random number generator state used for shuffling. If not present, use default numpy RNG for shuffling.
\end{itemize}

\paragraph{Label-Shuffle-Split}
\textbf{LabelShuffleSplit} iterator behaves as a combination of \textbf{ShuffleSplit} and \textbf{LeavePLabelOut},
and generates a sequence of randomized partitions in which a subset of labels are held out for each split.
In order to use this algorithm, the user needs to set the subnode:

\xmlNode{SKLtype}LabelShuffleSplit\xmlNode{/SKLtype}.

In addition to this XML node, several others are available:
\begin{itemize}
  \item \xmlNode{labels}, \xmlDesc{list of integers, (n\_samples)}, labels of samples.
  \item \xmlNode{n\_splits}, \xmlDesc{integer, optional field}, number of re-shuffling and splitting iterations
    \default{10}.
  \item \xmlNode{test\_size}, \xmlDesc{float or integer, optional field}, if float, should be between 0.0 and 1.0 and
    represent the proportion of the dataset to include in the test split. \default{0.1}
    If integer, represents the absolute number of test samples. If not present, the value is automatically set to
    the complement of the train size.
  \item \xmlNode{train\_size}, \xmlDesc{float or integer, optional field}, if float, should be between 0.0 and 1.0 and represent
    the proportion of the dataset to include in the train split. If integer, represents the absolute number of train
    samples. If not present, the value is automatically set to the complement of the test size.
  \item \xmlNode{random\_state}, \xmlDesc{integer, optional field}, when shuffle=True,
    pseudo-random number generator state used for shuffling. If not present, use default numpy RNG for shuffling.
\end{itemize}


% -----------------------------*- LaTeX -*------------------------------
\documentclass[12pt]{report}
\usepackage{scribe_hgen486}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}
\usepackage{amsmath}

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\lstset{frame=tb,
  language=R,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=none,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}
\begin{document}

\scribe{Katherine Silliman}		% required
\lecturenumber{12}			% required, must be a number
\lecturedate{February 11}		% required, omit year
\lecturer{Matthew Stephens}

\maketitle

% please leave this comment
\framebox[.95\textwidth]{\parbox{.93\textwidth}{ {{\bf Note:}} These
lecture notes are still rough, and have only have been mildly
proofread.  }}
\vspace*{.1in}

% feel free to delete content below this line
% ----------------------------------------------------------------------

Computing practical on implementing MCMC in R. See \textit{github.com/stephens999/mcmc-examples/blob/master/MCMC/IntroMCMC.R} for original code example.

\section{Ex.1: Sampling from an exponential distribution using MCMC}
Any MCMC scheme aims to produce (dependent) samples from a "target" distribution $\pi \left (x \right )$.
In this case we are going to use the exponential distribution with mean 1 as our target distribution. So we start by defining our target density:

\begin{lstlisting}
target = function(x){
    if(x<0){
        return(0)}
    else {
        return( exp(-x))}
}
\end{lstlisting}

Recall that the Metropolis-Hastings algorithm is useful for sampling from a distribution that is proportional to our target distribution. It involves the following steps:

\begin{enumerate}
\item Initialization: pick an initial state \textit{x} (usually at random)
\item Randomly draw a state \textit{x'} from the proposal distribution $Q\left ( x \rightarrow {x}' \right )$
\item Accept the state according to the acceptance distribution \textit{H}:
\begin{equation}
H = min\left (1, \frac{\pi \left ( {x}' \right ) Q\left ( {x}' \rightarrow x \right )}{\pi\left ( x \right ) Q\left ( x\rightarrow {x}' \right )} \right ).
\end{equation}
If not accepted state remains at \textit{x}, otherwise transitions to \textit{x'}
\item Save state x, go to \#2
\item Repeat desired number of iterations
\end{enumerate}
We can code a Metropolis-Hastings scheme in R like this:
\begin{lstlisting}
easyMCMC = function(niter, startval, proposalsd){
    x = rep(0,niter)
    x[1] = startval
    for(i in 2:niter){
        currentx = x[i-1]
        proposedx = rnorm(1,mean=currentx,sd=proposalsd)
        A = target(proposedx)/target(currentx)
        if(runif(1)<A){
            x[i] = proposedx       # accept move with probabily min(1,A)}
        else {
        x[i] = currentx        # otherwise "reject" move, and stay where we are} }
    return(x) }
\end{lstlisting}

$\ast$ Note that since $\frac{Q\left ({x}' \rightarrow x \right )}{Q \left (x \rightarrow {x}' \right )} = 1$, we are only computing $\frac{\pi \left ({x}' \right )}{\pi \left (x \right ) }$ to determine acceptance.

Plotting \textit{x} shows us the \textbf{trace} of our Markov chain. When x is high dimensional it is more difficult or impossible to view a trace of \textit{x}.
\begin{lstlisting}
#Run MCMC 3 times and look at how similar the results are.
z1=easyMCMC(1000,3,1)
z2=easyMCMC(1000,3,1)
z3=easyMCMC(1000,3,1)
plot(z1,type="l")
lines(z2,col=2)
lines(z3,col=3)
\end{lstlisting}

\begin{figure}[!htb]
\minipage{0.5\textwidth}
\includegraphics[width=\linewidth]{mcmcplot3.png}
\endminipage\hfill
\minipage{0.5\textwidth}
\includegraphics[width=\linewidth]{mcmcplot4.png}
\endminipage\hfill
\end{figure}

By playing around with the proposal standard deviation, number of iterations, and starting value we can see how these affect the MCMC output.
\begin{description}
\item[Starting value:] If the starting value is way outside of the target distribution, it will take longer to converge. The code also will not run with a negative starting value.
\item[Proposal SD:] A very small proposal SD will make it take longer to converge, whereas a large SD will result in the chain getting "stuck" a lot as values will more frequently get rejected. Intuitively, an SD of 0 will result in a flat trace as x never changes.
\item[Number of iterations:] An adequate nuber of iterations are required in order for the chain to converge.
\end{description}

\textbf{"sticky chain":} high autocorrelation among steps

We can also change the target distribution.
\begin{lstlisting}
target = function(x){
    return((x>0 & x <1) + (x>2 & x<3))
}
\end{lstlisting}
This target will have a bimodal distribution. If the SD is too small (i.e. 0.1) it will not work.

\subsection{Tuning the MCMC}

Tuning your proposal involves finding the best values of the proposal standard deviation in order for the chain to mix faster.
This is usually accomplished by ruunning a test chain and looking at the proportion of steps that are accepted. If the proportion of accepted steps is too high, it may slow down mixing. In general, when you have higher dimensions in your target values the optimal optimal acceptance rate is lower.

\textbf{adaptivity:} where you change the rules (i.e. the proposal SD) for an ongoing MCMC chain based on what you see in the trace. This is risky as it may end up not being a true Markov chain.
Another important consideration is that the probability of storing an observation must be unbiased and not depend on what stage the chain is currently in.
A common way to \textit{thin} values is to set a consistent interval for recorded observations (i.e. every 10 iterations).

\section{Ex.3: Estimating an allele frequency and inbreeding coefficient (Gibbs Sampler)}
In class we glossed over Example 2 in the IntroMCMC.R, which goes over how to implement an MCMC to estimate the allele frequency in a population showing Hardy-Weinberg equilibrium.
Example 3 illustrates how to implement a 2 dimensional Markov chain to estimate an allele frequency and inbreeding coefficient.
From IntroMCMC.R:
" A slightly more complex alternative than HWE is to assume that there is a tendency for people to mate with others who are slightly more closely-related than "random" (as might
happen in a geographically-structured population, for example). This will result in an excess of homozygotes compared with
HWE. A simple way to capture this is to introduce an extra parameter,
the "inbreeding coefficient" f, and assume that the genotypes AA, Aa and aa have frequencies $fp + \left ( 1-f\right )p^2$, $\left (1-f \right ) 2p\left (1-p\right )$, and $f\left (1-p \right) + \left(1-f\right )\left (1-p\right)^2$
In most cases it would be natural to treat f as a feature of
the population, and therefore assume f is constant across loci. For simplicity we will consider just a single locus.

Note that both f and p are constrained to lie between 0 and 1 (inclusive). A simple prior for each of these two parameters is to assume
that they are independent, uniform on [0,1]. Suppose that we sample n individuals, and observe nAA with genotype AA,
nAa with genotype Aa and naa with genotype aa.

One way we can implement and MCMC routine to get f and p is to update both f and p each iteration and assume that they are independent. Another way is to implement a Gibbs Sampler.
To do this, we use a "latent variable" $Z_i$, a representation of whether an individual came from an inbred mating $f$ or non-inbred mating $(1-f)$. This way we can implement a posterior dstribution for p that does not depend on f.

\begin{equation}
    Z_i =
    \begin{cases}
    1, & wpf \\
    0, & wp\left(1-f \right)
    \end{cases}
\end{equation}
$Z_i \sim Bernoulli\left (f \right )$

This makes the likelihoods of the data(genotypes) given p and Z not depend on f:
\begin{eqnarray}
p\left (AA|z_i = 1 \right ) = p \\
%
p\left (AA|z_i = 0 \right ) = p^2 \\
%
p\left (Aa|z_i = 1 \right ) = 0 \\
%
p\left (Aa|z_i = 0 \right ) = 2p\left (1-p \right )\\
%
p\left (aa|z_i = 1 \right ) = 1-p \\
%
p\left (aa|z_i = 0 \right ) = \left ( 1-p \right )^2
\end{eqnarray}

To implement the Gibbs sampler, you would iterate over the following steps:
\begin{enumerate}
\item Sample Z from $p\left(z| g, f, p\right)$
\item Sample f,p from $p\left(f, p |g, z\right)$
\end{enumerate}

\end{document}


\documentclass{article}
\usepackage{eecstex}
\usepackage{circledsteps}

\title{EE 123 HW 03}
\author{Bryan Ngo}
\date{2022-02-07}

\begin{document}

\maketitle

\setcounter{section}{2}

\section{}

\subsection{}

\(y[n]\) is
\begin{itemize}
    \item \(y[n \geqslant L] = 0\) since an autocorrelation implies that the range of nonzero values is \([-L - 1, L - 1]\).
    \item Conjugate-symmetric since the frequency domain representatio is purely real.
    \item Odd length since the multiplication of two length \(L\) signals in the frequency domain is the circular convolution, which creates a length \(2L - 1\) signal.
\end{itemize}

\subsection{}

Due to the symmetry and convolution properties of the DFT,
\begin{equation}
    \bar{y}[n] = x[n] \, \Circled{N} \, x^\ast[-n]
\end{equation}
where we want
\begin{equation}
    y[n] = \bar{y}[m[n]] = x[n] \ast x^\ast[-n]
\end{equation}
Let \(N = 2L - 1\) so that we can capture the entire range of the circular autocorrelation.
Since circular convolution retains the same indices as the original signals, we now have a signal with range \([0, 2N - 2]\).
Thus, we must time shift by \(m[n] = n + (L - 1)\) to center the signal around 0.

\newpage
\section{}

\begin{equation}
    \begin{array}[]{||c|c||}
        \hline
        k & X[k] \\
        \hline
        0 & 3 \\
        2 & 0.5 - 4.5j \\
        4 & 5 \\
        5 & 3.5 + 3.5j \\
        7 & -2.5 - 7j \\
        \hline
    \end{array}
\end{equation}

\subsection{}

Using the symmetry properties of the DFT, we can complete the DFT as shown:

\begin{equation}
    \begin{array}[]{||c|c||}
        \hline
        k & X[k] \\
        \hline
        0 & 3 \\
        1 & -2.5 + 7j \\
        2 & 0.5 - 4.5j \\
        3 & 3.5 - 3.5j \\
        4 & 5 \\
        5 & 3.5 + 3.5j \\
        6 & 0.5 + 4.5j \\
        7 & -2.5 - 7j \\
        \hline
    \end{array}
\end{equation}
meaning that
\begin{equation}
    x[0] = \frac{1}{8} \sum_{k = 0}^7 X[k] = \frac{11}{8}
\end{equation}

\subsection{}

By the circular convolution and time-shift theorems of the DFT,
\begin{equation}
    x[n] \, \Circled{8} \, \delta[n - 1] = e^{-j \frac{2\pi}{8} k} X[k]
\end{equation}

\subsection{}

Since \(W[k]\) is simply \(X[k]\) evaluated at the even terms, we can represent \(w[n]\) as
\begin{align}
    W[k] &= X[2k] = \sum_{n = 0}^7 x[n] W_8^{2kn} \\
    \overset{\mathcal{F}^{-1}}{\implies} w[n] &= \frac{1}{4} \sum_{k = 0}^3 W[k] W_4^{-kn} = \frac{1}{4} \sum_{k = 0}^3 X[2k] W_4^{-kn} \\
    &= \frac{1}{4} \sum_{k = 0}^7 \frac{1}{2} (1 + (-1)^k) X[k] W_8^{-kn} = \frac{1}{8} \sum_{k = 0}^7 (1 + e^{-j \pi k}) X[k] W_8^{-kn} \\
    &= x[n] + \sum_{k = 0}^7 e^{-j \pi k} X[k] W_8^{-kn} \\
    &= x[n] + \sum_{k = 0}^7 W_8^4 X[k] W_8^{-kn} = x[n] + \sum_{k = 0}^7 X[k] W_8^{-kn + 4} \\
    &= x[n] + x[(n - 4)_8]
\end{align}

\newpage
\section{Faster DFTs?}

Since \(f[n]\) and \(g[n]\) are both purely real, then \(j g[n]\) must be purely imaginary.
By the linearity of the DFT, \(H[k] = F[k] + j G[k]\).
We can then express \(F[k]\) and \(G[k]\) as
\begin{align}
    F[k] &= \Re\{H[k]\} = \frac{1}{2} (H[k] + H^\ast[k]) \\
    G[k] &= \Im\{H[k]\} = \frac{1}{2j} (H[k] - H^\ast[k])
\end{align}

\newpage
\section{Diagonalizing Circulant Matrices}

\begin{theorem}
    The DFT matrix diagonalizes all circulant matrices.
\end{theorem}
\begin{proof}
    Let \(\bm{H}\) be a circulant matrix
    \begin{equation}
        \bm{H} =
        \begin{bmatrix}
            c_1 & c_2 & \cdots & c_{N - 1} & c_N \\
            c_N & c_1 & \cdots & c_{N - 2} & c_{N - 1} \\
            \vdots & \vdots & \ddots & \vdots & \vdots \\
            c_2 & c_3 & \cdots & c_N & c_1
        \end{bmatrix} =
        \begin{bmatrix}
            c[n] \\
            c[(n - 1)_N] \\
            \vdots \\
            c[(n - (N - 1))_N]
        \end{bmatrix}
    \end{equation}
    and \(\bm{D}\) be the \(N \times N\) DFT matrix.
    Note that the DFT matrix satisfies the following relation: \(\bm{D}^{-1} = \frac{1}{N} \bm{D}^\ast\).
    Then,
    \begin{align}
        \bm{D} \bm{H} \bm{D}^{-1} &=
        \begin{bmatrix}
            1 & 1 & \cdots & 1 \\
            1 & e^{-j \frac{2\pi}{n}} & \cdots & e^{-j \frac{2\pi}{n} (n - 1)} \\
            \vdots & \vdots & \ddots & \vdots \\
            1 & e^{-j \frac{2\pi}{n} (n - 1)} & \cdots & e^{-j \frac{2\pi}{n} (n - 1) (n - 1)}
        \end{bmatrix}
        \begin{bmatrix}
            c[n] \\
            c[(n - 1)_N] \\
            \vdots \\
            c[(n - (N - 1))_N]
        \end{bmatrix}
        \frac{1}{N} \begin{bmatrix}
            1 & 1 & \cdots & 1 \\
            1 & e^{j \frac{2\pi}{N}} & \cdots & e^{j \frac{2\pi}{N} (N - 1)} \\
            \vdots & \vdots & \ddots & \vdots \\
            1 & e^{j \frac{2\pi}{N} (N - 1)} & \cdots & e^{j \frac{2\pi}{n} (N - 1) (N - 1)}
        \end{bmatrix} \\
        &=
        \begin{bmatrix}
            C[0] \\
            W_N C[1] \\
            \vdots \\
            W_N^{N - 1} C[N - 1]
        \end{bmatrix}
        \frac{1}{N} \begin{bmatrix}
            1 & 1 & \cdots & 1 \\
            1 & e^{j \frac{2\pi}{N}} & \cdots & e^{j \frac{2\pi}{N} (N - 1)} \\
            \vdots & \vdots & \ddots & \vdots \\
            1 & e^{j \frac{2\pi}{N} (N - 1)} & \cdots & e^{j \frac{2\pi}{n} (N - 1) (N - 1)}
        \end{bmatrix} \\
        &=
        \frac{1}{N} \begin{bmatrix}
            N C[0] & 0 & \cdots & 0 \\
            0 & N C[1] & \cdots & 0 \\
            \vdots & \vdots & \ddots & \vdots \\
            0 & 0 & \cdots & N C[N - 1]
        \end{bmatrix}
        =
        \begin{bmatrix}
            C[0] & 0 & \cdots & 0 \\
            0 & C[1] & \cdots & 0 \\
            \vdots & \vdots & \ddots & \vdots \\
            0 & 0 & \cdots & C[N - 1]
        \end{bmatrix}
    \end{align}
    where we use the circular shift property to rewrite the circulant matrix and use the frequency shift properties of the DFT to prove that the DFT matrix diagonalizes any circulant matrix.
\end{proof}

% IDFT{X[k]} = 1/N (DFT(X*[k]))*

\end{document}


%!TEX root = ../notes.tex
\section{February 14, 2022}
\subsection{Groups \emph{continued}}
\begin{example}
    Some itemize of groups and nongroups:
    \begin{itemize}
        \item $(\ZZ/N\ZZ, +)$: Yes (Abelian).
        \item $(\ZZ/N\ZZ, \times)$: No. $0^{-1}$ does not exist (inverse).
        \item $((\ZZ/n\ZZ)^\times, \times)$: Yes (Abelian).
        \item $(\ZZ\setminus \{0\}, \times)$: No. $2^{-1}$ does not exist (inverse).
        \item $(\ZZ\setminus \{0\}, +)$: No. No identity $e$.
        \item $\left(\{n\times n\text{ matrices} : \det M \neq 0\}, \times\right)$: Yes (not Abelian for $n\geq 2$).
    \end{itemize}
\end{example}
\begin{definition}
    For $g\in G$, $x = 1, 2, 3, \dots$,
    \[g^x = \underbrace{g\circ g\circ \cdots \circ g}_{x\text{ times}}\]
    We extend this to define $g^0 = e$ and $g^{-n} = (g^n)^{-1}$ (so that our usual exponent rules also apply).
\end{definition}
\begin{example}
    From just now, in $(\ZZ/N\ZZ, +)$, $1^3 = 3$.
\end{example}
\begin{definition}[Element Order]
    The smallest (positive) $n$ with $g^n = e$ is called the \ul{order} of $g$.

    If there is no such $n$, we say $g$ has \ul{infinite} order.
\end{definition}
\begin{proposition}
    If $G$ is a finite group, then every element $g\in G$ has finite order.
\end{proposition}
\begin{proof}
    Consider all powers of $g$
    \[g, g^2, g^3, g^4, \dots\]
    so at some point, we will have
    \[g, g^2, g^3, g^4, \dots, g^i, \dots, g^j, \dots\]
    where $g^i$ and $g^j$ are equal. Then $g^{j-i} = e$. Hence $G$ has a finite order.
\end{proof}
\begin{proposition}
    Let $g\in G$ have order $k$, with $g^n = e$. Then $k\mid n$.
\end{proposition}
\begin{proof}
    We use the division algorithm. We write
    \[n = q\cdot k + r\text{ with }0\leq r < k\]
    then we have
    \[e = g^n = (g^k)^q g^r = e^q\cdot g^r\]
    so $g^r = e$, which forces $r = 0$ since $0\leq r < k$. So $n = qk \Rightarrow k\mid n$.
\end{proof}
\begin{theorem}
    $g^{\#G} = e$. In particular, $\ord g\mid \#G$.
\end{theorem}
\begin{proof}[Proof for Abelian groups]
    Let $G = \{g_1, \dots, g_n\} = \{gg_1, gg_2, \dots, gg_n\}$. No two are equal, since we can take inverse of $g$. We multiply them all together:
    \begin{align*}
        g_1g_2\cdots g_n          & = (gg_1)\cdots (gg_n)        \\
        \cancel{g_1g_2\cdots g_n} & = \cancel{g_1\cdots g_n} g^n \\
        e                         & = g^n
    \end{align*}
    so we have as desired.
\end{proof}
This is true even if $G$ is not Abelian - it's Lagrange's Theorem, which we won't cover here\footnote{Covered in Math 1530, Abstract Algebra.}.

Note that our previous cryptosystems: Diffie-Hellman key exchange and Elgamal, works in \emph{any} group.

\textbf{Q: Why would we want to be able to pick our group?}

Might we want to do this in a group that allows for fast operations? That makes encryption and decryption easy, but it also makes computing the discrete log difficult. We want groups that are \emph{easy enough} and \emph{hard enough}. We might appreciate this by the end of the course\dots

\subsection{Computation Complexity}
How might we quantify ``easy'' or ``hard'' in cryptography.
\begin{example}
    Let $g\in G$ a group. Let's consider exponentiation
    \[x\longmapsto g^x\]
    if $x$ has $k$ bits (i.e. $x\approx 2^k$). How many steps does it take us to compute $g^x$? At most $2k$ multiply and add steps.

    What about solving the discrete log problem:
    \[g^x\longmapsto x\]
    where $x$ has $k$ bits. How many steps does this take (na\"ively, trying every power)? About $2^k$ steps.
\end{example}
\begin{definition}[Big-O]
    We say $f(x) = \mathcal{O}(g(x))$ if there are \emph{constants} $c$ and $c'$ with
    \[f(x) \leq c\cdot g(x) \quad \text{for all }x\geq c'\]
\end{definition}
\begin{example}
    Say $f(x) = \mathcal{O}(1) \Leftrightarrow f$ is bounded.
\end{example}

If $f(x) = \mathcal{O}(x^c)$, then we say this is a ``easy'' problem.\footnote{We take $x$ to be the number of bits of the input}

If $f(x) = \mathcal{O}(c^x)$, we think of this as a ``hard'' problem.

\begin{proposition}
    If
    \[\lim_{x\to \infty}\frac{f(x)}{g(x)} < \infty\]
    then $f(x) = \mathcal{O}(g(x))$.
\end{proposition}
\begin{proof}
    Using definition of limits, for any $\varepsilon > 0$:
    \[\left\vert\frac{f(x)}{g(x)} - L\right\vert < \varepsilon \text{ for }x\geq c\]
    then $f(x) < (L + \varepsilon)\cdot g(x)$.
\end{proof}
\begin{example}
    $2x^2+5x+7 = \mathcal{O}(x^2)$.
\end{example}


\documentclass[t,usenames,dvipsnames]{beamer}
\usetheme{Copenhagen}
\setbeamertemplate{headline}{} % remove toc from headers
\beamertemplatenavigationsymbolsempty

\usepackage{amsmath, sfmath, tikz, xcolor}
\usetikzlibrary{arrows.meta, calc}

\title{Dot Product and Projection}
\author{}
\date{}

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}

\begin{document}

\begin{frame}
    \titlepage
\end{frame}

\section{Find the dot product of two vectors.}

\begin{frame}{Dot Product}
    For vectors $\vec{v} = \langle v_1, v_2 \rangle$ and $\vec{w} = \langle w_1, w_2 \rangle$, the \alert{dot product} of $\vec{v}$ and $\vec{w}$ is given as
\begin{align*}
\vec{v} \cdot \vec{w} &= \langle v_1, v_2 \rangle \cdot \langle w_1, w_2 \rangle \\
\onslide<2->{&= v_1w_1 + v_2w_2}
\end{align*}
\end{frame}

\begin{frame}{Example 1}
Find $\vec{v} \cdot \vec{w}$ if $\vec{v} = \langle 3, 4 \rangle$ and $\vec{w} = \langle 1, -2 \rangle$.
\begin{align*}
\onslide<2->{\vec{v}\cdot\vec{w} &= \langle 3, 4\rangle \cdot \langle 1, -2\rangle} \\[8pt]
\onslide<3->{&= 3(1) + 4(-2)} \\[8pt]
\onslide<4->{&= -5} \\
\end{align*}
\end{frame}

\begin{frame}{Dot Product Properties}
Because the dot product produces a scalar, it is often called the \alert{scalar product}.    \newline\\

\onslide<2->{\textbf{Properties}} \newline\\
\begin{tabular}{ll}
    \onslide<3->{$\vec{v} \cdot \vec{w} = \vec{w} \cdot \vec{v}$ &
    Commutative Property}    \\[8pt]
    \onslide<4->{$\vec{u} \cdot \left(\vec{v} + \vec{w}\right) = \vec{u} \cdot \vec{v} + \vec{u} \cdot \vec{w}$  &   Distributive Property} \\[8pt]
    \onslide<5->{$k\left(\vec{v}\right) \cdot \vec{w} = k\left(\vec{v} \cdot \vec{w}\right) = \vec{v} \cdot \left(k\vec{w}\right)$    &   Scalar Property}    \\[8pt]
    \onslide<6->{$\vec{v} \cdot \vec{v} = \lVert \vec{v} \rVert ^2$  &
    Relation to Magnitude} \\[8pt]
\end{tabular}
\end{frame}

\begin{frame}{Example 2}
    Show that $ \lVert \vec{v} - \vec{w} \rVert ^2 = \lVert \vec{v} \rVert ^2 - 2\left( \vec{v} \cdot \vec{w} \right) + \lVert \vec{w} \rVert ^2 $
\begin{align*}
    \onslide<2->{\lVert \vec{v} - \vec{w} \rVert^2 &= (\vec{v} - \vec{w})\cdot (\vec{v} - \vec{w})} \\[8pt]
    \onslide<3->{&= \vec{v}\cdot(\vec{v}-\vec{w}) -\vec{w} \cdot (\vec{v}-\vec{w})} \\[8pt]
    \onslide<4->{&=\vec{v}\cdot\vec{v} - \vec{v}\cdot\vec{w} - \vec{v}\cdot\vec{w} + \vec{w}\cdot\vec{w}} \\[8pt]
    \onslide<5->{&= \vec{v}\cdot\vec{v} - 2(\vec{v}\cdot\vec{w}) + \vec{w}\cdot\vec{w}} \\[8pt]
    \onslide<6->{&= \lVert v\rVert^2 - 2(\vec{v}\cdot\vec{w}) + \lVert w \rVert^2} \\
\end{align*}
\end{frame}

\section{Find the angle measure between two vectors.}

\begin{frame}{Angles Between Vectors}
    If we draw $\vec{v}$ and $\vec{w}$ with the same initial point, then the angle $\theta$ between them is illustrated below:  \newline\\

\begin{tabular}{p{0.3\textwidth}p{0.3\textwidth}p{0.25\textwidth}}
\begin{tikzpicture}[scale=0.9]
    \draw [-{Stealth}] (0,0) -- (2,2) node [right] {$\vec{v}$};
    \draw [-{Stealth}] (0,0) -- (1.25,1.25) node [right] {$\vec{w}$};
    \draw [fill=black] (0,0) circle (1pt);
    \node at (1,0) [below] {$\theta = 0$};
\end{tikzpicture}
&
\begin{tikzpicture}[scale=0.9]
    \draw [-{Stealth}] (0,0) -- (30:1.5) node [right] {$\vec{v}$};
    \draw [-{Stealth}] (0,0) -- (150:1.5) node [left] {$\vec{w}$};
    \draw [fill=black] (0,0) circle (1pt);
    \draw [<->, >=stealth] (30:0.35) arc (30:150:0.35) node [midway, above] {$\theta$};
    \node at (0,0) [below] {$0 \leq \theta < \pi$};
\end{tikzpicture}
&
\begin{tikzpicture}[scale=0.9]
    \draw [-{Stealth}] (0,0) -- (30:1.5) node [right] {$\vec{v}$};
    \draw [-{Stealth}] (0,0) -- (210:1.5) node [left] {$\vec{w}$};
    \draw [fill=black] (0,0) circle (1pt);
    \draw [<->, >=stealth] (30:0.25) arc (30:210:0.25) node [midway, above] {$\theta$};
    \node at (0,0) [below right] {$\theta = \pi$};
\end{tikzpicture}
\end{tabular}
\end{frame}

\begin{frame}{Dot Product and Angles Between Vectors}
Geometrically, the dot product between two vectors is
\[
\vec{v} \cdot \vec{w} = \lVert \vec{v} \rVert \lVert \vec{w} \rVert \cos \theta
\]
\vspace{20pt}
\pause
\begin{tabular}{p{0.5\textwidth}p{0.35\textwidth}}
\begin{tikzpicture}
    \draw [-{Stealth}, shorten >= 1pt] (0,0) -- (15:2) node [right] {$\vec{v}$};
    \draw [-{Stealth}, shorten >= 1pt] (0,0) -- (120:2) node [left] {$\vec{w}$};
    \draw [-{Stealth}, shorten >= 1pt] (120:2) -- (15:2) node [midway, above right] {$\vec{v}-\vec{w}$};
    \draw (15:0.35) arc (15:120:0.35) node [midway, above] {$\theta$};
    \draw [fill=black] (15:2) circle (1pt);
    \draw [fill=black] (120:2) circle (1pt);
    \draw [fill=black] (0,0) circle (1pt);
\end{tikzpicture}
&
\begin{tikzpicture}
    \draw (0,0) -- (15:2) node [midway, below] {$\lVert \vec{v} \rVert$};
    \draw (0,0) -- (120:2) node [midway, left] {$\lVert \vec{w} \rVert$};
    \draw (120:2) -- (15:2) node [midway, above right] {$\lVert \vec{v}-\vec{w} \rVert$};
    \draw (15:0.35) arc (15:120:0.35) node [midway, above] {$\theta$};
    \draw [fill=black] (15:2) circle (1pt);
    \draw [fill=black] (120:2) circle (1pt);
    \draw [fill=black] (0,0) circle (1pt);
\end{tikzpicture}   \\[8pt]
\end{tabular}
\end{frame}

\begin{frame}{Dot Product and Angles Between Vectors}
By the Law of Cosines, $\lVert \vec{v} - \vec{w} \rVert ^2 = \lVert \vec{v} \rVert ^2 + \lVert \vec{w} \rVert ^2 - 2 \lVert \vec{v} \rVert \lVert \vec{w} \rVert \cos \theta$, and by Example 2, $ \lVert \vec{v} - \vec{w} \rVert ^2  = \lVert \vec{v} \rVert ^2 - 2\left( \vec{v} \cdot \vec{w} \right) + \lVert \vec{w} \rVert ^2 $.    \\[11pt]
\pause
Equating these and solving for $\vec{v} \cdot \vec{w}$ gives us $\vec{v} \cdot \vec{w} = \lVert \vec{v} \rVert \lVert \vec{w} \rVert \cos \theta$, from which
\[
\cos \theta = \frac{\vec{v} \cdot \vec{w}}{\lVert \vec{v} \rVert \, \lVert \vec{w} \rVert}
\]
\pause
\vspace{11pt}
To find the angle between two vectors, solve for $\theta$:
\[
\theta = \cos^{-1}\left(\frac{\vec{v} \cdot \vec{w}}{\lVert \vec{v} \rVert \, \lVert \vec{w} \rVert} \right) = \cos^{-1}\left(\hat{v} \cdot \hat{w} \right)
\]
\end{frame}

\begin{frame}{Example 3a}
Find the angle between each of the following.   \newline\\
(a) \quad $\vec{v} = \langle 3, -3\sqrt{3} \rangle$ and $\vec{w} = \langle -\sqrt{3}, 1 \rangle$
\begin{align*}
    \onslide<2->{\vec{v}\cdot\vec{w} &= \langle 3, -3\sqrt{3} \rangle \cdot \langle -\sqrt{3}, 1 \rangle} \\[8pt]
    \onslide<3->{&= -3\sqrt{3}-3\sqrt{3}=-6\sqrt{3}} \\[8pt]
    \onslide<4->{\lVert \vec{v} \rVert &= \sqrt{3^2 + (3\sqrt{3})^2} = \sqrt{36}} \\[8pt]
    \onslide<5->{\lVert \vec{w} \rVert &= \sqrt{(\sqrt{3})^2 + 1^2} = \sqrt{4}} \\[8pt]
    \onslide<6->{\theta &= \arccos\left(\frac{-6\sqrt{3}}{\sqrt{36\times 4}}\right) = \frac{5\pi}{6}}
\end{align*}
\end{frame}

\begin{frame}{Example 3b}
(b) \quad $\vec{v} = \langle 2, 2 \rangle$ and $\vec{w} = \langle 5, -5 \rangle$
\begin{align*}
    \onslide<2->{\vec{v}\cdot\vec{w} &= 2(5) + 2(-5) = 0} \\[8pt]
    \onslide<3->{\lVert \vec{v} \rVert &= \sqrt{2^2 + 2^2} = \sqrt{8}} \\[8pt]
    \onslide<4->{\lVert \vec{w} \rVert &= \sqrt{5^2 + 5^2} = \sqrt{50}} \\[8pt]
    \onslide<5->{\theta &= \arccos\left(\frac{0}{\sqrt{8\times50}}\right) = \frac{\pi}{2}} \\
\end{align*}
\end{frame}

\begin{frame}{Example 3c}
(c) \quad  $\vec{v} = \langle 3, -4 \rangle$ and $\vec{w} = \langle 2, 1 \rangle$
\begin{align*}
    \onslide<2->{\vec{v}\cdot\vec{w} &= 3(2) + (-4)(1) = 2} \\[8pt]
    \onslide<3->{\lVert \vec{v} \rVert &= \sqrt{3^2+4^2} = \sqrt{25}} \\[8pt]
    \onslide<4->{\lVert \vec{w} \rVert &= \sqrt{2^2 + 1^2} = \sqrt{5}} \\[8pt]
    \onslide<5->{\theta &= \arccos{\left(\frac{2}{\sqrt{25\times5}}\right)} \approx 80^\circ}
\end{align*}
\end{frame}

\section{Find the projection of one vector onto another.}

\begin{frame}{Orthogonal Projection}
Two vectors are {\color{blue}\textbf{orthogonal}} if they meet at a right angle.  \newline\\

If two vectors are orthogonal, then their dot product is 0.
\end{frame}

\begin{frame}{Orthogonal Projection}
The \alert{orthogonal projection} of $\vec{v}$ onto $\vec{w}$ is a new vector $\vec{p}$ that is parallel to $\vec{w}$ and has a magnitude of $\lVert \vec{v} \rVert \cos \theta$.    \newline\\ \pause

$\vec{p}$ can be thought of as the ``shadow" $\vec{v}$ casts over $\vec{w}$: \newline\\

\begin{tabular}{p{0.4\textwidth}p{0.25\textwidth}}
\begin{tikzpicture}[rotate=30]
    \coordinate (A) at (0:3);
    \coordinate (B) at (60:3);
    \draw [-{Stealth}, shorten >= 1pt] (0,0) -- (A) node [right] {$\vec{w}$};
    \draw [fill = black] (A) circle (1pt);
    \draw [-{Stealth}, shorten >= 1pt] (0,0) -- (B) node [left] {$\vec{v}$};
    \draw [fill = black] (B) circle (1pt);
    \draw [color=red] (1.5,0) rectangle +(0.2,0.2);
    \draw [dashed] (B) -- (1.5,0);
    \node at (0,0) [above right, yshift = 0.1cm] {$\theta$};
    \draw [-{Stealth}, line width = 1.25, color = blue, shorten >= 1pt] (0,0) -- (1.5,0) node [midway, below] {$\vec{p}$};
    \draw [fill=blue] (1.5,0) circle (1pt);
\end{tikzpicture}
&
\begin{tikzpicture}[rotate=30]
    \coordinate (B) at (60:3);
    \draw  (0,0) -- (B) node [midway, left] {$\lVert v \rVert$};
    \draw [color=red] (1.5,0) rectangle +(-0.2,0.2);
    \draw [dashed] (B) -- (1.5,0);
    \node at (0,0) [above right, yshift = 0.1cm] {$\theta$};
    \draw (0,0) -- (1.5,0) node [midway, below right] {$\lVert \vec{p} \rVert = \lVert v \rVert \cos \theta$};
\end{tikzpicture}   \\[8pt]
\end{tabular}
\end{frame}

\begin{frame}{Orthogonal Projection}
We need $\vec{p}$ to be parallel to $\vec{w}$. To do this, we could take the dot product of $\vec{p}$ and $\vec{w}$. \newline\\
\pause
However, that would likely change the magnitude of $\vec{p}$. \newline\\
\pause
Recall that when finding a unit vector for a given vector, that unit vector has a magnitude of 1 and is parallel to the original vector.  \newline\\
\pause

Thus, we can multiply the magnitude of $\vec{p}$ by a unit vector for $\vec{w}$.
\[
    \lVert \vec{p} \rVert \, \hat{w}
\]
\pause
This will guarantee that $\vec{w}$ is scaled to $\vec{p}$ and give us the projection of $\vec{v}$ onto $\vec{w}$.
\end{frame}

\begin{frame}{Orthogonal Projection}
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}[rotate=30]
    \coordinate (A) at (0:3);
    \coordinate (B) at (60:3);
    \draw [-{Stealth}, shorten >= 1pt] (0,0) -- (A) node [right] {$\vec{w}$};
    \draw [fill = black] (A) circle (1pt);
    \draw [-{Stealth}, shorten >= 1pt] (0,0) -- (B) node [left] {$\vec{v}$};
    \draw [fill = black] (B) circle (1pt);
    \draw [color=red] (1.5,0) rectangle +(0.2,0.2);
    \draw [dashed] (B) -- (1.5,0);
    \node at (0,0) [above right, yshift = 0.1cm] {$\theta$};
    \draw [-{Stealth}, line width = 1.25, color = blue, shorten >= 1pt] (0,0) -- (1.5,0) node [midway, below] {$\vec{p}$};
    \draw [fill=blue] (1.5,0) circle (1pt);
\end{tikzpicture}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{align*}
\onslide<2->{\text{proj}_{\vec{w}} \vec{v} &= \lVert {\color{blue}{\vec{p}}} \rVert \, {\color{red}\hat{w} }} \\[8pt]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\onslide<3->{&= \left( {\color{blue}{\lVert v \rVert \cos \theta }}\right) \left( {\color{red}\frac{\vec{w}}{\lVert w \rVert} } \right)} \\[8pt]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\onslide<4->{&= \lVert {\color{blue}v} \rVert \left( {\color{blue}\frac{v \cdot w}{\lVert v \rVert \, \lVert w \rVert} } \right) \left({\color{red}\frac{\vec{w}}{\lVert w \rVert} } \right)} \\[8pt]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\onslide<5->{&= \left({\color{blue}\frac{v \cdot w}{\lVert w \rVert \, {\color{red}\lVert w \rVert}} } \right) {\color{red}\vec{w} } }  \\[8pt]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\onslide<6->{\text{proj}_{\vec{w}} \vec{v} &= \left({\color{blue} \frac{v \cdot w}{\lVert w \rVert ^2} } \right) {\color{red}\vec{w} }}
\end{align*}
\end{minipage}
\end{frame}

\begin{frame}{Example 4a}
Let $\vec{v} = \langle 1, 8 \rangle$ and $\vec{w} = \langle -1, 2 \rangle$. Find each of the following.   \newline\\
(a) \quad $\text{proj}_{\vec{w}} \vec{v}$
\begin{align*}
    \onslide<2->{\text{proj}_{\vec{w}} \vec{v} &= \left(\frac{v \cdot w}{\lVert w \rVert^2}\right)\vec{w}} \\[8pt]
    \onslide<3->{v \cdot w = 1(-1) + 8(2) = 15} \quad & \quad \onslide<4->{\lVert \vec{w} \rVert^2 = \left(\sqrt{1^2+2^2}\right)^2 = 5} \\[8pt]
    \onslide<5->{\text{proj}_{\vec{w}} \vec{v} &= \frac{15}{5}\left<-1, 2\right>} \\[8pt]
    \onslide<6->{&= 3\langle -1, 2\rangle} \\[8pt]
    \onslide<7->{&= \langle -3, 6\rangle} \\
\end{align*}
\end{frame}

\begin{frame}{Example 4b}
Let $\vec{v} = \langle 1, 8 \rangle$ and $\vec{w} = \langle -1, 2 \rangle$. Find each of the following.   \newline\\
(b) \quad   $\text{proj}_{\vec{v}} \vec{w}$
\begin{align*}
\onslide<2->{\text{proj}_{\vec{v}} \vec{w} &= \left(\frac{w \cdot v}{\lVert v \rVert^2}\right)\vec{v}} \\[8pt]
    \onslide<3->{w \cdot v = 1(-1) + 8(2) = 15} \quad & \quad \onslide<4->{\lVert \vec{v} \rVert^2 = \left(\sqrt{1^2+8^2}\right)^2 = 65} \\[8pt]
    \onslide<5->{\text{proj}_{\vec{v}} \vec{w} &= \frac{3}{13}\left<1, 8\right>} \\[8pt]
    \onslide<6->{&= \left< \frac{3}{13}, \frac{24}{13}\right>} \\[8pt]
\end{align*}
\end{frame}

\section{Find the work done in applying a force to an object.}

\begin{frame}{Work}
    In physics, if a constant force $F$ is exerted over a distance (really, \textit{displacement}) $d$, the work $W$ done by the force is given by $W=Fd$.  \newline\\
\pause
However, if the force being applied is not in the direction of motion, we can use the dot product to find the work done. \newline\\
\pause
\begin{center}
\begin{tikzpicture}
    \coordinate (O) at (0,0);
    \coordinate (F) at (50:2);
    \coordinate (A) at (2,0);
    \draw [-{Stealth}, dashed] (O) -- (A);
    \draw [-{Stealth}] (O) -- (F) node [right] {$\vec{F}$};
    \draw [color=red] ($(O)!(F)!(A)$) rectangle +(0.2,0.2);
    \draw ($(O)!(F)!(A)$) -- (F);
    \draw [-{Stealth}, line width = 1.25, color=blue] (O) -- ($(O)!(F)!(A)$) node [midway, below] {\color{blue}$d$};
    \node at (O) [yshift=0.2cm, xshift=0.35cm] {$\theta$};
\end{tikzpicture}

$W = Fd = \lVert F \rVert \, \lVert d \rVert \cos \theta = F \cdot d$
\end{center}
\end{frame}

\begin{frame}{Example 5}
Mr. Bain exerts a force of 230 pounds to pull a stack of rocks a distance of 50 ft. over level ground. If the rope makes a $30^\circ$ angle with the horizontal, how much work did Mr. Bain do pulling the rocks? Assume Mr. Bain exerts the force of 230 pounds at a $30^\circ$ angle for the duration of the 50 feet.
\begin{align*}
    \onslide<2->{W &= \lVert F\rVert \lVert d \rVert \cos\theta} \\[8pt]
    \onslide<3->{&= (230\text{ pounds})(50\text{ ft})\cos30^\circ} \\[8pt]
    \onslide<4->{&= 11,500\text{ foot-pounds}\left(\frac{\sqrt{3}}{2}\right)} \\[8pt]
    \onslide<5->{&= 5,750\sqrt{3}\,(\approx 9,959.3)\text{ foot-pounds}} \\
\end{align*}
\end{frame}

\end{document}


\chapter{The Standard Model}

The standard model described the interaction of quarks, leptons and gauge bosons.
The gauge boson intermediate electromagnetic, weak, and strong interaction.
In the standard model, the gauge group is $\mathrm{SU(3)}\times \mathrm{SU(2)} \times \mathrm{U(1)}$, where $\mathrm{SU(3)}$ concerns the color degrees of freedom, the $\mathrm{SU(2)}\times \mathrm{U(1)}$ is gauge group of the electroweak interaction.

The matters in the standard model consists of quarks and leptons, each of them have three generations:
\begin{equation}
	\begin{tabular}{c |c c |c c}
		\hline \hline
		Generation & \multicolumn{2}{c|}{Quarks} & \multicolumn{2}{c}{Leptons} \\ \hline
		I & $u$ & $d$ & $e$ & $\nu_e$ \\
		II & $c$ & $s$ & $\mu$ & $\nu_\mu$ \\
		III & $t$ & $b$ & $\tau$ & $\nu_\tau$ \\
		\hline \hline
	\end{tabular}
\end{equation}
The gauge theory is written as a nonabelian gauge theory, or the Yang-Mills theory, which forbid the gauge field to have mass term.
Also, the weak interaction breaks the parity -- it only involve the left-handed spinor field, and such single-handed gauge symmetry forbid the mass term for fermions.
In order to obtain the mass, the Higgs field should be introduced, which involves the spontaneous symmetry breaking.

\section{Nonabelian Gauge Theory}
The U(1)-gauge-invariant QED Lagrangian consists of the gauge part and the matter part:
\begin{equation}
\begin{aligned}
	\mathcal L_{\mathrm{QED}} &= \mathcal L_\gamma + \mathcal L_\psi \\
	&= -\frac{1}{4} F^{\mu\nu} F_{\mu\nu} + \bar\psi(i\cancel D-m)\psi.
\end{aligned}
\end{equation}
where the gauge-covariant derivative
\begin{equation}
	D_\mu = \partial_\mu - iq A_\mu
\end{equation}
and the field strength tensor
\begin{equation}
	F_{\mu\nu} = \frac{i}{q} [D_\mu, D_\nu] = \partial_\mu A_\nu -\partial_\nu A_\mu
\end{equation}
are all manifestly invariant under U(1) gauge transformation.

The nonabelian gauge theory generalize the gauge group to be a general (nonabelian) Lie group parametrized as
\begin{equation}
	U(x) = \exp\left[-i g \pi^a(x) T^a\right],
\end{equation}
where $\{T^a\}$ are the generators of the gauge group.
For the nonabelian Lie group, the commutation relation, the Lie algebra, specify the structure of the infinitesimal gauge transformation.

\subsection{Yang-Mills Theory}
The gauge-invariant Lagrangian can be:
\begin{equation}
\begin{aligned}
	\mathcal L_{\mathrm{n.a.}} &= \mathcal L_{\mathrm{YM}} + \mathcal L_{\mathrm{matter}} \\
	&= -\frac{1}{4} F^{a,\mu\nu} F^a_{\mu\nu} + \bar\psi(i\cancel D-m)\psi.
\end{aligned}
\end{equation}
The form of Yang-Mills Lagrangian similar to the Maxwell field:
\begin{equation}
	\mathcal L_{\mathrm{YM}} = -\frac{1}{4} F^{a,\mu\nu} F^a_{\mu\nu}.
\end{equation}
To get gauge-invariant Lagrangian for the matter fields, we simply replace the ordinary derivative with the gauge-covariant derivative:
\begin{equation}
	\mathcal L_{\mathrm{matter}} = \begin{cases}
		\psi(i\gamma^\mu D_\mu - m)\psi & \text{Fermion} \\
		(D^\mu \phi)^\dagger D_\mu \phi - m^2 \phi^\dagger \phi & \text{Scalar}
	\end{cases}.
\end{equation}
The covariant derivative $D_\mu$ is now defined as
\begin{equation}
	D_\mu = \partial_\mu - i g A_\mu^a T^a,
\end{equation}
and the field-strength tensor is then
\begin{equation}
\begin{aligned}
	F^a_{\mu\nu} &= \frac{i}{g}[D_\mu, D_\nu]^a \\
	&= \partial_\mu A_\nu^a - \partial_\nu A_\nu^a -ig f^{abc} A^b_\mu A^c_\nu,
\end{aligned}
\end{equation}
The field strength tensor $F_{\mu\nu}$ transform as
\begin{equation}
	F_{\mu\nu}(x) \rightarrow U(x) F_{\mu\nu}(x) U^\dagger(x).
\end{equation}
The Lagrangian
\begin{equation*}
	\mathcal L_{\mathrm{GI}} = -\frac{1}{2} \mathrm{Tr}\left[F_{\mu\nu} F^{\mu\nu}\right]
\end{equation*}
is manifestly gauge-invariant.
Also, we can also choose the renormalization of the generators so that $\mathrm{Tr}[T^aT^b] = \delta^{ab}$.
In this way, when express the field strength as $F_{\mu\nu} = F_{\mu\nu}^a T^a$, the above gauge-invariant Lagrangian is exactly the Yang-Mills Lagrangian $\mathcal L_{\mathrm{YM}}$.

The covariant derivative transforms as
\begin{equation}
	D_\mu \rightarrow U(x) D_\mu U^\dagger(x)
	=\partial_\mu - i g \left[U(x) A_\mu(x) U^\dagger(x) + \frac{i}{g} U(x)\partial_\mu U^\dagger(x)\right].
\end{equation}
The matter part $\mathcal L_{\mathrm{matter}}$ is invariant if we define the transformation of the gauge field as:
\begin{equation}\label{eq:SM-YM-GT-1}
	A_\mu(x) \rightarrow U(x) A_\mu(x) U^\dagger(x) + \frac{i}{g} U(x)\partial_\mu U^\dagger(x).
\end{equation}

Similar to QED case, the gauge redundancy causes trouble in quantization.
We follow the Faddeev-Popov procedure to quantize the Yang-Mills Lagrangian.

The partition function of the Yang-Mills Lagriangian is
\begin{equation}
	Z = \int D[A] \exp\left(i \int d^4x \mathcal{L}[A]\right)
	= \int D[A_{f}]\ \mathcal V_G[A] \exp\left(i \int d^4x \mathcal{L}_{\mathrm{YM}}[A_f]\right)
\end{equation}
where $A_f$ is the gauge-fixed field, and $\mathcal V_G[A]$ denotes the phase volume of the gauge redundancy.
The task is to determine $\mathcal V_G[A]$.
This can be done by introducing a gauge-fixing condition:
\begin{equation}
	Z = \int D[\pi] \mathcal V_G[A]\int D[A] \delta(G[A^\pi]) \exp\left(i \int d^4x \mathcal{L}_{\mathrm{YM}}[A^\pi]\right),
\end{equation}
where the gauge-fixing function is
\begin{equation}\label{eq:SM-YM-GF-1}
	G[A] = \partial^\mu A_\mu - X.
\end{equation}
Here $D[\pi]$ is the Haar measure over the Lie group.
$A^\pi$ denotes the gauge transformed field.
Since the Lagrangian is gauge-invariant, we can simply drop a superscript, and the integral over $\pi$ field is just a number depending on $A$:
\begin{equation}
	\int D[\pi] \delta(G[A]) = \det\left(\frac{\delta G[A^\pi]}{\delta \pi}\right)^{-1}
\end{equation}
The infinitesimal version of the gauge transformation (\ref{eq:SM-YM-GT-1}) is
\begin{equation}
	A_\mu^a \rightarrow A_\mu^a +\frac{1}{g}\partial_\mu \pi^a + f^{abc}A^b_\mu \pi^b
	\equiv A_\mu + \frac{1}{g} D_\mu \pi^a,
\end{equation}
where the covariant derivative on the operator involves the adjoint representation:
\begin{equation}
	D_\mu \pi^a = \partial_\mu \pi^a + g f^{abc} A_\mu^b \pi^c = \partial_\mu -i g A_\mu^a \left(T^a_{\mathrm{adj}}\right)_{bc} \pi^c.
\end{equation}
The integral is then formally the operator determinant, and we thus know
\begin{equation}
	 \mathcal V_G[A] = \det(\partial^\mu D_\mu).
\end{equation}
This functional determinant can be regarded as the functional integral on a ``ghost'' field:
\begin{equation}
	\det(\partial^\mu D_\mu) = \int D[\bar c,c] \exp\left[i \int d^4 x\ \bar c (-\partial^\mu D_\mu)c \right].
\end{equation}
The gauge-fixing condition (\ref{eq:SM-YM-GF-1}) impose a hard constraint on the field configuration.
For our convenience, we
\begin{equation}
\begin{aligned}
	Z &= \int DX e^{-\frac{X}{2 \xi}}\int D[A_X] \exp\left\{i\int d^4x \left[\mathcal{L}_{\mathrm{YM}} - \bar c\partial^\mu D_\mu c \right]\right\} \\
	&= \int D[A] e^{-\frac{i}{2\xi}(\partial^\mu A_\mu)^2} \exp\left\{i\int d^4x \left[\mathcal{L}_{\mathrm{YM}} -\frac{1}{2\xi}(\partial^\mu A_\mu)^2 - \bar c\partial^\mu D_\mu c \right]\right\}.
\end{aligned}
\end{equation}
The gauge-fixing results in a modified Lagrangian with gauge-fixing term and ghost term:
\begin{equation}
\begin{aligned}
	\mathcal L &= \mathcal{L}_{\mathrm{YM}} + \mathcal{L}_{\mathrm{gf}} + \mathcal{L}_{\mathrm{gh}}, \\
	\mathcal{L}_{\mathrm{gf}} &= -\frac{1}{2\xi}(\partial^\mu A_\mu)^2, \\
	\mathcal{L}_{\mathrm{gh}} &= -\bar c\partial^\mu D_\mu c.
\end{aligned}
\end{equation}

In the standard model, the weak and strong interaction is described by the SU(2) and SU(3) Yang-Mills theory respectively, so we mainly focus on the those two cases.

\subsection{SU(3) Lie Algebra}
For the fundamental representation, the generators for the SU(3) is one-half of the \textit{Gell-Mann matrices} $T^a = \frac{1}{2}\lambda^a$, $a=1,\dots,8$, where the 8 matrices are:
\begin{equation}
\begin{aligned}
	\lambda^1 &= \left[\begin{array}{ccc}
		0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0
	\end{array} \right], &
	\lambda^2 &= \left[\begin{array}{ccc}
		0 & -i & 0 \\ i & 0 & 0 \\ 0 & 0 & 0
	\end{array} \right], \\
	\lambda^3 &= \left[\begin{array}{ccc}
		1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 0
	\end{array} \right], &
	\lambda^4 &= \left[\begin{array}{ccc}
		0 & 0 & 1 \\ 0 & 0 & 0 \\ 1 & 0 & 0
	\end{array} \right], \\
	\lambda^5 &= \left[\begin{array}{ccc}
		0 & 0 & -i \\ 0 & 0 & 0 \\ i & 0 & 0
	\end{array} \right], &
	\lambda^6 &= \left[\begin{array}{ccc}
		0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0
	\end{array} \right], \\
	\lambda^7 &= \left[\begin{array}{ccc}
		0 & 0 & 0 \\ 0 & 0 & -i \\ 0 & i & 0
	\end{array} \right], &
	\lambda^8 &= \frac{1}{\sqrt{3}}\left[\begin{array}{ccc}
		1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -2
	\end{array} \right].
\end{aligned}
\end{equation}
The commutation relation among the generator defines the \textit{structure constant}:
\begin{equation}
	\left[T^a, T^b\right] = i f^{abc} T^c.
\end{equation}
The product of two SU(3) generators is
\begin{equation}
	T^a T^b = \frac{1}{6}\delta^{ab} + \frac{1}{2} d^{abc} T^c + \frac{i}{2} f^{abc} T^c,
\end{equation}
where
\begin{equation}
	\frac{i}{2} f^{abc} = \mathrm{Tr}\left([T^a,T^b]T^c \right), \quad
	\frac{1}{2} d^{abc} = \mathrm{Tr}\left(\{T^a,T^b\}T^c \right).
\end{equation}
The cycling properties of the trace expression leads to
\begin{equation}
	f^{abc} = f^{bca} = f^{cab}, \quad
	d^{abc} = d^{bca} = d^{cab}.
\end{equation}
It also manifest that $f^{abc}$ is totally anti-symmetric and $d^{abc}$ totally symmetric.
This also leads to the trace identities:
\begin{equation}
\begin{aligned}
	\mathrm{Tr}(T^a T^b) &= \frac{1}{2}\delta^{ab}, \\
	\mathrm{Tr}(T^a T^b T^c) &= \frac{1}{4}(d^{abc} + if^{abc}), \\
	\mathrm{Tr}(T^a T^b T^c T^d) &= \frac{1}{12} \delta^{ab}\delta^{cd} + \frac{1}{8}(d^{abe}+if^{abe})(d^{cde}+if^{cde}).
\end{aligned}
\end{equation}

The generator in representation labeled by $R$ is denoted as $T_R^a$.
One important representation apart from the fundamental representation is the adjoint representation, which is a 8-dimensional representation defined as
\begin{equation}
	(T^a_{\mathrm{adj}})^{bc} = -i f^{abc}.
\end{equation}

Also, different representations can be characterized by the quadratic Casimir $C_2(R)$ defined as
\begin{equation}
	T^a_R T^a_R = C_2(R) \mathbbm 1.
\end{equation}
We know
\begin{equation}
	C_2(\text{fund}) = \frac{4}{3},\quad
	C_2(\text{adj}) =3.
\end{equation}
This also means
\begin{equation}
	f^{acd} f^{bcd} = 3 \delta^{ab}.
\end{equation}

\subsubsection{Roots and Weights}
For a simple Lie algebra, a standard set of generators (called the \textit{Cartan-Weyl basis}) can be chosen so that it contains a maximal number of mutually commuting subset.
The maximum number of such generators is defined as the \textit{rank} of the algebra.
The SU(3) Lie algebra is rank-2, with the Cartan-Weyl basis
\begin{equation}
	H_1 = \frac{1}{2}\lambda_3, \quad H_2 = \frac{1}{2}\lambda_8
\end{equation}
The common eigenstates of Cartan sub-algebra is denoted as $\{|\bm m\rangle\}$, where each $\bm m$ is a vector, called the \textit{weight}, defined by
\begin{equation}
	H_i |\bm m\rangle = m_i |\bm m\rangle.
\end{equation}
Apart from the Cartan sub-algebra, other generators can be linearly combined to form a standard non-Hermitian basis $\{E^\pm_{\bm \alpha}\}$.
Each element is labeled by an $r$-dimensional vectors $\pm \bm\alpha$, called the \textit{root}, which is defined by the commutation relation:
\begin{equation}
	[H_i, E_{\bm \alpha}^\pm] = \pm \alpha_i E^\pm_{\bm \alpha}.
\end{equation}
We can also denote $E_{\pm\bm{\alpha}} \equiv E_{\bm{\alpha}}^\pm$ for notational simplicity.
Note that the action of $E_\alpha$ will change the weight,
\begin{equation}
\begin{aligned}
	H_i E_{\bm \alpha}|\bm m\rangle
	&= [H_i, E_{\bm \alpha}]|\bm m\rangle + E_{\bm \alpha} H_i |\bm m\rangle \\
	&= (m_i + \alpha_i) E_{\bm \alpha}|\bm m\rangle,
\end{aligned}
\end{equation}

For SU(3), since $\{H_i\}$ are all diagonal, the common eigenstates are
\begin{equation}
	\begin{bmatrix}
		1 \\ 0 \\ 0
	\end{bmatrix} = \left|\left(\frac{1}{2}, \frac{\sqrt{3}}{6}\right)\right\rangle, \quad
	\begin{bmatrix}
		0 \\ 1 \\ 0
	\end{bmatrix} = \left|\left(-\frac{1}{2}, \frac{\sqrt{3}}{6}\right)\right\rangle, \quad
	\begin{bmatrix}
		0 \\ 0 \\ 1
	\end{bmatrix} = \left|\left(0, -\frac{\sqrt{3}}{3}\right)\right\rangle.
\end{equation}
These vectors, plotted in a plane, form a equilateral triangle:
\begin{equation}
	\includegraphics[width=0.35\linewidth,align=c]{pics/SM-LA-SU3-1.png}
\end{equation}
Other generators are labeled by
\begin{equation}
	E_{\bm{\alpha}_1} = \left[\begin{array}{ccc}
		0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0
	\end{array}\right], \quad
	E_{\bm{\alpha}_2} = \left[\begin{array}{ccc}
		0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0
	\end{array}\right], \quad
	E_{\bm{\alpha}_3} = \left[\begin{array}{ccc}
		0 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0
	\end{array}\right],
\end{equation}
where the root vectors are
\begin{equation}
	\bm{\alpha}_1 = (1, 0), \quad
	\bm{\alpha}_2 = \left(-\frac{1}{2}, \frac{\sqrt 3}{2} \right), \quad
	\bm{\alpha}_3 = \left(\frac{1}{2}, \frac{\sqrt 3}{2} \right).
\end{equation}
The root vectors plotted in a plane form a regular hexagon:
\begin{equation}
	\includegraphics[width=0.35\linewidth,align=c]{pics/SM-LA-SU3-2.png}
\end{equation}

The roots of $\mathfrak{su}(3)$ are not linearly independent.
We can find a set of linear independent roots called the \textit{simple roots}.
All other roots can be expressed as a linear combination of simples roots with all positive/negative coefficients.
The SU(3) algebra, for example, has $\bm{\alpha}_1$ and $\bm{\alpha}_2$ as its simple roots.

\subsubsection{Irreducible Representations}

An irreducible representation (Irrep) of a Lie algebra is entirely specified by the \textit{highest weight} state $|\bm M\rangle$ in the Irrep, which satisfies
\begin{equation}
	E_{\bm \alpha}|\bm M\rangle = 0
\end{equation}
for all simple root.
The Irrep then can be constructing by applying the lowering operators to the highest weight state:
\begin{equation}
	\text{Irrep} = \mathrm{span}\left\{ E_{\bm \alpha}^- E_{\bm \beta}^- \cdots E_{\bm \gamma}^- |\bm M\rangle, \ \text{all possible sequence}\right\}.
\end{equation}

The highest weight state can be systematically constructed using the tensor method.
For SU(3), we first need to introduce the complex of the fundamental representation $\bar 3$, defined by
\begin{equation}
	\exp(-i \pi^a T_{\bar 3}^a) = \exp(-i \pi^a T_{3}^a)^*,
\end{equation}
which gives
\begin{equation}
	T_{\bar 3}^a = - (T_{3}^{a})^T.
\end{equation}
The definition flip the sign of $\{H_i\}$, the weight plotted in the plane becomes the upside-down triangle:
\begin{equation}
	\includegraphics[width=0.35\linewidth,align=c]{pics/SM-LA-SU3-3.png}
\end{equation}
The highest wight state in $\bar 3$ is $|3\rangle$.
For a general Irrep (which can be labeled by ($m,n$)-representation), the highest weight states is
\begin{equation}
	|\bm M\rangle = \bigotimes_{i=1}^m |1\rangle_i \bigotimes_{j=m+1}^{m+n} |3\rangle_j.
\end{equation}
The ladder operators are now
\begin{equation}
	E_{\bm \alpha} = \sum_{i=1}^m E_{\bm \alpha}^{(i)} - \sum_{j=m+1}^{m+n} E^{(j)}_{-\bm \alpha}.
\end{equation}
The adjoint representation of the SU(3) is the $(1,1)$-representation.

\subsection{Quantum Chromodynamics}
The SU(3) Yang-Mills theory describe the strong interaction, also known as the quantum chromodynamics (QCD).
The Feynman rule in QCD is very complicated.
Here we just consider the simplest tree-level process $u \bar d \rightarrow u \bar d$, corresponding to the diagram
\begin{equation}
	\includegraphics[width=0.2\linewidth,align=c]{pics/SM-YM-1}
	= T^a_{ji} T^a_{kl} \times (\text{QED-like term}),
\end{equation}
where the index $i$ labels the color:
\begin{equation}
	\begin{tabular}{c c c}
		\hline
		Index & Color & Simbol \\ \hline
		1 & red & $r$ \\
		2 & green & $g$ \\
		3 & yellow & $y$ \\
		\hline
	\end{tabular}
\end{equation}
Since the total color is conserved in the scattering process, we can divide the color degrees of freedom to the singlet and octet, corresponding to
\begin{equation}
	3\otimes \bar 3 = 1 \otimes 8.
\end{equation}
The singlet states is
\begin{equation}
	|s\rangle = \frac{1}{\sqrt 3} \left(|r\bar r\rangle + |g\bar g\rangle + |y\bar y\rangle\right)
\end{equation}
The factor then becomes
\begin{equation}
	\left(\frac{1}{\sqrt{3}} \right)^2 (T^aT^a)_{jl} = \frac{4}{9} \delta_{jl}.
\end{equation}
For the octet state $|r \bar y\rangle$
\begin{equation}
	T^a_{i1} T^a_{3l} = -\frac{1}{6} \delta_{i1}\delta_{l3}.
\end{equation}
In QED, we know that two particle with opposite charge are attractive to each other.
From the factors above, we know that color singlet channel is attractive while the color octet channel is repulsive.
Indeed, in QCD there is phenomenon named \textit{color confinement}, which means quarks tend to form composite colorless bound state.

\subsection{Gauge Group of the Standard Model}

The standard model has $\mathrm{SU(3)}\times\mathrm{SU(2)}\times\mathrm{U(1)}$ gauge symmetry.
For a general field $\phi_{iI}$, where $i$ labels the electroweak degrees of freedom and $I$ labels the color degrees of freedom.
The covariant derivative for $\phi_{iI}$ is then
\begin{equation}
	D_\mu = \partial_\mu -i \left(g_1 B_\mu Y + g_2 W^a_\mu T^a_{2} + g_3 A_\mu^b T^b_3                                                  \right),
\end{equation}
where the operator $Y$, $T_2^a$ and $T_3^b$ is depend on the representation of U(1), SU(2) and SU(3) groups respectively.

The weak interaction only involve left-handed spinor, so the largest fermion sector is
\begin{equation}
	Q_I = \left[
		\begin{pmatrix} u_L \\ d_L \end{pmatrix}
		\begin{pmatrix} c_L \\ s_L \end{pmatrix}
		\begin{pmatrix} t_L \\ b_L \end{pmatrix}
	\right]_I.
\end{equation}
Each $Q_I$ is in the $\left(3,2,\frac{1}{6}\right)$ representation, where $3$ is the fundamental representation of SU(3), $2$ is the fundamental representation of SU(2), and $\frac{1}{6}$ is the hypercharge of the U(1) gauge group.
For example the sector of first generation left-handed quarks are
\begin{equation}
	Q_1 = \begin{bmatrix}
		u_L^r & u_L^g & u_L^y \\ d_L^r & d_L^g & d_L^y
	\end{bmatrix}.
\end{equation}
Note that the electric charge satisfies
\begin{equation}
	q = I_3 + Y,
\end{equation}
where $I_3$ is the z-component of the isospin.

Besides, the left-handed leptons also involves the weak interaction but not the strong interaction
\begin{equation}
	L_I = \left[
		\begin{pmatrix} \nu_{e L} \\ e_L \end{pmatrix}
		\begin{pmatrix} \nu_{\mu L} \\ \mu_L \end{pmatrix}
		\begin{pmatrix} \nu_{\tau L} \\ \tau_L \end{pmatrix}
	\right]_I,
\end{equation}
and thus each $L_I$ is in the $\left(1,2,\frac{1}{2}\right)$ representation.

The right-handed quarks form $\left(3,1,\frac{2}{3}\right)$ and $\left(3,1,-\frac{1}{3}\right)$ representations, the right-handed electrons/muons/tauons form $\left(1,1,-1\right)$ representations, and the right-handed neutrinos form trivial $\left(1,1,0\right)$ representations.

In addition to the fermion, there is also a scalar Higgs field in the representation $\left(1,2,\frac{1}{2}\right)$.
Together, we say that the standard model contains the representations (only fermions in the first generation are listed):
\begin{equation}
\begin{tabular}{c|c|c}
\hline \hline
\multicolumn{2}{c|}{Particles} & Representation\tabularnewline
\hline
\multirow{3}{*}{Quarks} & $Q_{1}$ & $(3,2,1/6)$\tabularnewline
 & $u_{R}$ & $(3,1,2/3)$\tabularnewline
 & $d_{R}$ & $(3,1,-1/3)$\tabularnewline
\hline
\multirow{3}{*}{Leptons} & $L_{1}$ & $(1,2,-1/2)$\tabularnewline
 & $e_{R}$ & $(1,1,-1)$\tabularnewline
 & $\nu_{eR}$ & $(1,1,0)$\tabularnewline
\hline
Higgs & $\varphi$ & $(1,2,1/2)$\tabularnewline
\hline \hline
\end{tabular}
\end{equation}

\section{Lagrangian of the Standard Model}

\subsection{Electroweak Symmetry Breaking}
Beside the quarks, leptons and gauge bosons, a doublet scalar field (Higgs) is also introduced in order to generate mass for the particles:
\begin{equation}
	\varphi \equiv \left[\begin{array}{c}
		\varphi_1 \\ \varphi_2
	\end{array} \right],
\end{equation}
which is also an isospin doublet with hyperchage $Y=\frac{1}{2}I$:
\begin{equation}
	\begin{tabular}{c c c c}
		\hline
		Field & $I_3$ & $Y$ & $q$\\ \hline
		$\varphi_1$ & $1/2$ & $1/2$ & $1$ \\
		$\varphi_2$ & $-1/2$ & $1/2$ & $0$ \\
		\hline
	\end{tabular}
\end{equation}

The Lagrangian of the Higgs field is
\begin{equation}\label{eq:SM-Higgs-L1}
	\mathcal L = -\frac{1}{4}(W^a_{\mu\nu})^2 - \frac{1}{4}B_{\mu\nu}^2 +(D^\mu \varphi)^\dagger D_\mu \varphi- V(\varphi),
\end{equation}
where the field strength tensors are
\begin{equation}
\begin{aligned}
	W^a_{\mu\nu} &= \partial_\mu W_\nu^1 - \partial_\nu W^1_\mu + g_2 (W_\mu^2 W_\nu^3 - W_\mu^3 W_\nu^2), \\
	W^a_{\mu\nu} &= \partial_\mu W_\nu^1 - \partial_\nu W^1_\mu + g_2 (W_\mu^3 W_\nu^1 - W_\mu^1 W_\nu^3), \\
	W^a_{\mu\nu} &= \partial_\mu W_\nu^1 - \partial_\nu W^1_\mu + g_2 (W_\mu^1 W_\nu^2 - W_\mu^2 W_\nu^1), \\
	B^a_{\mu\nu} &= \partial_\mu B_\nu^1 - \partial_\nu B^1_\mu,
\end{aligned}
\end{equation}
and the Higgs interaction is
\begin{equation}
	V(\varphi) = \frac{\lambda}{4} \left(\varphi^\dagger \varphi - \frac{v^2}{2} \right)^2.
\end{equation}
This potential gives $\varphi$ a nonzero vacuum expectation value (VEV).
We can make a gauge transformation so that
\begin{equation}
	\varphi_0 = \langle 0| \varphi |0\rangle = \frac{v}{\sqrt 2} \left[\begin{array}{c}
		0 \\ 1	\end{array} \right].
\end{equation}

The kinetic Lagrangian is described by the SU(2) gauge-invariant Lagrangian
\begin{equation}
	\mathcal L_{\mathrm{kin}} = (D^\mu \varphi)^\dagger D_\mu \varphi,
\end{equation}
where the covariant derivative is
\begin{equation}
	D_\mu = \partial_\mu -i \left(g_1 B_\mu Y + g_2 W^a_\mu T_2^a\right).
\end{equation}
We can introducing the Weinberg angle
\begin{equation}
	\theta_W \equiv\arctan \frac{g_1}{g_2},
\end{equation}
and the fields
\begin{equation}
\begin{aligned}
	W_\mu^\pm &\equiv \frac{1}{\sqrt 2}(W^1_\mu \mp i A_\mu^2), \\
	Z_\mu &\equiv \cos{\theta_W} W^3_\mu - \sin{\theta_W} B_\mu, \\
	A_\mu &\equiv \sin{\theta_W} W_\mu^3 + \cos{\theta_W} B_\mu.
\end{aligned}
\end{equation}
The reverse transformation for $W_\mu^3$ and $B_\mu$ is
\begin{equation}
\begin{aligned}
	W_\mu^3 &= \cos{\theta_W} Z_\mu + \sin{\theta_W} A_\mu, \\
	B_\mu &= -\sin{\theta_W} Z_\mu +\cos{\theta_W} A_\mu.
\end{aligned}
\end{equation}
The off-diagonal part of the Lie algebra becomes
\begin{equation}
	\frac{1}{\sqrt 2}\begin{bmatrix}
		0 &  W^+_\mu \\
		W_\mu^- & 0
	\end{bmatrix},
\end{equation}
and the diagonal part becomes
\begin{equation}
\begin{aligned}
	g_2 W_\mu^3 T^z_2 + g_1 B_\mu Y
	&= g_2 (\cos{\theta_W} Z_\mu + \sin{\theta_W} A_\mu) T^3_2 + g_1 Y (-\sin{\theta_W} Z_\mu +\cos{\theta_W} A_\mu) \\
	&= g_2 \cos{\theta_W} A_\mu \left(T^3_2 + Y\right) + eZ_\mu \left(\cot{\theta_W}T_2^3 - \tan{\theta_W}Y \right) \\
	&= e A_\mu q + \frac{e}{\sin{\theta_W}\cos{\theta_W}} Z_\mu \left(\cos^2{\theta_W}T_2^3 - \sin^2{\theta_W} Y\right) \\
	&= e A_\mu q + \frac{e}{\sin{\theta_W}\cos{\theta_W}} Z_\mu \left(T_2^3 - \sin^2{\theta_W} q\right).
\end{aligned}
\end{equation}
Note that the gauge field $A_\mu$ describe QED, so we identify the coupling constant with the electric charge:
\begin{equation}
	e = g_2 \sin{\theta_W} = g_1 \cos{\theta_W}.
\end{equation}

For Higgs field,
\begin{equation}
	T^3_2 = \frac{1}{2}\sigma^z, \quad
	Y = \frac{1}{2} I,\quad
	q = \begin{bmatrix}
		1 & 0 \\ 0 & 0
	\end{bmatrix}.
\end{equation}
$T^3_2 = \frac{1}{2}\sigma^z$, $Y=\frac{1}{2}I$, so
With the new definition of the field, the Lie algebra of becomes
\begin{equation}
\begin{aligned}
	g_2 W^a_\mu T_2^a + g_1 B_\mu Y
	&= \frac{e}{2 \sin{\theta_W}}
	\begin{bmatrix}
		2\sin{\theta_W} A_\mu + \frac{\cos{2\theta_W}}{\cos{\theta_W}} Z_\mu & \sqrt{2} W^+_\mu \\
		\sqrt{2} W_\mu^- & \frac{1}{\cos{\theta_W}} Z_\mu
	\end{bmatrix}.
\end{aligned}
\end{equation}
We can now expand the kinetic term to get the effective mass of the the gauge field in unitary gauge.
The mass term is the quadratic part of $\varphi$:
\begin{equation}
\begin{aligned}
	\mathcal L_{\mathrm{mass}}
	&= \varphi_0^\dagger \left(g_2 W^a_\mu T_2^a + g_1 B_\mu Y\right)^2 \varphi_0 \\
	&= \frac{e^2v^2}{8 \sin^2{\theta_W}}
	\begin{bmatrix}
		0 & 1
	\end{bmatrix}
	\begin{bmatrix}
		\cdots & \sqrt{2} W^+_\mu \\
		\sqrt{2} W_\mu^- & \frac{1}{\cos{\theta_W}} Z_\mu
	\end{bmatrix}^2
	\begin{bmatrix}
		0 \\ 1
	\end{bmatrix} \\
	&= m_W W^{+\mu} W_\mu^- + \frac{1}{2}m_Z^2 Z^\mu Z_\mu,
\end{aligned}
\end{equation}
where the mass for $W$ and $Z$ bosons are
\begin{equation}
	m_W = \frac{ev}{2 \sin{\theta_W}}, \quad
	m_Z = \frac{e v}{2\sin{\theta_W}\cos{\theta_W}} = \frac{m_W}{\cos{\theta_W}}.
\end{equation}
Note that the photon field $A_\mu$ does not obtain mass from the Higgs field.

\subsection{Higgs-Gauge Sector}
We are now going to express the Lagrangian (\ref{eq:SM-Higgs-L1}) in terms of the fields we have just introduced.
In the unitary gauge, the Higgs field can be written as
\begin{equation}
	\varphi = \frac{1}{\sqrt 2} \begin{bmatrix}
		v + H(x) \\ 0
	\end{bmatrix},
\end{equation}
where $H(x)$ is a real scalar field.
The interaction terms gives
\begin{equation}
\begin{aligned}
	V(H) &= \frac{\lambda v^2}{4} H^2 + \frac{\lambda v}{4}H^3 + \frac{\lambda}{16}H^4 \\
	&= \frac{1}{2}m_H^2 H^2 + \frac{m_H^2}{2v} H^3 + \frac{m_H^2}{8v^2}H^4,
\end{aligned}
\end{equation}
where we have defined the Higgs mass
\begin{equation}
	m_H^2 = \frac{\lambda v^2}{2}.
\end{equation}
Also, the fluctuation around the $\varphi_0$ also create coupling between Higgs field and the gauge fields.
We can simply replace $v^2$ with $(v+H)^2$ in the gauge field mass term to capture the coupling.
Thus, the Lagrangian is
\begin{equation}
	\mathcal L_{\mathrm{H}} = \partial^\mu H^\dagger \partial_\mu H - V(H) + \left(m_W W^{+\mu} W_\mu^- + \frac{1}{2}m_Z^2 Z^\mu Z_\mu \right) \left(H^2+2vH \right).
\end{equation}
Now consider the Lagrangian for the gauge field
\begin{equation}
	\mathcal L_{\mathrm{G}} = -\frac{1}{4}(W^a_{\mu\nu})^2 - \frac{1}{4}B_{\mu\nu}^2 + m_W W^{+\mu} W_\mu^- + \frac{1}{2}m_Z^2 Z^\mu Z_\mu.
\end{equation}
We can regroup the field strength as
\begin{equation}
\begin{aligned}
	W^+_{\mu\nu} &= D_\mu W_\nu^+ - D_\nu W^+_\mu, \\
	W^-_{\mu\nu} &= D_\mu^\dagger W_\nu^- - D_\nu^\dagger W^-_\mu, \\
	W^3_{\mu\nu} &= \sin{\theta_W} F_{\mu\nu} + \cos{\theta_W}Z_{\mu\nu} -ig_2(W^+_\mu W^-_\nu - W_\mu^- W_\nu^+), \\
	B^a_{\mu\nu} &= \cos{\theta_W} F_{\mu\nu} - \sin{\theta_W} Z_{\mu\nu},
\end{aligned}
\end{equation}
where we have defined
\begin{equation}
\begin{aligned}
	W^\pm_{\mu\nu} &= \frac{1}{\sqrt 2} (W^1_{\mu\nu} \mp i W^2_{\mu\nu}), \\
	F_{\mu\nu} &= \partial_\mu A_\nu - \partial_\nu A_\mu, \\
	Z_{\mu\nu} &= \partial_\mu Z_\nu - \partial_\nu Z_\mu.
\end{aligned}
\end{equation}
The covariant derivative for $W^\pm$ field is
\begin{equation}
\begin{aligned}
	D_\mu &= \partial_\mu -i g_2 W^3_\mu \\
	&= \partial_\mu -i g_2 \left(\sin{\theta_W}A_\mu + \cos{\theta_W} Z_\mu \right) \\
	&= \partial_\mu -i e \left(A_\mu + \cot{\theta_W} Z_\mu \right)
\end{aligned}
\end{equation}
So the Lagrangian for the gauge field is
\begin{equation}
\begin{aligned}
	\mathcal L_\mathrm{G}
	=&\ -\frac{1}{4}(2W_{\mu\nu}^+ W^{-\mu\nu} + W_{\mu\nu}^3 W^{3\mu\nu}) -\frac{1}{4} B_{\mu\nu}B^{\mu\nu} + m_W W^{+\mu} W_\mu^- + \frac{1}{2}m_Z^2 Z^\mu Z_\mu \\
	=&\ -\frac{1}{4}(F_{\mu\nu}F^{\mu\nu} + Z_{\mu\nu} Z^{\mu\nu}) - D^{\mu} W^{+\nu} D^\dagger_\mu W_\nu^- + D^\mu W^{+\nu} D^\dagger_\nu W^-_\mu \\
	&\ +ie (F^{\mu\nu} + \cot{\theta_W} Z^{\mu\nu})W_\mu^+ W_\nu^- + m_W W^{+\mu} W_\mu^- + \frac{1}{2}m_Z^2 Z^\mu Z_\mu \\
	&\ -\frac{e^2}{2\sin^2{\theta_W}} \left(W^{+\mu}W^-_\mu W^{+\nu}W^-_\nu - W^{+\mu}W^+_\mu W^{-\nu}W^-_\nu \right).
\end{aligned}
\end{equation}
We remark that in the unitary gauge, there is no redundancy of the gauge field.
No ghost field is needed in the quantization procedure.

\subsection{Yukawa Coupling and Fermion Mass}
The fermion fields in the electroweak interaction
\begin{equation}
	\begin{tabular}{c c c c}
		\hline
		Field & $I_3$ & $Y$ & $q$\\ \hline
		$u_L$ & $1/2$ & $1/6$ & $2/3$ \\
		$d_L$ & $-1/2$ & $1/6$ & $-1/3$ \\
		$u_R$ & $0$ & $2/3$ & $2/3$ \\
		$d_R$ & $0$ & $-1/3$ & $-1/3$ \\ \hline
		$e_L$ & $-1/2$ & $-1/2$ & $-1$ \\
		$\nu_{eL}$ & $1/2$ & $-1/2$ & $0$ \\
		$e_R$ & $0$ & $-1$ & $-1$ \\
		$\nu_{eR}$ & $0$ & $0$ & $0$ \\
		\hline
	\end{tabular}
\end{equation}

The kinetic term for the fermion Lagrangian is
\begin{equation}
\begin{aligned}
	\mathcal L_{\mathrm{kin}}
	=&\ i Q^\dagger_J \sigma^\mu D_\mu Q_J + i u_{RJ}^\dagger \bar\sigma^\mu D_\mu u_{RJ} + i d_{RJ}^\dagger \bar\sigma^\mu D_\mu d_{RJ} \\
	& + i L^\dagger_J \sigma^\mu D_\mu L_J + i e_{RJ}^\dagger \bar\sigma^\mu D_\mu e_{RJ} + i \nu_{RJ}^\dagger \bar\sigma^\mu D_\mu \nu_{RJ},
\end{aligned}
\end{equation}
where we have use the index $J$ to label the generation of the fermion:
\begin{equation}
\begin{aligned}
	u_{RJ} &= \{u_R, c_R, t_R\}, &
	d_{RJ} &= \{d_R, s_R, b_R\}, \\
	e_{RJ} &= \{e_R, \mu_R, \tau_R\}, &
	\nu_{RJ} &= \{\nu_{eR},\nu_{\mu R},\nu_{\tau R}\}.
\end{aligned}
\end{equation}

The left-handed SU(2) gauge symmetry forbid any fermion mass term, which is incompatible with the reality.
However, fermion can obtain fermion mass by introducing Yukawa coupling between the Higgs and fermion fields.

\subsubsection{Quark Sector}
The Yukawa coupling between quark and Higgs is
\begin{equation}
	\mathcal L_{q,\mathrm{Yuk}}
	= - \varepsilon^{ij} Y^u_{IJ} Q^\dagger_{iI} \varphi^\dagger_j u_{RJ}
	- Y^d_{IJ} Q^\dagger_{I} \varphi d_{RJ} +h.c..
\end{equation}
The first term corresponds to
\begin{equation}
	\left(\bar 3, \bar 2, -\frac{1}{6}\right) \times \left(1, \bar 2, -\frac{1}{2}\right) \times \left(3, 1, \frac{2}{3}\right) = \left(1,1,0\right)\oplus \cdots,
\end{equation}
with $\varepsilon^{ij}$ being the Clebsch-Gordan coefficient, and the second term corresponds to
\begin{equation}
	\left(\bar 3, \bar 2, -\frac{1}{6}\right) \times \left(1, 2, \frac{1}{2}\right) \times \left(3, 1, -\frac{1}{3}\right) = \left(1,1,0\right).
\end{equation}
Now substitute $\varphi$ with
\begin{equation}
	\varphi = \frac{1}{\sqrt 2} \begin{bmatrix}
		0 \\ v+H
	\end{bmatrix}.
\end{equation}
The Yukawa potential then gives quark mass term:
\begin{equation}
	\mathcal L_{Q,\mathrm{Yuk}}
	= -\frac{v+H}{\sqrt 2} \left( Y^u_{IJ} u^\dagger_{LI} u_{RJ} +Y^d_{IJ} d^\dagger_{LI} d_{RJ} \right) +h.c..
\end{equation}
We can then use a basis transformation (singular value decomposition) to diagonalize the coupling matrix:
\begin{equation}
	Y^u_{IJ} = U_u M_u K^\dagger_u, \quad
	Y^d_{IJ} = U_d M_d K^\dagger_d,
\end{equation}
where $M_u$ and $M_d$ are diagonal matrices.
We can change the basis
\begin{equation}
\begin{aligned}
	u_L &\rightarrow U_u u_L, & u_R &\rightarrow K_u u_R, \\
	d_L &\rightarrow U_d d_L, & d_R &\rightarrow K_d d_R,
\end{aligned}
\end{equation}
and define the diagonal masses:
\begin{equation}
	m_{u_I} = \frac{v}{\sqrt 2} (M_u)_{II}, \quad
	m_{d_I} = \frac{v}{\sqrt 2} (M_d)_{II},
\end{equation}
then the Lagrangian in the quark sector can be expressed as:
\begin{equation}
\begin{aligned}
	\mathcal L_Q =&\ \sum_I \bar u_I\left(i\cancel D^c-m_{u_I}\right)u_I + \sum_I \bar d_I \left(i \cancel D^c-m_{d_I}\right)d_I \\
	& -\frac{H}{v} \sum_I\left(m_{u_I}\bar u_I u_I+m_{d_I}\bar d_I d_I \right) + \mathcal L_{Q-G},
\end{aligned}
\end{equation}
where $\cancel D^c$ is the covariant derivative in QCD (neglecting the electroweak gauge), and $\mathcal L_{Q-G}$ denotes the coupling between quarks and the gauge fields.

\subsubsection{Lepton Sector}
The coupling between Higgs and $e_R$ has the general Yukawa form:
\begin{equation}
	\mathcal L_{e,\mathrm{Yuk}} = -Y^e_{IJ} L_{iI}^\dagger \varphi_j e_{R iJ} + h.c.,
\end{equation}
where $y_{IJ}$ is the Hermitian coupling matrix on generation space.
The Yukawa coupling term corresponds to
\begin{equation}
	\left(\bar 2, \frac{1}{2}\right) \times \left(2, \frac{1}{2}\right) \times \left(1, -1\right) = \left(1,0\right),
\end{equation}
which is indeed a singlet under gauge transformation (it is also a singlet under Lorentz transformation).
The Higgs field then produce the term
\begin{equation}
	\mathcal L_{e,\mathrm{Yuk}} = -\frac{Y^e_{IJ}}{\sqrt 2}(v+H) e_{LI}^\dagger e_{RJ} + h.c.,
\end{equation}
We then diagonalize the coupling matrix:
\begin{equation}
	 Y^e_{IJ} = \left[U_{e} M_e K^\dagger_{e}\right]_{IJ},
\end{equation}
where $M_e$ is diagonal.
We can then change the basis by
\begin{equation}
\begin{aligned}
	e_R &\rightarrow K_e e_R, \\
	e_L &\rightarrow U_e e_L,
\end{aligned}
\end{equation}
Then the coupling gives the mass:
\begin{equation}
	\mathcal L_{e,\mathrm{Yuk}}
	= - \sum_I m_{e_I} \bar e_I e_I - \frac{1}{v}\sum_I m_{e_I} H \bar e_I e_I,
\end{equation}
where
\begin{equation}
	m_{e_I} = \frac{v}{\sqrt 2} (M_e)_{II}.
\end{equation}

Now we consider the neutrino mass, which is much smaller than electrons.
The neutrinos can similarly obtain mass by coupling to Higgs field.
However, as there is no gauge symmetry constraint on neutrinos, the Yukawa coupling can be
\begin{equation}
	\mathcal L_{\nu,\mathrm{Yuk}} = - Y^\nu_{IJ} \varepsilon^{ij} L_{iI} \varphi_j \nu_{RJ} - \frac{1}{2} M_{IJ} \nu_{RI} \nu_{RJ} + h.c..
\end{equation}
The first term corresponds to
\begin{equation}
	\left(2, -\frac{1}{2}\right) \times \left(2, \frac{1}{2}\right) \times \left(1, 0\right) = \left(1,0\right) \oplus(3,0),
\end{equation}
and $\varepsilon^{ij}$ is the Clebsch-Gordan coefficients.
The second term is automatically a gauge singlet.
We note here that the left-handed neutrino do not participate in any interaction, so we can neglect it in the standard model.
The only role it plays is to generate neutrino mass.

The Yukawa potential gives
\begin{equation}
	\mathcal L_{\nu,\mathrm{mass}} = -\frac{1}{2}
	\begin{bmatrix}
		\nu_L & \nu_R
	\end{bmatrix}
	\begin{bmatrix}
		0 & Y^\nu \\ Y^{\nu\dagger} & M
	\end{bmatrix}
	\begin{bmatrix}
		\nu_L \\ \nu_R
	\end{bmatrix}.
\end{equation}
If $M \gg m$, the eigenvalues of the mass term will be a huge masses plus some tiny masses.
In general, the low-energy part of the mass term is
\begin{equation}
	\mathcal L_{\nu,\mathrm{mass}} = -\frac{1}{2} (M_\nu)_{IJ} \left(\nu_{LI} \nu_{LJ} + \nu_{LI}^\dagger \nu_{LJ}^\dagger\right)\left(1+\frac{H}{v}\right)^2,
\end{equation}
where
\begin{equation}
	(M_\nu)_{IJ} = \frac{v^2}{2} \left(Y^{\nu T} M^{-1} Y \right)_{IJ}.
\end{equation}
We can also diagonalize the matrix $M_\nu$ by a unitary matrix $U_\nu$, corresponding to
\begin{equation}
	\nu_L \rightarrow U_\nu \nu_L.
\end{equation}

With the discussion above, we can write down the Lagrangian in the lepton sector:
\begin{equation}
\begin{aligned}
	\mathcal L_L =&\ \sum_I \bar e_I (i\cancel\partial-m_{e_I})e_I + \sum_I \left[i\nu_{LI}^\dagger \bar\sigma^\mu \partial_\mu \nu_{LI} - \frac{1}{2}m_{\nu_I} \left(\nu_L \nu_L + \nu_L^\dagger \nu_L^\dagger\right)\right] \\
	& -\frac{H}{v} \sum_I \left(m_{e_I} \bar e_I e_I + m_{\nu_I}\bar\nu_{LI}\nu_{LI}\right)+ \mathcal L_{L-G},
\end{aligned}
\end{equation}
where $\mathcal L_{L-G}$ is the lepton-gauge coupling term.

\subsection{Gauge-Current Coupling}
Using the formula
\begin{equation}
\begin{aligned}
	g_2 \sum_{a=1}^2 W^a_\mu T^a_2 &= \frac{e}{\sqrt{2}\sin{\theta_W}}\begin{bmatrix}
		0 & W_\mu^+ \\ W_\mu^- & 0
	\end{bmatrix}, \\
	g_2 W_\mu^3 T^z_2 + g_1 B_\mu Y
	&= e A_\mu q + \frac{e}{\sin{\theta_W}\cos{\theta_W}} Z_\mu \left(T_2^3 - \sin^2{\theta_W} q\right).
\end{aligned}
\end{equation}
The coupling terms $\mathcal L_{Q-G}$ and $\mathcal L_{L-G}$ are then of the form:
\begin{equation}
\begin{aligned}
	\mathcal L_{Q-G} &= \frac{e}{\sqrt{2}\sin{\theta_W}} \left(W^{+}_\mu J_Q^{-\mu} + W^{-}_\mu J_Q^{+\mu} \right) + e A_\mu J^{\mu}_{\mathrm{EM},Q} + \frac{e}{\sin{\theta_W}\cos{\theta_W}} Z_\mu J^\mu_{z,Q}, \\
	\mathcal L_{L-G} &= \frac{e}{\sqrt{2}\sin{\theta_W}}\left(W^{+}_\mu J_L^{-\mu} + W^{-}_\mu J_L^{+\mu} \right) + e A_\mu J^{\mu}_{\mathrm{EM},L} + \frac{e}{\sin{\theta_W}\cos{\theta_W}} Z_\mu J^\mu_{z,L}.
\end{aligned}
\end{equation}
Note that the off-diagonal current $J^\pm$ will change under the basis transformation $U_{IJ}$, i.e., the transformation mixes different generations:
\begin{equation}
\begin{aligned}
	J^{-\mu}_Q &= (V_Q)_{IJ} u_{LI}^\dagger \bar\sigma^\mu d_{LJ}, \\
	J^{+\mu}_Q &= (V^\dagger_Q)_{IJ} d_{LI}^\dagger \bar\sigma^\mu u_{LJ}, \\
	J^{-\mu}_L &= (V_L)_{IJ} \nu_{LI}^\dagger \bar\sigma^\mu e_{LJ}, \\
	J^{+\mu}_L &= (V^\dagger_L)_{IJ} e_{LI}^\dagger \bar\sigma^\mu \nu_{LJ},
\end{aligned}
\end{equation}
where the mixing matrices are defined as
\begin{equation}
	V_Q \equiv U^\dagger_u U_d, \quad
	V_L \equiv U_\nu^\dagger U_e.
\end{equation}

The diagonal part is invariant under the basis transformation:
\begin{equation}
\begin{aligned}
	J^\mu_{\mathrm{EM},Q} &= \frac{2}{3} u_{LI}^\dagger \bar\sigma^\mu u_{LI} - \frac{1}{3} d_{LI}^\dagger \bar\sigma^\mu d_{LI} \\
	J^\mu_{\mathrm{EM},L} &= - e_{LI}^\dagger \bar\sigma^\mu e_{LI} \\
	J_{z,Q}^\mu &= \frac{1}{2} u_{LI}^\dagger \bar\sigma^\mu u_{LI} - \frac{1}{2} d_{LI}^\dagger \bar\sigma^\mu d_{LI} J^\mu_3-\sin^2{\theta_W}J_{\mathrm{EM},Q}^\mu, \\
	J_{z,L}^\mu &= \frac{1}{2} \nu_{LI}^\dagger \bar\sigma^\mu \nu_{LI} - \frac{1}{2} e_{LI}^\dagger \bar\sigma^\mu e_{LI} J^\mu_3-\sin^2{\theta_W}J_{\mathrm{EM},L}^\mu.
\end{aligned}
\end{equation}

Finally, we can sum over the current, and write down the total fermion-gauge coupling:
\begin{equation}
	\mathcal L_{F-G} = \frac{e}{\sqrt{2}\sin{\theta_W}} \left(W^{+}_\mu J^{-\mu} + W^{-}_\mu J^{+\mu} \right) + e A_\mu J^{\mu}_{\mathrm{EM}} + \frac{e}{\sin{\theta_W}\cos{\theta_W}} Z_\mu J^\mu_{z}.
\end{equation}
From the current-gauge coupling, we can recover the effective 4-fermion theory by integrating out the gauge field.
In the low energy regime ($p^2 \ll m_W^2$), the vertex function for electron decay is:
\begin{equation}
	2\left(\frac{e}{\sqrt{2}\sin{\theta_W}} \right)^2 J^+_\mu \frac{g^{\mu\nu}}{p^2-m_W^2} J^-_\nu
	\simeq \frac{e^2}{m_W^2 \sin^2{\theta_W}} J^{+\mu} J^-_\mu.
\end{equation}
The diagonal part of the vertex is
\begin{equation}
	\left(\frac{e}{\sin{\theta_W}\cos{\theta_W}} \right)^2 J^z_\mu \frac{g^{\mu\nu}}{p^2-m_Z^2} J^z_\nu
	\simeq -\frac{e^2}{m_Z^2 \sin^2{\theta_W}\cos^2{\theta_W}} J^{z\mu} J^z_\mu.
\end{equation}\
Note that $m_Z^2\cos^2{\theta_W} = m_W^2$, we can then identify the fermion constant
\begin{equation}
	\frac{4G_F}{\sqrt 2} = -\frac{e^2}{m_W^2 \sin^2{\theta_W}},
\end{equation}
and the 4-Fermion vertex is
\begin{equation}
	\mathcal L_{4F} = -\frac{4G_F}{\sqrt 2} \left(J^{+\mu} J_\mu^- + J^{z\mu} J_\mu^z \right).
\end{equation}


\chapter{$B>oHyJ,J}Dx<0(B}
\section{$B>oHyJ,J}Dx<0$N0lHL7A(B}
$B>oHyJ,J}Dx<0$H$O!"FHN)JQ?t$,(B1$B$D$NHyJ,J}Dx<0$G!"(B$n$$B3,$N0lHLE*$JHyJ,J}Dx<0(B
$B$O!"<!$N$h$&$K=q$1$k!#(B
\begin{equation}
 a_1\frac{du}{dx} + a_2\frac{d^2u}{dx^2} + \cdot + a_n\frac{d^nu}{dx^n}
  = f(x).
\end{equation}

$B0l3,$NF1<!J}Dx<0$K$D$$$F$OJQ?tJ,N%K!$r;H$C$F4JC1$K2r$1$k!#:#!"HyJ,J}Dx<0(B
$B$,0l<!$N6a;w$K$h$C$F@.N)$7$F$$$k$H$$$&2>Dj$r$9$k$H!"(B$du/dx=f(x)$$B$O<!$N$h(B
$B$&$K=q$-49$($i$l$k!#(B
\begin{equation}
 du = f(x)dx.
\end{equation}
$B$3$l$O!"(B$u$$B$N(B$x$$B$K$h$kHyJ,$O5i?tE83+$K$h$j<!$N$h$&$KI=$5$l$k$H$-!"(B
\begin{equation}
 \phi(x+dx) = \phi(x) + \left.\frac{d\phi}{dx}\right|_{x}dx + O(dx^2),
\end{equation}
$BFs<!0J9_$N9`$rL5;k$7$F!"(B$x$$B$G$N(B$\phi$$B$NHyJ,$O!"(B$\phi$$B$NL58B>.JQ2=$O(B
$d\phi=\phi(d+dx)-\phi(x)$$B$G$"$k$H2>Dj$9$k$H!"(B
\begin{equation}
 d\phi = \frac{d\phi}{dx}dx,
\end{equation}
$B$G$"$k$H$$$&2>Dj$K$h$k!#$3$l$K$h$j!"0l3,$NF1<!J}Dx<0$O!"<!$N$h$&$J@QJ,$K(B
$B$h$j2r$rF@$i$l$k!#(B
\begin{equation}
 u = \int dx\mspace{5mu}f(x).
\end{equation}

$B<!$K!"0l3,$N8GM-CMLdBj$K$D$$$F9M$($k!#0lHV4JC1$J7A$H$7$F!"(B
\begin{equation}
 u_x + au = 0,
\end{equation}
$B$r9M$($k!#$3$N$H$-!"(B$a$$B$OG$0U$N?t$@$,!"(B$u$$B$N4X?t$G$O$J$$$H$9$k!#$3$l$rJQ(B
$B?tJ,N%$9$k$H!"@QJ,Dj?t(B$C$$B$rMQ$$$F!"(B
\begin{equation}
 u = Ce^{-\int dx\mspace{5mu}a},
\end{equation}
$B$,F@$i$l$k!#(B

$B<!$K!"HsF1<!$N>l9g$N0l3,$NJ}Dx<0$r9M$($k!#(B
\begin{equation}
 u_x + au = f(x).
\end{equation}
$B$3$3$G!"$3$NJ}Dx<0$NFC2r$O!"F1<!<0$N2r$G$"$k!#HsF1<!9`(B$f(x)$$B$,(B0$B$N$h$&$J(B
$B>l9g$K$O!"J}Dx<0$N2r$OF1<!J}Dx<0$N2r$H$J$k!#$=$3$G!"HsF1<!9`$,(B0$B$G$J$$$H(B
$B$-$O!"F1<!J}Dx<0$N@QJ,Dj?t$O(B$x$$B$N4X?t$G$"$k$H$$$&F6;!$+$i!"0lHL2r$r(B
$C(x)\exp(\int dx\mspace{5mu}\phi(x))$$B$H$9$k!#$3$l$rHsF1<!J}Dx<0$KBeF~$9(B
$B$k$3$H$G!":G=*E*$K$O(B$C$$B$K$D$$$F$NHyJ,J}Dx<0$,F@$i$l$k!#$3$l$K$h$j!"HsF1(B
$B<!J}Dx<0$N0lHL2r$O!"(B
\begin{equation}
 u =
  \left(\int dx\mspace{5mu}f(x)e^{-\int dx\mspace{5mu}a} + b\right)
  e^{-\int dx\mspace{5mu}a}
\end{equation}
$B$H$J$k!#(B

$B<!$K!"(B$n$$B<!$NJ}Dx<0$r9M$($k!#(B$n$$B<!$NHyJ,J}Dx<0$O(B$n$$B$3$N3,$r$b$A!"$=$N0l(B
$BHL2r$O$=$l$i$N3,$N@~7AOB$G!"(B
\begin{equation}
 u = \sum_{i=1}^n a_iu_i,
\end{equation}
$B$N$h$&$KM?$($i$l$k!#(B

$B:#!"$3$N3,$N@~7AFHN)@-$r9M$($k$?$a$K!"$3$l$i$N2r$,@~7A=>B0$J>l9g$r9M$($k!#(B
$B$=$N>l9g$O!"(B
\begin{equation}
  \sum_{i=1}^n a_iu_i = 0,
\end{equation}
$B$N$h$&$K!"(B$n$$BHVL\$N2r$,$=$NB>$N3,$N@~7AOB$GI=$5$l$k!#$=$7$F!"$3$l$O(B$n-1$
$B2q$OHyJ,$G$-$k$O$:$G$"$j!"(B
\begin{equation}
 \sum_{i=1}^n a_iu^{(i)}_i = 0,
\end{equation}
$B$G$"$k!#(B

$B$3$N4X78$K$h$j!"78?t(B$a_i$$B$O!"<!$N$h$&$J9TNsJ}Dx<0$N2r$H$7$F5a$a$k$3$H$,(B
$B=PMh$k!#(B
\begin{equation}
 \begin{pmatrix}
  u_1 &  u_2  & \cdots & u_n \\
  u'_1 & u'_2 & \cdots & u'_n \\
  \vdots & \vdots & \ddots& \vdots \\
  u^{(n-1)}_1 & u^{(n-1)}_2 & \cdots & u^{(n-1)}_n
 \end{pmatrix}
 \begin{pmatrix}
  a_1 \\ a_2 \\ \vdots \\ a_n
 \end{pmatrix}
 = 0.
\end{equation}
$B$3$N$H$-!"$3$N9TNs$N9TNs<0$,(B0$B$N$H$-$K$OJ}Dx<0$N2r$,0l0U$K$O7h$^$i$J$$$?(B
$B$a!"J}Dx<0$O@~7A=>B0$G$"$k!#=>$C$F!"9TNs<0$,(B0$B$G$O$J$3$H$,J}Dx<0$N0lHL2r(B
$B$N0l<!FHN)@-$NI,MW>r7o$G$"$k!#$^$?!"$3$N$H$-!"$3$N9TNs$r(BWronski$B9TNs(B$W(u_1,\cdots,u_n)$$B$H8F(B
$B$S!"$=$N9TNs<0$r(BWronski$B9TNs<0(B(Wronskian)$B$H8F$S!"(B$\Delta(u_1,\cdots,u_n)$
$B$HI=5-$9$k!#(B
\begin{equation}
 W(u_1, u_2, \cdots, u_n) =
\begin{vmatrix}
  u_1 &  u_2  & \cdots & u_n \\
  u'_1 & u'_2 & \cdots & u'_n \\
  \vdots & \vdots & \ddots& \vdots \\
  u^{(n-1)}_1 & u^{(n-1)}_2 & \cdots & u^{(n-1)}_n
\end{vmatrix}
\end{equation}

$B$^$?!"$3$N(BWronski$B9TNs<0$K$h$k@QJ,Dj?t$K4X$9$k9TNsJ}Dx<0$N2r$O!"(BCramer$B$N(B
$BDjM}$r;H$C$FF@$i$l$F!"(B
\begin{equation}
 C_i = \frac{|W_i|}{|W|},
\end{equation}
$B$G$"$k!#$3$N$H$-!"(B$|W_i|$$B$O(B$i$$B9TL\$NNs$H:G8e$N$r=|$$$?(BWronski$B9TNs<0$N>.9TNs<0$G(B
$B$"$k!#(B

\section{$BHs@F<!J}Dx<0$N0lHL2r(B}
$B$"$k(B$n$$B3,$N>oHyJ,J}Dx<0$N:nMQAG$,(B$L$$B$GM?$($i$l$F$$$k$H$9$k!#Nc$($P!"(B
\[
 L = a_n\frac{d^n}{dt^n} + a_{n-1}\frac{d^{n-1}}{dt^{n-1}} + \cdots + a_n.
\]
$B$=$7$F!"$3$N$H$-!"Hs@F<!J}Dx<0$,<!$N$h$&$KDj5A$5$l$F$$$?$H$9$k!#(B
\begin{equation}
 L(y) = f(x).
\end{equation}
$B$3$N$h$&$J>l9g$N(B1$B3,$NJ}Dx<0$K$D$$$F$ODj?tJQ2=K!$H$7$F!"A0@a$G07$C$?$,!"(B
$B0lHLE*$P$"$$$K$D$$$F9M$($k!#0l3,$NJ}Dx<0$N>l9g$HF1$8$h$&$K!"4pK\7O(B$u$$B$O(B
$L(u)=0$$B$rK~$?$9$H$7$F!"(B
\begin{equation}
 u = C_1u_1 + C_2 u_2 + \cdots + C_nu_n,
\end{equation}
$B$N$h$&$KI=$5$l$k$H$9$k!#$=$7$F!"$3$l$r0lHL2r$K$D$$$F3HD%$9$k$H$-!"0lHL2r(B
$y$$B$O(B$x$$B$K$D$$$F$N4X?t(B$V=V(x)$$B$K$h$j!"(B
\begin{equation}
 y = V_1u1_ + V_2u_2 + \cdots + V_nu_n,
\end{equation}
$B$HI=$5$l$k!#$3$3$G!"(B$V_i$$B$O(B$L(y)=f(x)$$B$rK~$?$9$h$&$J4X?t$G$"$k$,!"(B$n$$B$N(B
$B4pK\2r$r;}$D(B$V_i$$B$H(B$f(x)$$B$N4V$K$OHyJ,J}Dx<0$K$h$k(B1$B$D$N4X78@-$7$+5,Dj$5$l(B
$B$F$$$J$$$?$a!";D$j$N(B$n-1$$B$K$D$$$F$OG$0U$N4X78@-$r5,Dj$G$-$k!#(B

$B:#!"J}Dx<0$r4JC1$K2r$/$?$a$K!"<!$N$h$&$K2>Dj$9$k!#(B
\begin{equation}
 \begin{cases}
  V_1u_1' + V_2u_2' + \cdots + V_nu_n' = 0, \\
  V_1'u_1' + V_2'u_2' + \cdots + V_n'u_n' = 0, \\
  \cdots \\
  V_1'u_1^{(n-2)} + V_2'u_2^{(n-2)}  + \cdots + V_n'u_n^{(n-2)} = 0,
 \end{cases}
 \label{variation_constant_method_suppose1}
\end{equation}

$B$3$l$r$b$H$K$7$F!"HyJ,J}Dx<0$K(B$y$$B$rBeF~$7$F$$$/!#(B$y$$B$NHyJ,$K$D$$$F$O!">e(B
$B5-$N2>Dj$K$h$j!"(B
\begin{equation}
 \begin{cases}
  y' = V_1u_1' + V_2u_2' + \cdots + V_nu_n', \\
  \cdots \\
  y^{(n-1)} = V_1u_1^{(n-1)} + V_2u_2^{(n-1)} + \cdots +
  V_nu_n^{(n-1)}, \\
  y^{(n)} =  V_1u_1^{(n)} + V_2u_2^{(n)} + \cdots +
  V_nu_n^{(n)} +
  V_1u_1^{(n-1)} + V_2u_2^{(n-1)} + \cdots +
  V_nu_n^{(n-1)},
 \end{cases}
\end{equation}
$B$G$"$k!#$3$l$rHyJ,J}Dx<0$KBeF~$9$k!#$3$N$H$-!"(B$L(u_i)=0$$B$OHyJ,J}Dx<0$N4p(B
$BK\7OA4$F$K@.N)$7$F$*$j!"$?$H$($P!"(B$u_1$$B$K$D$$$F$O!"(B
$V_1L(u_1)+V_1'u_1^{(n-1)}$$B$K$J$j!"99$K!"(B$L(u_1)=0$$B$J$N$G!"(B
$V_1'u_1^{(n-1)}$$B$,;D$k!#=>$C$F!"(B
\begin{equation}
 V_1'u_1^{(n-1)} + V_2'u_2^{(n-1)} + \cdots + V_n'u_n^{(n-1)}
 = f(x),
\end{equation}
$B$,F@$i$l$k!#$3$l$H!"<0(B(\ref{variation_constant_method_suppose1})$B$+$i!"<!(B
$B$N$h$&$JBe?tJ}Dx<0$,F@$i$l$k!#(B
\begin{equation}
 \begin{pmatrix}
  u_1 & u_2 & \cdots & u_n \\
  u_1' & u_2' & \cdots & u_n' \\
  \vdots & \vdots & \ddots & \vdots \\
  u_1^{(n-1)} & u_2^{(n-1)} & \cdots & u_n^{(n-1)}
 \end{pmatrix}
 \begin{pmatrix}
  V_1' \\ V_2' \\ \vdots \\ V_n'
 \end{pmatrix}
 =
 \begin{pmatrix}
  0 \\ 0 \\ \vdots \\ f(x)
 \end{pmatrix}.
\end{equation}

$B$3$l$O(BCramer$B$N8x<0$K$h$j!"(B
\begin{equation}
 V_i' = \frac{W_i}{W},
\end{equation}
$B$K$h$j2r$,5a$a$i$l!"<!$N$h$&$J@QJ,$K$h$j0lHL2r$,5a$a$i$l$k!#(B
\begin{equation}
 y = \left(\sum_{i=0}^n\int dx \frac{|W_i|}{|W|}\right)u_i.
\end{equation}

$B$^$?!"$3$N$H$-!"(BWronski$B9TNs<0$N$&$A!"(B$W_i$$B$O(B$W$$B$NItJ,9TNs<0$@$,!"FC$K!"(B
\begin{equation}
 W_i =
  \begin{pmatrix}
   u_1 & u_2 & \cdots & u_{i-1} & 0 & \cdot & u_n \\
   u_1' & u_2' & \cdots & u_{i-1}' & 0 & \cdot & u_n' \\
   \vdots & & &\ddots & \ddots& & \vdots \\
   u_1^{(n-1)} & u_2^{(n-1)} & \cdots & u_{i-1}^{(n-1)} & 0 & \cdot & u_n^{(n-1)} \\
  \end{pmatrix}
\end{equation}
$B$N$h$&$KDj5A$5$l$k9TNs<0$G$"$k!#(B

$B$^$?!"FC$K!"(B2$B3,$NJ}Dx<0$K$D$$$F$O!"(B
\begin{equation}
 V_1 = -\int dx \frac{u_2}{W}f(x),
\end{equation}
\begin{equation}
 V_2 = \int dx \frac{u_1}{W}f(x),
\end{equation}
$B$G$"$k!#(B

\begin{thebibliography}{10}
 \bibitem{Ince} INCE, E. L., Ordinary Differential Equations, Dover
	 publishing inc., New York
\end{thebibliography}


\chapter{{\tt ILUMtx}: Incomplete $LU$ Matrix Object}
\label{chapter:ILUMtx}
\par
The {\tt ILUMtx} object represents and approximate (incomplete)
$(L+I)D(I+U)$, $(U^T+I)D(I+U)$ or $(U^H+I)D(I+U)$ factorization.
It is a very simple object, rows and columns of $L$ and $U$ are
stored as single vectors.
All computations to compute the factorization and to solve linear
systems are performed with sparse BLAS1 kernels.
Presently, the storage scheme is very simple minded, we use {\tt
malloc()} and {\tt free()} to handle the individual vectors of the
rows and columns of $L$ and $U$.
\par
At present we have one factorization method.
No pivoting is performed.
Rows of $U$ are stored, along with columns of $L$ if the matrix is
nonsymmetric.
If a zero pivot is encountered on the diagonal during the
factorization, the computation stops and returns a nonzero error
code.
(Presently, there is no ``patch-and-go'' functionality.)
An $L_{j,i}$ entry is kept if
$
|L_{j,i} D_{i,i}| \ge \sigma \sqrt{|D_{i,i}| \ |A_{j,j}|},
$
where $\sigma$ is a user supplied drop tolerance,
and similarly for $U_{i,j}$.
Note, if $A_{j,j} = 0$, as is common for KKT matrices,
all $L_{j,i}$ and $U_{i,j}$ entries will be kept.
It is simple to modify the code to use another drop tolerance
criteria, e.g., an absolute tolerance, or one based only on
$|D_{i,i}|$.
We intend to write other factorization methods that will
conform to a user-supplied nonzero structure for the factors.