\input{_preamble}

\title{Introduction to complex networks}

\newcommand{\set}[1]{\ensuremath{\mathcal{#1}}}

\renewcommand{\vec}[1]{\ensuremath{\mathbf{#1}}}
\newcommand{\mat}[1]{\ensuremath{\vec{#1}}}
\newcommand{\tr}{\ensuremath{\intercal}}

\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand{\N}{\ensuremath{\mathcal{N}}}

\begin{document}

\maketitle

\begin{frame}{Contents}
    \tableofcontents[hideallsubsections]
\end{frame}

\section{Definitions}

\begin{frame}{Graph theory}
    \begin{description}
        \item[1736] Euler writes the first paper
        \item[1959] Erdős and Rényi introduce probabilistic methods
    \end{description}
    \vfill
    \begin{center}
        \includegraphics[height=10em]{figures/seven_bridges} \\
        {\scriptsize%
         From Junker and Schreiber (2008)}
    \end{center}
\end{frame}

\begin{frame}{Network theory}
    \begin{description}
        \item[1970s] Sociologists (`social network analysis')
        \item[2000s] Physicists and Computer Scientists
    \end{description}
    \vfill
    \begin{center}
        \includegraphics[height=10em]{figures/network}
    \end{center}
\end{frame}

\begin{frame}{Graphs and their representation}
    A graph $\set{G} = \left( \set{V}, \set{E} \right)$ consists of:
    \begin{enumerate}
        \item a set of \textbf{vertices}
              $\set{V} = \left\{ v_{1}, \ldots, v_{n} \right\}$
        \item a binary relation $\set{E} \subseteq \set{V}^{2}$ that represents
              \textbf{edges}
    \end{enumerate}
    \vfill\pause
    \begin{block}{Alternative representation of $\set{E}$}
        In terms of the \textbf{adjacency matrix}
        $\mat{A} \in \{ 0, 1 \}^{n \times n}$, with elements
        \[
            a_{ij} =
            \begin{cases}
                1 & \text{if} \left( v_{i}, v_{j} \right) \in \set{E} \\
                0 & \text{otherwise}
            \end{cases}
        \]
    \end{block}
\end{frame}

\begin{frame}{Example}
    \begin{columns}
        \begin{column}{0.5\textwidth}
            \begin{center}
                \includegraphics[height=0.85\textheight]{figures/graph}
            \end{center}
        \end{column}
        \begin{column}{0.5\textwidth}
            \vspace{1em}
            \begin{align*}
                \set{V} &= \left\{ v_{1}, \ldots, v_{6} \right\} \\
                \set{E} &= \left\{ (v_{1}, v_{1}), (v_{1}, v_{2}), \ldots \right\} \\[1em]
                \mat{A} &=
                \begin{pmatrix}
                    1 & 1 & 0 & 0 & 1 & 0\\
                    1 & 0 & 1 & 0 & 1 & 0\\
                    0 & 1 & 0 & 1 & 0 & 0\\
                    0 & 0 & 1 & 0 & 1 & 1\\
                    1 & 1 & 0 & 1 & 0 & 0\\
                    0 & 0 & 0 & 1 & 0 & 0\\
                \end{pmatrix}
            \end{align*}
        \end{column}
    \end{columns}
\end{frame}

\begin{frame}{Weights}
    \begin{itemize}
        \item Assigned to elements of \set{E}
        \item Represent the \textbf{strength} of the relationship
    \end{itemize}
    \vfill
    \begin{block}{Examples}
        \begin{itemize}
            \item Signed edges:
                  $\mat{A} \in \{ -1, 0, 1 \}^{n \times n}$
            \item Weights on the unit interval:
                  $\mat{A} \in [ 0, 1 ]^{n \times n}$
            \item Weights on the positive real line:
                  $\mat{A} \in [ 0, \infty )^{n \times n}$
        \end{itemize}
    \end{block}
\end{frame}

\begin{frame}{Properties of $\set{E}$}
    \begin{block}{Irreflexivity}
        \centering
        $\forall\, v_{i} \in \set{V}.\, (v_{i}, v_{i}) \not \in \set{E}$
        \begin{itemize}
            \item[$\rightarrow$] No `self\hyp{}loops' allowed
        \end{itemize}
    \end{block}
    \vfill
    \begin{block}{Symmetry}
        \centering
        $\forall\, v_{i}, v_{j} \in \set{V}.\, (v_{i}, v_{j}) \in \set{E} \Rightarrow (v_{j}, v_{i}) \in \set{E}$
        \begin{itemize}
            \item[$\rightarrow$] Direction of the relationship does not matter
                                 ($\set{G}$ is \textbf{undirected})
            \item[$\rightarrow$] $\mat{A} = \mat{A}^{\tr}$ is also symmetric
        \end{itemize}
    \end{block}
\end{frame}

\begin{frame}{Properties of vertices}
    \begin{block}{Neighbourhood}
        \centering
        $\N(v_{i}) = \left\{ v_{j} : (v_{i}, v_{j}) \in \set{E} \right\} \subseteq \set{V}$
        \begin{itemize}
            \item[$\rightarrow$] \textbf{Set} of vertices to which $v_{i}$ is
                                 connected by edges
        \end{itemize}
    \end{block}
    \vfill
    \begin{block}{Degree}
        \centering
        $k_{i} = k(v_{i}) = \left| \, \N(v_{i}) \, \right|$
        \begin{itemize}
            \item[$\rightarrow$] \textbf{Number} of vertices to which $v_{i}$ is
                                 connected by edges
        \end{itemize}
    \end{block}
\end{frame}

\begin{frame}{In- and out-degree}
    \begin{columns}
        \begin{column}{0.5\textwidth}
            \begin{align*}
                k^{\text{in}}_{i} &= \left| \left\{ \left( v_{j}, v_{i} \right)\;\middle|\;\left( v_{j}, v_{i} \right) \in \set{E} \right\} \right| \\[1em]
                k^{\text{out}}_{i} &= \left| \left\{ \left( v_{i}, v_{j} \right)\;\middle|\;\left( v_{i}, v_{j} \right) \in \set{E} \right\} \right|
            \end{align*}
        \end{column}
        \begin{column}{0.5\textwidth}
            \begin{center}
                \includegraphics[width=\textwidth]{figures/degree}
            \end{center}
        \end{column}
    \end{columns}
\end{frame}

\begin{frame}{Paths}
    \only<1>{%
        A \textbf{path} on $\set{G} = ( \set{V}, \set{E} )$ is a graph
        $\set{P} = ( \set{V}_{\set{P}}, \set{E}_{\set{P}} )$ with:
        \begin{enumerate}
            \item $\set{V}_{\set{P}} = \{ v_{(0)}, \ldots, v_{(l)} \} \subseteq \set{V}$
            \item $\set{E}_{\set{P}} = \{ (v_{(0)}, v_{(1)}), \ldots, (v_{(l-1)}, v_{(l)}) \} \subseteq \set{E}$
        \end{enumerate}
        \begin{description}
            \item[Ends] Vertices $v_{(0)}$ and $v_{(l)}$
            \item[Length] Number of edges
                          $\left| \, \set{E}_{\set{P}} \, \right| = l$
        \end{description}}
    \only<2>{%
        \begin{center}
            \includegraphics[width=\textwidth]{figures/path} \\[1em]
            {\scriptsize%
             From Diestel (2010)}
        \end{center}}
\end{frame}

\begin{frame}{Shortest paths}
    \begin{center}
        \includegraphics[height=0.85\textheight]{figures/shortest_path}
    \end{center}
\end{frame}

\section{Local properties}

\begin{frame}{Centrality}
    \begin{center}
        \Large%
        Which are the most important \\
        (or `central') vertices?
    \end{center}
    \vfill
    \only<1>{%
        \begin{block}{Degree centrality}
            How many connections does a vertex have to other vertices?
        \end{block}}
    \only<2>{%
        \begin{block}{Closeness centrality}
            How `far' (in terms of shortest paths) is a vertex with respect to
            all other vertices?
        \end{block}}
    \only<3>{%
        \begin{block}{Betweenness centrality}
            How many times does a vertex act as a `bridge' along the shortest
            paths between all pairs of vertices?
        \end{block}}
    \only<4>{%
        \begin{block}{Eigenvector centrality (PageRank)}
            How many times do we stumble upon a vertex while randomly walking on
            the graph?
        \end{block}}
\end{frame}

\begin{frame}{Local clustering coefficient}
    \[
        C_{i} = C(v_{i}) = \frac{| \, \{ (v_{j}, v_{k}) : \{ (v_{i}, v_{j}), (v_{i}, v_{k}), (v_{j}, v_{k}) \} \subseteq \set{E} \} \, |}{k_{i} \, (k_{i} - 1) / 2} \in [0, 1]
    \]
    \vfill
    \begin{itemize}
        \item Probability that a pair of neighbours of $v_{i}$ are connected
        \item Empirically: $k_{i} \nearrow$, $C_{i} \searrow$
        \item[$\rightarrow$] Can be used to identify `structural holes'
    \end{itemize}
\end{frame}

\section{Large-scale structure}

\begin{frame}{`Small-world' effect}
    \vfill
    \begin{quotation}
        `\ldots Milgram's letter\hyp{}passing experiment in the 1960s, in which
        people were asked to get a letter from an initial holder to a distant
        target person by passing it from acquaintance to acquaintance through
        the social network.
        The letters that made it to the target did so in a remarkably small
        number of steps, around six on average.'

        \begin{flushright}
            \scriptsize%
            From Newman (2010)
        \end{flushright}
    \end{quotation}
    \vfill
\end{frame}

\begin{frame}{Degree distribution}
    \[
        \Pr\!\left[ K = k \,\right]
        = \Pr\!\left[ \text{`a randomly selected vertex $v_{i} \in \set{V}$ has degree $k \geq 0$'} \right]
    \]
    \begin{center}
        \includegraphics[height=0.65\textheight]{figures/degree_dist}
    \end{center}
\end{frame}

\begin{frame}{Power laws}
    \begin{align*}
        \ln y &= - \alpha \ln x + c \\
        y &= C\,x^{\,-\alpha}, \quad C = e^{\,c}
    \end{align*}
    \vfill
    \begin{itemize}
        \item Sizes of city populations and wars
        \item Frequency of use of words in human languages
        \item Occurrence of personal names in most cultures
        \item Number of papers scientists write
        \item Number of hits on Web pages
        \item Sales of almost every branded commodity
        \item Number of species in biological taxa
    \end{itemize}
\end{frame}

\begin{frame}{Scale-free networks}
    \only<1>{%
        \begin{itemize}
            \setlength{\itemsep}{\bigskipamount}
            \item $\Pr\!\left[ K = k \,\right] \propto k^{\,-\alpha}$
                  (at least asymptotically), usually $2 \le \alpha \le 3$
            \item \textbf{Self\hyp{}similar} (scale invariance)
            \item Presence of \textbf{hubs} (Milgram's `sociometric superstars')
                  \begin{itemize}
                      \item[$\rightarrow$] Fault tolerance
                      \item[$\rightarrow$] `Small\hyp{}world' effect
                  \end{itemize}
        \end{itemize}}
    \only<2>{%
        \begin{block}{Examples}
            \begin{itemize}
                \setlength{\itemsep}{\medskipamount}
                \item Social and collaboration networks
                \item Many kinds of communication networks (e.g.\ the Internet)
                \item \textbf{Many biological networks}
            \end{itemize}
        \end{block}}
\end{frame}

\section{Models of network formation}

\begin{frame}{What is complexity?}
    \only<1>{%
        \begin{block}{Complex}
            Many interacting parts, not necessarily `difficult'
        \end{block}
        \vfill
        \begin{block}{Complicated}
            Difficult, not necessarily `complex'
        \end{block}}
    \only<2>{%
        \begin{center}
            \includegraphics[height=0.8\textheight]{figures/onion} \\
            {\scriptsize%
             Via \textit{Wikimedia Commons}}
        \end{center}}
\end{frame}

\begin{frame}{Self-organisation}
    \only<1>{%
        \begin{center}
            \Large%
            Spontaneous emergence of global structure \\
            out of local interactions
        \end{center}
        \begin{itemize}
            \setlength{\itemsep}{\medskipamount}
            \item Robust to damage and perturbations
                  \begin{itemize}
                      \item Not controlled by (internal or external) agents
                      \item Collective, distributed process
                  \end{itemize}
            \item Outcome is not arbitrary, but `prefers' certain situations \\
                  $\rightarrow$ Natural selection
        \end{itemize}}
    \only<2>{%
        \begin{block}{Examples}
            \setlength{\itemsep}{\medskipamount}
            \begin{itemize}
                \item Protein folding
                \item Pattern formation and morphogenesis
                \item Social structures and herd behaviour
            \end{itemize}
        \end{block}}
    \only<3>{%
        \begin{center}
            \Large%
            Topology is crucial to understanding \\
            stochastic processes on networks
        \end{center}}
\end{frame}

\begin{frame}{Models of network formation}
    \begin{center}
        \includegraphics[width=\textwidth]{figures/models}
    \end{center}
\end{frame}

\begin{frame}{Erdős--Rényi model}
    \begin{block}{Algorithm}
        Construct a graph with $n$ vertices and include each edge with
        probability $p$ (independently from every other edge)
    \end{block}
    \vfill\pause
    \begin{block}{Degree distribution}
        \[
            \Pr\left[ K = k \,\right] = \binom{n-1}{k} \, p^{\,k} \left( 1-p \right)^{\,n-1-k}
        \]
    \end{block}
\end{frame}

\begin{frame}{Barabási--Albert model}
    \begin{block}{Algorithm}
        \begin{itemize}
            \item Start with an initial connected graph with $n$ vertices
            \item Add a new vertex and connect it to $n^{\star} \leq n$ existing
                  vertices with probability proportional to their degree \\
                  $\rightarrow$ \textbf{Preferential attachment}
        \end{itemize}
    \end{block}
    \vfill\pause
    \begin{block}{Degree distribution}
        \[
            \Pr\left[ K = k \,\right] \propto k^{\,-3}
        \]
    \end{block}
\end{frame}

\begin{frame}{What about `--omics'?}
    \begin{itemize}
        \setlength{\itemsep}{\bigskipamount}
        \item Very few longitudinal datasets \\
              $\rightarrow$ Difficult to understand evolution
        \item Few cross\hyp{}platform studies \\
              $\rightarrow$ Can understand interactions between complexity
                            levels
        \item Many single\hyp{}platform studies \\
              $\rightarrow$ Can characterise ``co\hyp{}'' networks
    \end{itemize}
\end{frame}

\end{document}


\chapter{Methods}\label{ch:methods}

\section{Mini-introduction to LaTeX}\label{sec:latex}

This chapter needs to be filled out. For now, it contains some very basic examples.

\subsection{Equations}\label{sec:latex:equations}

Equations and mathematical formulas can be included in-line, within the text, for example when explaining that $\norm{\vec x}_2$ signifies the $\ell_2$ norm of a vector, as long as the included math formula or symbols are short (less than half a line). For longer formulas, or formulas that need to be referenced later in the text, one should use the \texttt{equation} macro or related macros, e.g., \texttt{align}. For example, the dot-product of two vectors, $\vec x$ and $\vec y$, is defined as
\begin{equation}\label{eq:dot-product}
    \langle \vec x, \vec y \rangle = \vec{x}^T\vec{y} = \sum_{j=1}^m x_j\times y_j.
\end{equation}

Note that equations can be assigned labels and referenced throughout the text. However, unlike figures and tables (see next sections), the equation should be defined prior to its reference. Now that we can defined the formula for the vector dot-product, we can now refer to Equation~\ref{eq:dot-product} to remind readers of its definition.

\subsection{Figures}\label{sec:latex:figures}

Figures should contain a caption at the bottom. The caption is a sentence or phrase that describes the content of the figure. As such, it should start with a capital letter and end with a period. The caption is not a title, so subsequent words after the first word should not be capitalized unless they are proper names. A figure should be introduced in the text prior to its inclusion in the text. When referring to the figure, make use of the  \texttt{{\textbackslash}figurename} macro, provided by the IEEE style, to ensure style compliance. Additionally, use a non-breaking space character to connect the \figurename~text with the number assigned to the figure reference. This will ensure that \figurename~and the reference will be included on the same line. For example, \figurename~\ref{fig:proj-arch} introduces our project architecture. Note that font sizes in figures and tables may be smaller than the rest of the thesis. However, they should be readable.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=0.7\textwidth]{img/proj-arch.pdf}
  \caption{Project architecture.}
  \label{fig:proj-arch}
\end{figure}

\subsection{Tables}\label{sec:latex:tables}

Tables should contain a caption at the top. Unlike figures, the caption in the table is the table title, and it should be capitalized accordingly. The table should be presented in the text prior to its inclusion in the text. Moreover, references to tables should follow the same directions as those for figures, except use the \texttt{{\textbackslash}tablename} macro. For example, \tablename~\ref{tbl:dataset} introduces statistics about the dataset used in our analysis.

\begin{table}[!htb]
\caption{Dataset Characteristics}
\label{tbl:dataset}
\centering
\input{tables/dataset}
\end{table}

\subsection{Algorithms}\label{sec:latex:algorithms}

LaTeX provides powerful macros for writing algorithms. Note that labels can be included within the algorithm, which allows the writer to refer to specific lines in the algorithm. The algorithm should be introduced first. Note that the label referring to the whole algorithm is placed right after the caption. Similar to a table, the caption is a title and should be capitalized accordingly. For example, Algorithm~\ref{alg:proj-motif} describes the process for producing a normalized 2-hop left-projection of a bipartite graph described by the vertex sets $V^1$ and $V^2$ and the edge set $E$. Long algorithms (greater than half a page) should be relegated to the Appendix.

\begin{algorithm}[!htb]
\caption{The Normalized 2-hop Left-Projection Algorithm}\label{alg:proj-motif}
\small
\begin{algorithmic}[1]
\Procedure{Project}{$V^1,V^2,E$}\Comment{Construct the left projection $G^1$}
%%
\item[] \quad\; // Initialize and compute degree vectors.
\For {$(v^1_i, v^2_j) \in E$} \Comment{Count neighbors}
\State $\lambda_n(i) \gets \lambda_n(i) + 1$
\State $\lambda_m(j) \gets \lambda_m(j) + 1$
\EndFor
\item[] \quad\; // SpGEMM
%%
\For {$v^1_i \in V^1$} \label{alg:proj-motif-spgemm1}
\State $acc(:) \gets 0$ \Comment{Initialize output row accumulator data structure}
\For {$v^2_k \in \Gamma(v^1_i)$}
\State $l \gets  (1/\lambda_n(i)) \times \times w_{i,k} \times (1/\lambda_m(k))$ \label{alg:proj-motif-lk}
\For {$v^1_j \in \Gamma(v^2_k)$}
\If {$v^1_j \ne v^1_i$} \Comment{Avoid computing output diagonal}
\State $acc(j) \gets acc(j) + l \times w_{j,k}$ \label{alg:proj-motif-accum}
\EndIf
\EndFor
\EndFor
\State $C(i,:) = acc(:)$
\EndFor\label{alg:proj-motif-spgemm2}
\item[] \quad\; // Normalize rows of $C$
%%
\For {$i = 1, \ldots, |V^1|$}\label{alg:proj-motif-norm1}
\State $n_i \gets 0$
\For {$j = 1, \ldots, |V^2| \text{ s.t. } C(i,j) > 0$}
\State $n_i \gets n_i + \text{abs}(C(i,j))$
\EndFor
\For {$j = 1, \ldots, |V^2| \text{ s.t. } C(i,j) > 0$}
\State $C(i,j) \gets C(i,j) / n_i$
\EndFor
\EndFor\label{alg:proj-motif-norm2}
\State \textbf{return} $C$\Comment{Edge set weight matrix for $G^1$}
\EndProcedure
\end{algorithmic}
\end{algorithm}

After introducing the algorithm, one can then refer to sections of the algorithm in the process of describing it in the text. For example, note that line~\ref{alg:proj-motif-accum} denotes the accumulation of projection weights for a vertex $v_i^1$ in $V^1$. For theses that contain many mathematical symbols, it is a good idea to provide the reader with a reference for the meaning of these symbols. This table is generally included in the preliminary chapters, after the introduction. We will include an example here. \tablename~\ref{tbl:notation-g} provides a reference for notation used throughout the paper that the algorithm above is included in.

\begin{table}[!htb]
\caption {Graph and Projection Notation} \label{tbl:notation-g}
\centering
\small
 \begin{tabular}{l l}
 \hline
 \textbf{Symbol} & \textbf{Meaning} \\
 \hline
 $G$ & A graph topology. \\
 $V^1$, $V^2$ & The left and right node partitions in a bipartite graph. \\
 $E$ & The set of edges in $G$. \\
 $|X|$ & The cardinality of set $X$. \\
 $v^1_i \in V^1$ & A vertex in the left node partition $V^1$. \\
 $v^2_j \in V^2$ & A vertex in the right node partition $V^2$. \\
 $(v^1_i, v^2_j, w_{i,j})\in E$ & The edge connecting nodes $v^1_i$ and $v^2_j$ with weight $w_{i,j}$ in graph $G$. \\
 $\Gamma(v^1_i)$ & The set of vertices in $V^2$ adjacent to $v^1_i$, i.e., its neighborhood. \\
 $\lambda_n,\lambda_m$ & Node degree vectors for the left and right partitions.\\
 $A \in \mathbb{R}^{n\times m}$ & The edge weight matrix for the bipartite graph $G$; $A(i,j) = w_{i,j}$. \\
 $B$ & Weighted adjacency matrix for graph $G$.\\
 \hline
 $G^1 = (V^1, E^1)$ & The left projection graph.\\
 $G^2 = (V^2, E^2)$ & The right projection graph.\\
 $G^b = (V, E^b)$ & The biprojection graph.\\
 $(v^1_i, v^1_j, s^1_{i,j})\in E^1$ & The edge connecting $v^1_i$ and $v^1_j$ with weight $s^1_{i,j}$ in the left projection graph. \\
 $W^1$ & Edge weight matrix for the left projection graph; $W^1(i,j) = s^1_{i,j}$.\\
 $W^2$ & Edge weight matrix for the right projection graph; $W^2(i,j) = s^2_{i,j}$.\\
 $W$ & Weighted adjacency matrix for the bi-projection graph of $G$.\\
 \hline
 \end{tabular}
\end{table}

\subsection{Location of Floats}\label{sec:latex:floats}

Floats (e.g., algorithms, tables and figures) should not follow the IEEE standard of being placed at the top or bottom of the page. In a thesis, they must appear right after their reference and not break any paragraphs, i.e., they should be placed in the text, after the paragraph in question. Use the location hint \texttt{[!htb]} to let LaTeX know the float should be placed in between paragraphs. If the float takes up an entire page and the last paragraph on the current page does not fit in its entirety, it should be moved after the float page to avoid breaking the continuity of the paragraph, leaving some blank lines at the end of the current page.

Pages that contain only floats will have floats vertically centered, which will produce additional blank lines between the floats in the page or between a float and the top and bottom of the page. The thesis guidelines specifically prohibit additional white space in the thesis. This case and the one discussed in the previous paragraph are the only acceptable reasons for having extra blank lines in the text.

\subsection{Citations}\label{sec:latex:citations}
When citing papers, it is advisable to collect BibTeX records for the papers that you wish to cite, which will be automatically processed into the correct citation style by the LaTeX/BibTeX compiler. Citing a work by Anastasiu and Karypis~\cite{anastasiu-dsaa2016}, for example, is as simple as writing ``Anastasiu and Karipis\textasciitilde{\textbackslash}cite\{anastasiu-dsaa2016\},'' where \textit{anastasiu-dsaa2016} is the key associated with the paper's BibTeX record in the \textit{references.bib} file. Note the non-breaking space character (\textasciitilde) between the word before the citation and the \textit{{\textbackslash}cite} command. It gets translated into a space, and does not allow LaTeX to print the citation on a different line than the connecting word. This, of course, does not work if you put a space between the word and the non-breaking space character, e.g., ``Karypis \textasciitilde{\textbackslash}cite\{anastasiu-dsaa2016\}''.

When citing papers with a single author, one should refer to the work by citing the author's last name. For example, Anastasiu~\cite{anastasiu-idsc2017} used a combination of heuristic candidate selection and search space filtering to efficiently identify approximate nearest neighbors. When the work has two authors, both authors should be referenced by their last name, as in the previous example of the work by Anastasiu and Karypis~\cite{anastasiu-dsaa2016}. Finally, if there are more than two authors, one should reference the first author's last name, followed by the phrase \textit{et al.}, which is short for the Latin \textit{et alia} and means ``and others''. Note the placement of the period. As an example, Kapoor et al.~\cite{kapoor-fie2018} discuss the benefits of competitive active learning in engineering education. Note that it is not necessary to mention authors by last name when listing multiple works as examples or evidence of a statement. For example, many recent works have developed filtering-based methods for nearest neighbor graph construction~\cite{anastasiu-icde2014, anastasiu2015, anastasiu-sc2015, anastasiu-sc2016}.


\chapter{Dipole radiation}
Radiation means the generation of electromagnetic waves, which then propagate away from the source to infinity. Classically, electromagnetic waves are created by charged particles accelerating, or, equivalently, currents varying in time. There is no radiation in case of electric and magnetic fields of a point charge moving with constant velocity. The energy in the electromagnetic field is transported along with the particle, but does not propagate away toward infinity. But if the charge velocity is not constant there must be radiation.\\
As we start the study of radiation, it is interesting to remember that the classical field theory was developed from experiments and observations on macroscopic objects such as charged bodies, insulators, conductors, current-carrying wires, and magnets. The classical theory is therefore at its best when applied to macroscopic electromagnetic phenomena. So, for example, the theory applies to radiation of radio waves by an antenna, or microwaves by a cavity resonator. In this book we concentrate mainly on systems of that kind.\\
 However, much of the radiation around us-in fact much of the radiation in the Universe-comes from microscopic systems and must be described by quantum electrodynamics. For example, sunlight, light from the filament of an incandescent bulb, fluorescent light, or laser light can only be explained by quantum considerations of individual atoms, molecules, or systems of atoms. For these systems the classical theory does not really apply, except perhaps in a qualitative, heuristic way. Only quantum electrodynamics can properly describe radiation by an atom. Despite its limited applicability, the classical theory of radiation is an important part of electromagnetism. Quantum electrodynamics, which has limitations of its own, relies on a foundation of classical electrodynamics.\\
 \newpage
 \section{Electric dipole radiation}
 Picture two tiny metal spheres separated by a distance $d$ and connected by a fine wire (figure below); at time $t$ the charge on the upper sphere is $q(t)$, and the charge on the lower sphere is $-q(t)$. Suppose that we drive the charge back and forth through the wire, from one end to the other, at an angular frequency $\omega$ :
 $$
 q(t)=q_{0} \cos (\omega t)
 $$
 \begin{figure}[H]
 	\centering
 	\includegraphics[height=5cm,width=8cm]{dipole-crop}
 	\caption{}
 	\label{}
 \end{figure}
 The result is an oscillating electric dipole:
 $$
 \mathbf{p}(t)=p_{0} \cos (\omega t) \hat{\mathbf{z}}
 $$
 where
 $$
 p_{0}=q_{0} d
 $$
 is the maximum value of the dipole moment.
 With the approximation of
 $$
 d \ll \frac{\lambda}{2 \pi} \ll r
 $$
 you should not forget that $\frac{\lambda}{2 \pi}=\frac{c}{\omega}$ we can calculate the potentials\\
 $$
 V(r, \theta, t)=-\frac{p_{0} \omega}{4 \pi \epsilon_{0} c}\left(\frac{\cos \theta}{r}\right) \sin [\omega(t-r / c)]
 $$
 and
 $$
 \mathbf{A}(r, \theta, t)=-\frac{\mu_{0} p_{0} \omega}{4 \pi r} \sin [\omega(t-r / c)] \hat{\mathbf{z}}
 $$
 Hence we get the fields
 $$
 \mathbf{E}=-\nabla V-\frac{\partial \mathbf{A}}{\partial t}=-\frac{\mu_{0} p_{0} \omega^{2}}{4 \pi}\left(\frac{\sin \theta}{r}\right) \cos [\omega(t-r / c)] \hat{\boldsymbol{\theta}}
 $$
 and
 $$
 \mathbf{B}=\nabla \times \mathbf{A}=-\frac{\mu_{0} p_{0} \omega^{2}}{4 \pi c}\left(\frac{\sin \theta}{r}\right) \cos [\omega(t-r / c)] \hat{\phi}
 $$
 The energy radiated by an oscillating electric dipole is determined by the Poynting vector:
 $$\mathbf{S}(\mathbf{r}, t)=\frac{1}{\mu_{0}}(\mathbf{E} \times \mathbf{B})=\frac{\mu_{0}}{c}\left\{\frac{p_{0} \omega^{2}}{4 \pi}\left(\frac{\sin \theta}{r}\right) \cos [\omega(t-r / c)]\right\}^{2} \hat{\mathbf{r}}$$
 The intensity is obtained by averaging (in time) over a complete cycle:
 $$\langle\mathbf{S}\rangle=\left(\frac{\mu_{0} p_{0}^{2} \omega^{4}}{32 \pi^{2} c}\right) \frac{\sin ^{2} \theta}{r^{2}} \hat{\mathbf{r}}$$
 The total power radiated is found by integrating $\langle\mathbf{S}\rangle$ over a sphere of radius $r$ :
 $$ \langle P\rangle=\int\langle\mathbf{S}\rangle \cdot d \mathbf{a}=\frac{\mu_{0} p_{0}^{2} \omega^{4}}{32 \pi^{2} c} \int \frac{\sin ^{2} \theta}{r^{2}} r^{2} \sin \theta d \theta d \phi=\frac{\mu_{0} p_{0}^{2} \omega^{4}}{12 \pi c}$$
 \section{Magnetic dipole radiations}
 Suppose now that we have a wire loop of radius $b$ (figure below) around which we drive an alternating current:
 $$I(t)=I_{0} \cos (\omega t)$$
 This is a model for an oscillating magnetic dipole,
 $$
 \mathbf{m}(t)=\pi b^{2} I(t) \hat{\mathbf{z}}=m_{0} \cos (\omega t) \hat{\mathbf{z}}
 $$
 \begin{figure}[H]
 	\centering
 	\includegraphics[height=4.5cm,width=7cm]{m dipole-crop}
 	\caption{}
 	\label{}
 \end{figure}
 where the maximum value of the magnetic dipole moment is.\\
 $$m_{0}=\pi b^{2} I_{0}$$
 Again with the assumption of
 $$
 b \ll \frac{\lambda}{2 \pi} \ll r
 $$
 we get the potentials and fields \\
 $$\mathbf{A}(r, \theta, t)=-\frac{\mu_{0} m_{0} \omega}{4 \pi c}\left(\frac{\sin \theta}{r}\right) \sin [\omega(t-r / c)] \hat{\phi}$$
 There is no electric scalar potential as there is no static charge. Hence the fields\\
 $$\mathbf{E}=-\frac{\partial \mathbf{A}}{\partial t}=\frac{\mu_{0} m_{0} \omega^{2}}{4 \pi c}\left(\frac{\sin \theta}{r}\right) \cos [\omega(t-r / c)] \hat{\phi}$$
 and
 $$\mathbf{B}=\nabla \times \mathbf{A}=-\frac{\mu_{0} m_{0} \omega^{2}}{4 \pi c^{2}}\left(\frac{\sin \theta}{r}\right) \cos [\omega(t-r / c)] \hat{\boldsymbol{\theta}}$$
 The Poynting vector
 $$\mathbf{S}(\mathbf{r}, t)=\frac{1}{\mu_{0}}(\mathbf{E} \times \mathbf{B})=\frac{\mu_{0}}{c}\left\{\frac{m_{0} \omega^{2}}{4 \pi c}\left(\frac{\sin \theta}{r}\right) \cos [\omega(t-r / c)]\right\}^{2} \hat{\mathbf{r}}$$
 time average of Poynting vector
 $$
 \langle\mathbf{S}\rangle=\left(\frac{\mu_{0} m_{0}^{2} \omega^{4}}{32 \pi^{2} c^{3}}\right) \frac{\sin ^{2} \theta}{r^{2}} \hat{\mathbf{r}}
 $$
 the total radiated power
 $$
 \langle P\rangle=\frac{\mu_{0} m_{0}^{2} \omega^{4}}{12 \pi c^{3}}
 $$
 \begin{note}
 	If you compare the formula for power for electric and magnetic dipole radiation you get
 	$$\frac{P_{\text {magnetic }}}{P_{\text {electric }}}=\left(\frac{m_{0}}{p_{0} c}\right)^{2}$$
 \end{note}

\section{Radiation from a arbitrary source}
Power radiated from arbitrary electric source whose electric dipole moment is changing with respect to time\\
$$P_{\operatorname{rad}}\left(t_{0}\right) \cong \frac{\mu_{0}}{6 \pi c}\left[\ddot{p}\left(t_{0}\right)\right]^{2}$$
Power radiated from arbitrary magnetic source whose magnetic dipole moment is changing with respect to time
$$P_{\mathrm{rad}}\left(t_{0}\right) \cong \frac{\mu_{0}}{6 \pi c^{3}}\left[\ddot{m}\left(t_{0}\right)\right]^{2}$$
\begin{exercise}
 A particle moving straight line with velocity $v=v_{0}+\alpha t$. How much energy does it radiate?
\end{exercise}
\begin{answer}
The position of the particle
$$
x=x_{0}+v_{0} t+\frac{1}{2} \alpha t^{2}
$$
Now dipole moment
$$
\mathbf{p}=q x \hat{i}
$$
$$\begin{aligned}
	&\Rightarrow p=q\left(x_{0}+v_{0} t+\frac{1}{2} \alpha t^{2}\right) \\
	&\Rightarrow \ddot{p}=q \alpha \\
	&\text { Power }=\frac{\mu_{0}}{6 \pi c} q^{2} \alpha^{2}
\end{aligned}$$
This is the famous larmor formula.\\
This formula can be used for a point charge moving with acceleration $\alpha$
\end{answer}
\begin{exercise}
	 A parallel-plate capacitor $C$, with plate separation $d$, is given an initial charge $(\pm) Q_{0}$. It is then connected to a resistor $R$, and discharges, $Q(t)=Q_{0} e^{-t / R C}$. What fraction of its initial energy $\left(Q_{0}^{2} / 2 C\right)$ does it radiate away?
\end{exercise}
\begin{answer}
	Power radiated is
	$$
	\frac{\mu_{0}}{6 \pi c} \ddot{p}^{2}
	$$
	In our case
	$$
	p=Q d, \text { so } \ddot{p}=\ddot{Q} d=Q_{0}\left(\frac{1}{R C}\right)^{2} e^{-t / R C} d
	$$
	So power radiated
	$$
	\frac{d W_{r}}{d t}=\frac{\mu_{0}}{6 \pi c} \frac{\left(Q_{0} d\right)^{2}}{(R C)^{4}} e^{-2 t / R C}
	$$
	The total energy radiated is
	$$
	\begin{aligned}
	W_{r} &=\frac{\mu_{0}}{6 \pi c} \frac{\left(Q_{0} d\right)^{2}}{(R C)^{4}} \int_{0}^{\infty} e^{-2 t / R C} d t \\
	&=\left.\frac{\mu_{0}}{6 \pi c} \frac{\left(Q_{0} d\right)^{2}}{(R C)^{4}}\left[-\frac{R C}{2} e^{-2 t / R C}\right]\right|_{0} ^{\infty} \\
	&=\frac{\mu_{0}}{6 \pi c} \frac{\left(Q_{0} d\right)^{2}}{(R C)^{4}} \frac{R C}{2}=\frac{\mu_{0}}{12 \pi c} \frac{\left(Q_{0} d\right)^{2}}{(R C)^{3}}
	\end{aligned}
	$$
\end{answer}
\begin{exercise}
 An electron is released from rest and falls under the influence of gravity. In the first centimeter, what fraction of the potential energy lost is radiated away?
\end{exercise}
\begin{answer}
Let the $y$ direction is in the downwards direction then\\
$\mathbf{p}=-e y \hat{\mathbf{y}}, y=\frac{1}{2} g t^{2}, \text { so } \mathbf{p}=-\frac{1}{2} g e t^{2} \hat{\mathbf{y}} ; \ddot{\mathbf{p}}=-g e \hat{\mathbf{y}}$\\
Hence the power radiated is
$$
P=\frac{\mu_{0}}{6 \pi c}(g e)^{2}
$$
Now the time the charge takes to fall a distance $h$ is given by $h=\frac{1}{2} g t^{2} \Rightarrow t=\sqrt{2 h / g}$, so the energy radiated in falling a distance $h$ is
$$
U_{\mathrm{rad}}=P t=\frac{\mu_{0}(g e)^{2}}{6 \pi c} \sqrt{2 h / g}
$$
The potential energy lost is $U_{\text {pot }}=m g h$. So the fraction is
$$
\begin{aligned}
f &=\frac{U_{\mathrm{rad}}}{U_{\mathrm{pot}}}=\frac{\mu_{0} g^{2} e^{2}}{6 \pi c} \sqrt{\frac{2 h}{g} \frac{1}{m g h}}=\frac{\mu_{0} e^{2}}{6 \pi m c} \sqrt{\frac{2 g}{h}} \\
&=\frac{\left(4 \pi \times 10^{-7}\right)\left(1.6 \times 10^{-19}\right)^{2}}{6 \pi\left(9.11 \times 10^{-31}\right)\left(3 \times 10^{8}\right)} \sqrt{\frac{(2)(9.8)}{(0.01)}}=2.76 \times 10^{-22}
\end{aligned}
$$
\end{answer}
\begin{exercise}
	 In Bohr's theory of hydrogen, the electron in its ground state was supposed to travel in a circle of radius $5 \times 10^{-11} \mathrm{~m}$, held in orbit by the Coulomb attraction of the proton. According to classical electrodynamics, this electron should radiate, and hence spiral in to the nucleus. Show that $v \ll c$ for most of the trip (so you can use the Larmor formula), and calculate the lifespan of Bohr's atom. (Assume each revolution is essentially circular.)
\end{exercise}
\begin{answer}
$$
F=\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{r^{2}}=m a=m \frac{v^{2}}{r} \Rightarrow v=\sqrt{\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{m r}}
$$
At the beginning $\left(r_{0}=0.5 \mathrm{~A}\right)$
$$
\begin{aligned}
\frac{v}{c} &=\left[\frac{\left(1.6 \times 10^{-19}\right)^{2}}{4 \pi\left(8.85 \times 10^{-12}\right)\left(9.11 \times 10^{-31}\right)\left(5 \times 10^{-11}\right)}\right]^{-\frac{1}{2}} \frac{1}{3 \times 10^{8}} \\
&=0.0075
\end{aligned}
$$
and when the radius is one hundredth of this $v / c$ is only 10 times greater $(0.075)$, so for most of the trip the velocity is safely nonrelativistic. From the Larmor formula,
$$P=\frac{\mu_{0} q^{2}}{6 \pi c}\left(\frac{v^{2}}{r}\right)^{2}=\frac{\mu_{0} q^{2}}{6 \pi \epsilon_{0}}\left(\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{m r^{2}}\right)^{2}$$
since $a=v^{2} / r$, and $P=-d U / d t$ where $U$ is the (total) energy of the electron
$$
\begin{aligned}
	U &=U_{\mathrm{kin}}+U_{\mathrm{pot}}=\frac{1}{2} m v^{2}-\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{r} \\
	&=\frac{1}{2}\left(\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{r}\right)-\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{r} \\
	&=-\frac{1}{8 \pi \epsilon_{0}} \frac{q^{2}}{r}
\end{aligned}$$
So
$$
-\frac{d U}{d t}=-\frac{1}{8 \pi \epsilon_{0}} \frac{q^{2}}{r^{2}} \frac{d r}{d t}=P=\frac{q^{2}}{6 \pi \epsilon_{0} c^{3}}\left(\frac{1}{4 \pi \epsilon_{0}} \frac{q^{2}}{m r^{2}}\right)^{2}
$$
and hence
$$
\frac{d r}{d t}=-\frac{1}{3 c}\left(\frac{q^{2}}{2 \pi \epsilon_{0} m c}\right)^{2} \frac{1}{r^{2}}
$$
or
$$
\begin{aligned}
d t &=-3 c\left(\frac{2 \pi \epsilon_{0} m c}{q^{2}}\right)^{2} r^{2} d r \Rightarrow t \\
&=-3 c\left(\frac{2 \pi \epsilon_{0} m c}{q^{2}}\right)^{2} \int_{r_{0}}^{0} r^{2} d r \\
&=c\left(\frac{2 \pi \epsilon_{0} m c}{q^{2}}\right)^{2} r_{0}^{3}
\end{aligned}
$$
or
$$
\begin{aligned}
t=&\left(3 \times 10^{8}\right) \times \\
&\left[\frac{2 \pi\left(8.85 \times 10^{-12}\right)\left(9.11 \times 10^{-31}\right)\left(3 \times 10^{8}\right)}{\left(1.6 \times 10^{-19}\right)^{2}}\right]^{2}\left(5 \times 10^{-11}\right)^{3} \\
=& 1.3 \times 10^{-11} \mathrm{~s}
\end{aligned}
$$
\end{answer}

\section{Lagrangian and hamiltonian of a charged particle in a Electromagnetic field}
The force experienced by a particle of charge q at rest in an electric field of intensity E is given by
$$F_1=qE$$
The force experienced by a moving charge q in a magnetic field B is given by\\
$$F_2=q(v\times B)$$
Where V  is the velocity of the particle.The direction of $F_2$ is perpendicular to both v and B.\\
Total force on a uniformly moving charged particle of charge q is the sum of $F_1$ and $F_2$\\
$$F=F_1+F_2=qE+q(v\times B)$$
The above equation is known as lorentz formula.\\
Maxwell's equation in empty space is given by\\
$\nabla \cdot E=\frac{\rho}{\epsilon_0}$\\
$\nabla \cdot B=0$\\
$\nabla \times E=-\frac{\partial B}{\partial t}$\\
$\nabla \times B=\mu_0(J+\epsilon_0\frac{\partial E}{\partial t})$\\
We know that if $\nabla \cdot B=0$ ,B can be expressed as a curl of some vector A\\
$$B=\nabla \times A$$
Substitute this equation in $\nabla \times E=-\frac{\partial B}{\partial t}$\\
$\nabla \times E=-\frac{\partial B}{\partial t}=-\frac{\partial}{\partial t}(\nabla \times A)=-\nabla \times \frac{\partial A}{\partial t}$\\
$\therefore E=-\frac{\partial A}{\partial t}-\nabla s$ ,since curl of gradient is always zero and s is  scalar function\\
The lorentz force in terms of scalar potential s and vector potential A is given by\\
$$F=q\left[ E+v\times B\right] $$
$$F=q\left[ -\frac{\partial A}{\partial t}-\nabla s+(v\times \nabla \times A)\right] $$
Let us consider the last part $v\times(\nabla \times A)$\\
$$v\times(\nabla \times A)=\nabla (A\cdot v)-(\nabla \cdot v)A$$
Also $A=A(x,y,z,t)$\\
Therfore total time derivative of A is given by\\
$\frac{dA}{dt}=\frac{\partial A}{\partial x} \dot{x}+\frac{\partial A}{\partial y} \dot{y}+\frac{\partial A}{\partial z} \dot{z}+\frac{\partial A}{\partial t}=\frac{\partial A}{\partial x} v_x+\frac{\partial A}{\partial y} v_y+\frac{\partial A}{\partial z} v_z+\frac{\partial A}{\partial t}$\\
$=(\hat{i}v_x+\hat{j}v_y+\hat{k}v_z)\cdot \left( \hat{i}\frac{\partial A}{\partial x}+\hat{j}\frac{\partial A}{\partial y}+\hat{k}\frac{\partial A}{\partial z}\right) +\frac{\partial A}{\partial t}=v \cdot \nabla \mathbf{A}+\frac{\partial \mathbf{A}}{d t}$ \\
$$v \cdot\nabla \mathbf{A}=\frac{d \mathbf{A}}{d t}-\frac{\partial \mathbf{A}}{\partial t}$$
Substituting this value in
$$v\times(\nabla \times A)=\nabla (A\cdot v)-(\nabla \cdot v)A$$
we will get \\
$$\mathrm{v} \times(\nabla \times \mathbf{A})=\nabla(\mathbf{A} \cdot \mathrm{v})-\frac{d \mathbf{A}}{d t}+\frac{\partial \mathbf{A}}{\partial t}$$
Then F becomes\\
$$F=q\left[ -\frac{\partial A}{\partial t}-\nabla s+(v\times \nabla \times A)\right] $$
$$\begin{aligned}
\mathbf{F} &=q\left[-\frac{\partial \mathbf{A}}{d t}-\nabla s+\left\{\nabla(\mathbf{A} \cdot \mathrm{v})-\frac{d \mathbf{A}}{d t}+\frac{\partial \mathbf{A}}{\partial t}\right\}\right] \\
&=q\left[-\nabla s+\left\{\nabla(\mathbf{A} \cdot \mathrm{v})-\frac{d \mathbf{A}}{d t}\right\}\right] \\
&=q\left[-\nabla(s-\mathbf{A} \cdot \mathrm{v})-\frac{d \mathbf{A}}{d t}\right]
\end{aligned}$$
The $x$-component of the force is given by
$$
\begin{aligned}
F_{x} &=q\left[\{-\nabla(s-\mathbf{A} \cdot \mathrm{v})\}_{x}-\frac{d \mathbf{A}_{x}}{d t}\right] \\
&=q\left[-\frac{\partial}{\partial x}(s-\mathbf{A} \cdot \mathrm{v})-\frac{d \mathbf{A}_{x}}{d t}\right] \\
\text { or } \quad F_{x} &=q\left[-\frac{\partial}{\partial x}(s-\mathbf{A} \cdot \mathrm{v})-\frac{d}{d t}\left\{\frac{\partial}{\partial \mathrm{v}_{x}}(\mathbf{A} \cdot \mathrm{v}\}\right]\right.
\end{aligned}
$$
$q s \text { is independent of velocity } \mathrm{v}_{x} \text { i.e. } \frac{\partial(q s)}{\partial \mathrm{v}_{x}}=0$
So we can add that term to the above equation, it will not make any change.\\
After rewritting\\
$$\begin{aligned}
&F_{x}=-\frac{\partial U}{\partial x}-\frac{d}{d t} \frac{\partial U}{\partial \mathrm{v}_{\mathrm{x}}} \\
&U=q s-q(\mathbf{A} \cdot \mathbf{v})
\end{aligned}$$
FRom these it is clear that  U is a function of x and v ie $q_k$ and $\dot{q_k}$
U is called generalized potential or velocity dependent potential.\\
\paragraph{Lagrangian }
$L=T-U=T-\{q s-q(\mathbf{A} \cdot \mathbf{v}) .\}=T-q s+q(\mathbf{A} \cdot \mathbf{v})$\\
T=kinetic energy.$T=\frac{1}{2}mv^2$
$$L=\frac{1}{2}mv^2-q s+q(\mathbf{A} \cdot \mathbf{v})$$
\textbf{Momentum} $P_K=\frac{\partial L}{\partial \dot{q_k}}=\frac{\partial L}{\partial v_k}=mv_k+qA=mv+qA$\\
\paragraph{Hamiltonian}
$$\begin{aligned}
H &=\sum_{k} p_{k} \dot{q}_{k}-L \\
&=\sum_{k} p_{k} \dot{r}_{k}-L \\
&=\sum_{k} p_{k} v_{k}-L \\
&=\sum_{k}\left(m v_{k}+q A_{k}\right) v_{k}-\left[\frac{1}{2} m v^{2}-q s+q(\mathbf{v} \cdot \mathbf{A})\right] \\
&=\sum_{k}\left(m v_{k}^{2}+q A_{k} v_{k}\right)-\frac{1}{2} m v^{2}+q s-q(\mathbf{v} \cdot \mathbf{A}) \\
&=m v^{2}+q(\mathbf{A} \cdot \mathbf{v})-\frac{1}{2} m v^{2}+q s-q(\mathbf{v} \cdot \mathbf{A}) \\
&=\frac{1}{2} m v^{2}+q s
\end{aligned}$$

\newpage
\begin{abox}
	Previous Year solutions
\end{abox}
\begin{enumerate}
	\begin{minipage}{\textwidth}
		\item An electron is decelerated at a constant rate starting from an initial velocity $u$ (where $u<<c$ ) to $u / 2$ during which it travels a distance $s$. The amount of energy lost to radiation is
		\exyear{NET 2017}
	\end{minipage}
	\begin{tasks}(2)
		\task[\textbf{A.}] $\frac{\mu_{0} e^{2} u^{2}}{3 \pi m c^{2} s}$
		\task[\textbf{B.}]$\frac{\mu_{0} e^{2} u^{2}}{6 \pi m c^{2} s}$
		\task[\textbf{C.}]$\frac{\mu_{0} e^{2} u}{8 \pi m c s}$
		\task[\textbf{D.}]$\frac{\mu_{0} e^{2} u}{16 \pi m c s}$
	\end{tasks}
	\begin{answer}
		$\text { Total power radiated } P=\frac{\mu_{0} q^{2} a^{2}}{6 \pi c}$\\
		$\text { Total energy radiated in time } t \text { is } E=P \cdot t=\frac{\mu_{0} e^{2} a^{2}}{6 \pi c} \cdot t=\frac{\mu_{0} e^{2} a^{2}}{6 \pi c} \times \frac{u}{2 a}$\\
		$$\begin{aligned}
		&{\left[\because v=u-a t \Rightarrow \frac{u}{2}=u-a t \Rightarrow t=\frac{u}{2 a}\right]} \\
		&\Rightarrow E=\frac{\mu_{0} e^{2} a u}{12 \pi c}
		\end{aligned}$$
		Fraction of initial $K . E .$ lost due to radiation $=\frac{E}{\frac{1}{2} m u^{2}}=\frac{2 E}{m u^{2}}$
		$$
		\begin{aligned}
		&=\frac{2}{m u^{2}} \times \frac{\mu_{0} e^{2} a u}{12 \pi c}=\frac{\mu_{0} e^{2} a}{6 \pi m c u} \\
		&{\left[\therefore s=u t-\frac{1}{2} a t^{2}=u \times \frac{u}{2 a}-\frac{1}{2} a \times \frac{u^{2}}{4 a^{2}}=\frac{u^{2}}{2 a}-\frac{u^{2}}{8 a}=\frac{3 u^{2}}{8 a} \Rightarrow a=\frac{3 u^{2}}{8 s}\right]} \\
		&=\frac{\mu_{0} e^{2}}{6 \pi m c u} \times \frac{3 u^{2}}{8 s}=\frac{\mu_{0} e^{2} u}{16 \pi m c s}
		\end{aligned}
		$$
	\end{answer}
\end{enumerate}


%
%% Author: Jeffrey Leung
%% Last edited: 2015-07-09
%%
%% This document contains section 4 (Boolean Algebra) of a course overview of CMPT 150.
%

\section{Boolean Algebra}
	\subsection{Introduction}
		\begin{easylist}[itemize]

			& A specific input creates a specific output
			& Values can be 0 (false) or 1 (true)
			& Boolean expressions:
				&& Evaluate to 0 or 1
				&& Function table: Representation of all possible inputs and their corresponding outputs displayed in a table

					\Deactivate
					\begin{table}[!htb]
						\centering
						\caption{Example of a function table}
						\begin{tabular}{ c c | c }
							$I_{2}$ & $I_{1}$ & Sum \\
							\hline
							0 & 0 &  0 \\
							0 & 1 &  1 \\
							0 & 2 &  2 \\
							\vdots & \vdots & \vdots \\
							9 & 8 & 17 \\
							9 & 9 & 18
						\end{tabular}
					\end{table}

			%TODO CMPT 150 notes, page 16

		\end{easylist}


\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{amssymb}
\usepackage{listings}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Anirudhan J. Rajagopalan --- ajr619 --- N18824115}

\begin{document}

\title{Web Search Engines --- Problem Set 2}
\date{March 7, 2016}
\author{Anirudhan J. Rajagopalan\\ N18824115\\ ajr619}
\maketitle
\newpage
\section[A]{Problem 1}
Given term-document matrix:
\[\begin{tabular}{r c c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{Doc1}
 & \multicolumn{1}{c}{Doc2}
 & \multicolumn{1}{c}{Doc3}
 & \multicolumn{1}{c}{Doc4} \\
\cline{2-5}
Walrus & 10 & 0 & 0 & 10 \\
\cline{2-5}
Carpenter & 8 & 0 & 40 & 0 \\
\cline{2-5}
Bread & 4 & 24 & 0 & 20 \\
\cline{2-5}
Butter & 1 & 16 & 0 & 0 \\
\cline{2-5}
\end{tabular}
\]

\[ w(t,d) = \begin{cases}
      1 + \log_2 f(t,d) & if f(t,d) > 0 \\
      0 & if f(t,d) = 0 \\
   \end{cases}
\]

\[ i(t) = 1 + \log_2(c/o(t))\]
\[ \vec{d} = w(t,d) * i(t) \]
\textbf{Calculating $f(t,d)$, $w(t,d)$, $\vec{d}$ for each of the terms given -}

\textbf{Walrus}
$o(t) = 2$, $c = 4$, $i(t) = 2$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{d}$} \\
\cline{2-4}
Doc1 & 10 & 4.32 & 8.64 \\
\cline{2-4}
Doc2 & 0 & 0 & 0 \\
\cline{2-4}
Doc3 & 0 & 0 & 0 \\
\cline{2-4}
Doc4 & 10 & 4.32 & 8.64 \\
\cline{2-4}
\end{tabular}

\vspace{5mm}
\textbf{Carpenter}
$o(t) = 2$, $c = 4$, $i(t) = 2$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{d}$} \\
\cline{2-4}
Doc1 & 8 & 4 & 8 \\
\cline{2-4}
Doc2 & 0 & 0 & 0 \\
\cline{2-4}
Doc3 & 40 & 6.32 & 12.64 \\
\cline{2-4}
Doc4 & 0 & 0 & 0 \\
\cline{2-4}
\end{tabular}

\vspace{5mm}
\textbf{Bread}
$o(t) = 3$, $c = 4$, $i(t) = \log_2(\frac{4}{3}) + 1$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{d}$} \\
\cline{2-4}
Doc1 & 4 & 3 & 5.656 \\
\cline{2-4}
Doc2 & 24 & 5.58 & 7.89 \\
\cline{2-4}
Doc3 & 0 & 0 & 0 \\
\cline{2-4}
Doc4 & 20 & 5.32 & 7.52 \\
\cline{2-4}
\end{tabular}

\vspace{5mm}
\textbf{Butter}
$o(t) = 2$, $c = 4$, $i(t) = 2$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{d}$} \\
\cline{2-4}
Doc1 & 1 & 1 & 2 \\
\cline{2-4}
Doc2 & 16 & 5 & 10 \\
\cline{2-4}
Doc3 & 0 & 0 & 0 \\
\cline{2-4}
Doc4 & 0 & 0 & 0 \\
\cline{2-4}
\end{tabular}

\vspace{5mm}
\textbf{So, the Document vectors with each of these terms as a dimension is as follows:}

\begin{tabular}{r c c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{Doc1}
 & \multicolumn{1}{c}{Doc2}
 & \multicolumn{1}{c}{Doc3}
 & \multicolumn{1}{c}{Doc4} \\
\cline{2-5}
Walrus & 8.64 & 0 & 0 & 8.64 \\
\cline{2-5}
Carpenter & 8 & 0 & 12.64 & 0 \\
\cline{2-5}
Bread & 5.65 & 7.89 & 0 & 7.52 \\
\cline{2-5}
Butter & 2 & 10 & 0 & 0 \\
\cline{2-5}
\end{tabular}

\vspace{5mm}
\textbf{Normalized document vector is as follows-}

\begin{tabular}{r c c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{Doc1}
 & \multicolumn{1}{c}{Doc2}
 & \multicolumn{1}{c}{Doc3}
 & \multicolumn{1}{c}{Doc4} \\
\cline{2-5}
Walrus & 0.654 & 0 & 0 & 0.754 \\
\cline{2-5}
Carpenter & 0.605 & 0 & 1 & 0 \\
\cline{2-5}
Bread & 0.427 & 0.619 & 0 & 0.656 \\
\cline{2-5}
Butter & 0.151 & 0.785 & 0 & 0 \\
\cline{2-5}
\end{tabular}

\subsection{Query --- Document Rankings}

\subsubsection{Query --- ``Walrus''}
$\vec{q} = <1,0,0,0>$
  \begin{tabular}{r c c}
  \multicolumn{1}{r}{}
   & \multicolumn{1}{c}{$sim(\vec{d},\vec{q})$}
   & \multicolumn{1}{c}{Rank} \\
  \cline{2-3}
  Doc1 & 0.654 & 2 \\
  \cline{2-3}
  Doc2 & 0 & 3 \\
  \cline{2-3}
  Doc3 & 0 & 3 \\
  \cline{2-3}
  Doc4 & 0.754 & 1 \\
  \cline{2-3}
  \end{tabular}

\subsubsection{Query --- ``Walrus Carpenter''}
$\vec{q}$ = <0.707,0.707,0,0>
\begin{tabular}{r c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$sim(\vec{d},\vec{q})$}
 & \multicolumn{1}{c}{Rank} \\
\cline{2-3}
Doc1 & 0.89 & 1 \\
\cline{2-3}
Doc2 & 0 & 4 \\
\cline{2-3}
Doc3 & 0.707 & 2 \\
\cline{2-3}
Doc4 & 0.533 & 3 \\
\cline{2-3}
\end{tabular}

\subsubsection{Query --- ``Walrus Bread Butter''}
$\vec{q}$ = <0.57,0,0.57,0.57>
\begin{tabular}{r c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$sim(\vec{d},\vec{q})$}
 & \multicolumn{1}{c}{Rank} \\
\cline{2-3}
Doc1 & 0.702 & 3 \\
\cline{2-3}
Doc2 & 0.800 & 2 \\
\cline{2-3}
Doc3 & 0 & 4 \\
\cline{2-3}
Doc4 & 0.803 & 1 \\
\cline{2-3}
\end{tabular}

\section[B]{Problem 2}
\subsection{Document Similarity}
\begin{align*}
  sim(\vec{d_1},\vec{d_2}) =& 0.427*0.619 \\
  =& 0.264 \\
  sim(\vec{d_1},\vec{d_3}) =& 0.605 * 1\\
  =& 0.605 \\
  sim(\vec{d_1},\vec{d_4}) =& 0.654*0.754 + 0.427*0.656 \\
  =& 0.773 \\
\end{align*}

\subsection{Word Similarity}
\subsubsection*{Doc1}
$o(t) = 4$, $c = 4$, $i(t) = 1$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{w}$} \\
\cline{2-4}
Walrus & 10 & 4.32 & 4.32 \\
\cline{2-4}
Carpenter & 8 & 4 & 4 \\
\cline{2-4}
Bread & 4 & 3 & 3 \\
\cline{2-4}
Butter & 1 & 1 & 1 \\
\cline{2-4}
\end{tabular} \\

\subsubsection*{Doc2}
$o(t) = 2$, $c = 4$, $i(t) = 2$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{w}$} \\
\cline{2-4}
Walrus & 0 & 0 & 0 \\
\cline{2-4}
Carpenter & 0 & 0 & 0 \\
\cline{2-4}
Bread & 24 & 5.58 & 11.16 \\
\cline{2-4}
Butter & 16 & 5 & 10 \\
\cline{2-4}
\end{tabular} \\

\subsubsection*{Doc3}
$o(t) = 1$, $c = 4$, $i(t) = 3$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{w}$} \\
\cline{2-4}
Walrus & 0 & 0 & 0 \\
\cline{2-4}
Carpenter & 40 & 6.32 & 18.96 \\
\cline{2-4}
Bread & 0 & 0 & 0 \\
\cline{2-4}
Butter & 0 & 0 & 0 \\
\cline{2-4}
\end{tabular} \\

\subsubsection*{Doc4}
$o(t) = 2$, $c = 4$, $i(t) = 2$

\begin{tabular}{r c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{$f(t,d)$}
 & \multicolumn{1}{c}{$w(t,d)$}
 & \multicolumn{1}{c}{$\vec{w}$} \\
\cline{2-4}
Walrus & 10 & 4.32 & 8.64 \\
\cline{2-4}
Carpenter & 0 & 0 & 0 \\
\cline{2-4}
Bread & 20 & 5.32 & 10.64 \\
\cline{2-4}
Butter & 0 & 0 & 0 \\
\cline{2-4}
\end{tabular} \\

The cumulative word-document matrix is as follows:

\begin{tabular}{r c c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{Walrus}
 & \multicolumn{1}{c}{Carpenter}
 & \multicolumn{1}{c}{Bread}
 & \multicolumn{1}{c}{Butter} \\
\cline{2-5}
Doc1 & 4.32 & 4 & 3 & 1 \\
\cline{2-5}
Doc2 & 0 & 0 & 11.16 & 10 \\
\cline{2-5}
Doc3 & 0 & 18.96 & 0 & 0 \\
\cline{2-5}
Doc4 & 8.64 & 0 & 10.64 & 0 \\
\cline{2-5}
\end{tabular} \\

The normalized vector is as follows: \\

\begin{tabular}{r c c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{Walrus}
 & \multicolumn{1}{c}{Carpenter}
 & \multicolumn{1}{c}{Bread}
 & \multicolumn{1}{c}{Butter} \\
\cline{2-5}
Doc1 & 0.447 & 0.206 & 0.184 & 0.01 \\
\cline{2-5}
Doc2 & 0 & 0 & 0.685 & 0.996 \\
\cline{2-5}
Doc3 & 0 & 0.978 & 0 & 0 \\
\cline{2-5}
Doc4 & 0.014 & 0 & 0.653 & 0 \\
\cline{2-5}
\end{tabular} \\

\subsubsection*{Similairty of word bread with other words}
\begin{align*}
  sim(\vec{bread},\vec{walrus}) =& 0.447*0.184 + 0.014 * 0.653\\
  =& 0.091 \\
  sim(\vec{bread},\vec{Carpenter}) =& 0.206 * 0.184 \\
  =& 0.037 \\
  sim(\vec{bread},\vec{Butter}) =& 0.184*0.099 + 0.685 * 0.996 \\
  =& 0.700 \\
\end{align*}

\section[C]{Problem 3}
\subsection{\textbf{Property A\@: Invariance under irrelevant words}}
The similarity measure is given by the formula:
\begin{align*}
  sim(\vec{d},\vec{q}) = \frac{\vec{d}\cdot\vec{q}}{\vert d \vert \vert q \vert}
\end{align*}

If the document vector contains different set of words with different weights then the document vectors represented by `d' and `e' will be different.
Since the similarity is a cross product of doc vector and query vector, we will get different similarity for the given document even though for every query term $q, f(t,d) = f(t,e) $.
In this case the this property will not hold.

\subsubsection{Example}
Let the query term be ``bing'' for the following the term document matrix given in Table~\ref{tab:inv}. The term search has the same $f(t,d)$ for the documents D1 and D2:

\begin{table}
  \caption{Invariance under irrelevant words \label{tab:inv}}
  \centering
\begin{tabular}{r c c c c}
  \multicolumn{1}{r}{}
   & \multicolumn{1}{c}{Doc1}
   & \multicolumn{1}{c}{Doc2}
   & \multicolumn{1}{c}{Doc3}
   & \multicolumn{1}{c}{Doc4} \\
  \cline{2-5}
  bing & 4 & 0 & 0 & 4 \\
  \cline{2-5}
  chandler & 17 & 0 & 17 & 0 \\
  \cline{2-5}
  monica & 5 & 5 & 5 & 15 \\
  \cline{2-5}
  geller & 9 & 4 & 1 & 2 \\
  \cline{2-5}
\end{tabular}
\end{table}
But it is trivial to show that the this property does not hold true.

\subsection{\textbf{Property B\@: Invariance under scaling}}
This property holds true for the ranking algorithm in problem one.
When a vector occurs frequently across all documents or in the complete collection, taking inverse document frequency helps in reducing those weights.
Even though a higher weight is given to the dimensions of the more verbose document; they are penalized by a factor of $1 + \log(\frac{c}{o(t)})$

\subsubsection{Example:}
Consider the followinf term-document matrix with the terms in $f(t,Doc1)$ = $2 * f(t,Doc3)$

\begin{tabular}{r c c c c}
\multicolumn{1}{r}{}
 & \multicolumn{1}{c}{Doc1}
 & \multicolumn{1}{c}{Doc2}
 & \multicolumn{1}{c}{Doc3}
 & \multicolumn{1}{c}{Doc4} \\
\cline{2-5}
bing & 1 & 0 & 2 & 1 \\
\cline{2-5}
chandler & 2 & 0 & 4 & 3 \\
\cline{2-5}
monica & 3 & 8 & 6 & 6 \\
\cline{2-5}
geller & 4 & 0 & 8 & 10 \\
\cline{2-5}
\end{tabular}
When we calculate the similarity of D1 and D3 we will get the same values.

\subsection{\textbf{Property C\@: Order invariance under Collection}}

The ranking of a document depends on the tf-idf formulation and idf.  This inturn depends on
\begin{enumerate}
	\item Number of documents in each collection $(c)$
	\item Number of documents in which each term is found. ($o(t)$)
\end{enumerate}

If the value of $ \frac{c}{o(t)} $ increases, the ranking may be higher and vice versa.  Hence, this property does not hold true at all times.

\section[D]{Problem 4}
\subsection{$N = 9$, $e = 0.3$, $f = 1 - e \Rightarrow f = 1 - 0.3 \Rightarrow f = 0.7$, $E = (e/N) \Rightarrow E = 0.033$}
\[
\begin{array}{rcl}A & = & 0.033 + 0.7(0)\\ B & = & 0.033 + 0.7(A/4 + C/3) \\ C & = & 0.033 + 0.7(A/4 + I/2 + B/2) \\ D & = & 0.033 + 0.7(A/4 + H/1) \\ E & = &0.033 + 0.7(A/4+B/2 + C/3 + F/2 + D/2) \\ F & = & 0.033 + 0.7(C/3 + E/2) \\ G & = & 0.033 + 0.7(D/2) \\ H & = & 0.033 + 0.7(E/2 + G/1 + I/2) \\ I & = & 0.033 + 0.7(F/2)
\end{array}
\]
\subsection{\textbf{Page Rank computation}}
\[
\begin{array}{lcl}Q & = &
\begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0.175 & 0 & 0.233 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0.175 & 0. 35 & 0 & 0 & 0 & 0 & 0 & 0 & 0.35 \\ 0.175 & 0 & 0 & 0 & 0& 0 & 0 & 0.7 & 0 \\ 0.175 & 0.35 & 0.233 & 0.35 & 0 & 0.35 & 0 & 0 & 0 \\ 0 & 0 & 0.233 & 0 & 0.35 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0.35 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0.35 & 0 & 0.7 & 0 & 0.35 \\ 0 & 0 & 0 & 0 & 0 & 0.35 & 0 & 0 & 0
\end{bmatrix}
\end{array}
\]

To solve these system of equations, we represent these in the form $\vec{c} = B\vec{p}$
Therefore the system of equations can be represented as:
\[
\begin{array}{rcl}A & = & 0.033 \\ -0.175A + B - 0.233C & = & 0.033 \\ -0.175A - 0.35B + C - 0.35I & = & 0.033 \\ -0.175A + D - 0.7H & = & 0.033 \\ -0.175A - 0.35B - 0.233C -0.35D + E - 0.35F & = &0.033 \\ -0.233C - 0.35E + F & = & 0.033 \\ -0.35D + G & = & 0.033 \\ -0.35E - 0.7G + H - 0.35I & = & 0.033 \\ -0.35F + I & = & 0.033
\end{array}
\]
\begin{lstlisting}
q = [0,0,0,0,0,0,0,0,0;
0.175,0,0.233,0,0,0,0,0,0;
0.175,0.35,0,0,0,0,0,0,0.35;
0.175,0,0,0,0,0,0,0.7,0;
0.175,0.35,0.233,0.35,0,0.35,0,0,0;
0,0,0.233,0,0.35,0,0,0,0;
0,0,0,0.35,0,0,0,0,0;
0,0,0,0,0.35,0,0.7,0,0.35;
0,0,0,0,0,0.35,0,0,0];

b = eye(9) - q;

c = ones(9,1);

c = c * 0.033;

p = b \ c;

p =

    0.0330
    0.0586
    0.0849
    0.1686
    0.1784
    0.1152
    0.0920
    0.1855
    0.0733
\end{lstlisting}

\section[E]{Problem 5}
\subsection{$N = 9$, $e = 0.99$, $f = 1 - e \Rightarrow f = 1 - 0.99 \Rightarrow f = 0.01$, $E = (e/N) \Rightarrow E = 0.11$}
\[
\begin{array}{rcl}A & = & 0.11 + 0.01(0)\\ B & = & 0.11 + 0.01(A/4 + C/3) \\ C & = & 0.11 + 0.01(A/4 + I/2 + B/2) \\ D & = & 0.11 + 0.01(A/4 + H/1) \\ E & = &0.11 + 0.01(A/4+B/2 + C/3 + F/2 + D/2) \\ F & = & 0.11 + 0.01(C/3 + E/2) \\ G & = & 0.11 + 0.01(D/2) \\ H & = & 0.11 + 0.01(E/2 + G/1 + I/2) \\ I & = & 0.11 + 0.01(F/2)
\end{array}
\]
\subsection{\textbf{Page Rank Computaion}}
\[
\begin{array}{lcl}Q & = &
\begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0.0025 & 0 & 0.0033 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0.0025 & 0.005 & 0 & 0 & 0 & 0 & 0 & 0 & 0.005 \\ 0.0025 & 0 & 0 & 0 & 0& 0 & 0 & 0.01 & 0 \\ 0.0025 & 0.005 & 0.0033 & 0.005 & 0 & 0.005 & 0 & 0 & 0 \\ 0 & 0 & 0.0033 & 0 & 0.005 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0.005 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0.005 & 0 & 0.01 & 0 & 0.005 \\ 0 & 0 & 0 & 0 & 0 & 0.005 & 0 & 0 & 0
\end{bmatrix}
\end{array}
\]

To solve these system of equations, we represent these in the form $\vec{c} = B\vec{p}$
Therefore the system of equations can be represented as:
\[
\begin{array}{rcl}A & = & 0.11 \\ -0.0025A + B - 0.0033C & = & 0.11 \\ -0.0025A - 0.005B + C - 0.005I & = & 0.11 \\ -0.0025A + D - 0.01H & = & 0.11 \\ -0.0025A - 0.005B - 0.0033C -0.005D + E - 0.005F & = &0.11 \\ -0.0033C - 0.005E + F & = & 0.11 \\ -0.005D + G & = & 0.11 \\ -0.005E - 0.01G + H - 0.005I & = & 0.11 \\ -0.005F + I & = & 0.11
\end{array}
\]
\begin{lstlisting}
q = [0,0,0,0,0,0,0,0,0;
0.0025,0,0.0033,0,0,0,0,0,0;
0.0025,0.005,0,0,0,0,0,0,0.005;
0.0025,0,0,0,0,0,0,0.01,0;
0.0025,0.005,0.0033,0.005,0,0.005,0,0,0;
0,0,0.0033,0,0.005,0,0,0,0;
0,0,0,0.005,0,0,0,0,0;
0,0,0,0,0.005,0,0.01,0,0.005;
0,0,0,0,0,0.005,0,0,0];

b = eye(9) - q;

c = ones(9,1);

c = c * 0.11;

p = b \ c

p =

    0.1100
    0.1106
    0.1114
    0.1114
    0.1123
    0.1109
    0.1106
    0.1122
    0.1106
\end{lstlisting}

\subsection{$N = 9$, $e = 0.01$, $f = 1 - e \Rightarrow f = 1 - 0.01 \Rightarrow f = 0.99$, $E = (e/N) \Rightarrow E = 0.001$}
\[
\begin{array}{rcl}A & = & 0.011 + 0.99(0)\\ B & = & 0.011 + 0.99(A/4 + C/3) \\ C & = & 0.011 + 0.99(A/4 + I/2 + B/2) \\ D & = & 0.011 + 0.99(A/4 + H) \\ E & = &0.011 + 0.99(A/4+B/2 + C/3 + F/2 + D/2) \\ F & = & 0.011 + 0.99(C/3 + E/2) \\ G & = & 0.011 + 0.99(D/2) \\ H & = & 0.011 + 0.99(E/2 + G/1 + I/2) \\ I & = & 0.011 + 0.99(F/2)
\end{array}
\]
\subsection{\textbf{Page Rank Computation}}
\[
\begin{array}{lcl}Q & = &
\begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0.2475 & 0 & 0.33 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0.2475 & 0.495 & 0 & 0 & 0 & 0 & 0 & 0 & 0.495 \\ 0.2475 & 0 & 0 & 0 & 0& 0 & 0 & 0.99 & 0 \\ 0.2475 & 0.495 & 0.33 & 0.495 & 0 & 0.495 & 0 & 0 & 0 \\ 0 & 0 & 0.33 & 0 & 0.495 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0.495 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0.495 & 0 & 0.99 & 0 & 0.495 \\ 0 & 0 & 0 & 0 & 0 & 0.495 & 0 & 0 & 0
\end{bmatrix}
\end{array}
\]

To solve these system of equations, we represent these in the form $\vec{c} = B\vec{p}$
Therefore the system of equations can be represented as:
\[
\begin{array}{rcl}A & = & 0.001 \\ -0.2475A + B - 0.33C & = & 0.001 \\ -0.2475A - 0.495B + C - 0.495I & = & 0.001 \\ -0.2475A + D - 0.99H & = & 0.001 \\ -0.2475A - 0.495B - 0.33C -0.495D + E - 0.495F & = &0.001 \\ -0.33C - 0.495E + F & = & 0.001 \\ -0.495D + G & = & 0.001 \\ -0.495E - 0.99G + H - 0.495I & = & 0.001 \\ -0.495F + I & = & 0.001
\end{array}
\]
\begin{lstlisting}
q = [0,0,0,0,0,0,0,0,0;
0.2475,0,0.33,0,0,0,0,0,0;
0.2475,0.495,0,0,0,0,0,0,0.495;
0.2475,0,0,0,0,0,0,0.99,0;
0.2475,0.495,0.33,0.495,0,0.495,0,0,0;
0,0,0.33,0,0.495,0,0,0,0;
0,0,0,0.495,0,0,0,0,0;
0,0,0,0,0.495,0,0.99,0,0.495;
0,0,0,0,0,0.495,0,0,0];

b = eye(9) - q;

c = ones(9,1);

c = c * 0.001;

p = b \ c

p =

    1.0000
   11.4695
   30.9758
  215.7781
  171.5447
   96.1366
  107.8101
  216.6975
   48.5876
\end{lstlisting}
\end{document}