\documentclass[12pt]{article}

\usepackage{amsmath,amsthm,amssymb}

\usepackage{xcolor}

%\usepackage[textheight=8.5in, margin=1.6in]{geometry}
\usepackage[total={6in,8in}]{geometry}

\usepackage{tikz}
%\usepackage{pgfplots}
\tikzstyle{ball} = [circle,shading=ball, ball color=black,
    minimum size=1mm,inner sep=1.3pt]
%\usetikzlibrary{arrows.meta}
%\tikzset{>={Latex[length=2mm,width=1.5mm]}}

%\usepackage{graphicx}

\usepackage{needspace}  % <-- to prevent bad pagebreak over environment titles
% Use:  \Needspace{3\baselineskip} before opening an environment

\usepackage{enumitem}
\setlist[enumerate]{leftmargin=*}

%\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\sn}{\mathfrak{S}}
\newcommand{\ve}{\varepsilon}
\newcommand{\ips}[2]{\langle{#1}, {#2}\rangle}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Span}{\mathrm{Span}}
\DeclareMathOperator{\rk}{\mathrm{rank}}
\DeclareMathOperator{\trace}{\mathrm{tr}}
\DeclareMathOperator{\im}{\mathrm{im}}
\DeclareMathOperator{\Sym}{\mathrm{Sym}}
\DeclareMathOperator{\Hom}{\mathrm{Hom}}
\DeclareMathOperator{\diag}{\mathrm{diag}}
\DeclareMathOperator{\glb}{\mathrm{glb}}
\DeclareMathOperator{\lub}{\mathrm{lub}}

\parskip = 0.05in
\parindent = 0.0in

%\pagestyle{empty}

\begin{document}
\centerline{Math 372 lecture for Wednesday, Week 1}
\bigskip

Let~$G=(V,E)$ be a graph with vertex set~$V=\left\{ v_1,\dots,v_p \right\}$ and
edge set~$E$.  Let~$A$ be the adjacency matrix for~$G$.  Since $A$ is real and
symmetric, there exist real linearly independent orthonormal
eigenvectors~$u_1,\dots,u_p$ for~$A$. Say the corresponding eigenvalues
are~$\lambda_1,\dots,\lambda_p$.  Last time, we saw that:
\begin{itemize}
  \item The number of ~$\ell$-walks (i.e., walks of lenght~$\ell$)
    from~$v_i$ to~$v_j$ is
    \[
      \sum_{k=1}^pu_{ik}u_{jk}\lambda_k^{\ell}.
    \]
  \item The number of closed~$\ell$-walks is
    \[
      \trace(A^{\ell})=\sum_{k=1}^p\lambda_k^{\ell}.
    \]
\end{itemize}
\medskip

{\bf Example 1.} Here is a toy example:
\begin{center}
  \begin{tikzpicture}
    \node[ball, label={left:$v_1$}] (1) at (0,0){};
    \node[ball, label={right:$v_2$}] (2) at (1,0){};
    \draw (1)--(2);
    \node at (5,0) {$\displaystyle
      A = 
      \left(\begin{array}{cc}
	  0&1\\
	  1&0
      \end{array} \right).
    $};
  \end{tikzpicture}
\end{center}
By inspection,~$(1,1)$ and~$(1,-1)$ are orthogonal eigenvectors with
corresponding eigenvalues~$1$ and~$-1$.  So we can take
\begin{align*}
  u_1&= \frac{1}{\sqrt{2}}(1,1),\quad\lambda_1=1\\[10pt]
  u_2&= \frac{1}{\sqrt{2}}(1,-1),\quad\lambda_2=-1.
\end{align*}
The number of closed~$\ell$-walks is
\[
  1^{\ell}+(-1)^{\ell}=
  \begin{cases}
    2&\text{if~$\ell$ is even}\\
    0&\text{if~$\ell$ is odd}.
  \end{cases}
\]
The number of~$\ell$-walks from~$v_1$ to~$v_2$ is
\begin{align*}
  \sum_{k=1}^{2}u_{1k}u_{2k}\lambda_k^{\ell}
  &= u_{11}u_{21}\lambda_1^{\ell}+ u_{12}u_{22}\lambda_2^{\ell}\\[8pt]
  &= \frac{1}{\sqrt{2}}\cdot\frac{1}{\sqrt{2}}1^{\ell}
  +\frac{1}{\sqrt{2}}\cdot\frac{-1}{\sqrt{2}}(-1)^{\ell}\\[8pt]
  &= \frac{1}{2}\left( 1-(-1)^{\ell} \right)\\[8pt]
  &= 
  \begin{cases}
    1&\text{if~$\ell$ is odd}\\
    0&\text{if~$\ell$ is even}.
  \end{cases}
\end{align*}
Both of these results are clear by looking at the graph, without any calculation.
\medskip

{\bf Example 2.} (Complete graphs) Let's apply our theory to the complete
graph~$K_p$ on~$p$ vertices.  This graph has an edge joining each pair of
(distinct) vertices.  For example, in the case~$p=4$, we have the following:
\begin{center}
  \begin{tikzpicture}
    \node[ball,label={below:$v_1$}] (1) at (0,0.05) {};
    \node[ball,label={below left:$v_2$}] (2) at (-0.866,-0.5) {};
    \node[ball,label={below right:$v_3$}] (3) at (0.866,-0.5) {};
    \node[ball,label={above:$v_4$}] (4) at (0,1) {};
  \draw (1)--(2)--(3)--(4)--(1);
  \draw (1)--(3);
  \draw (1)--(2);
  \draw (2)--(4);
  \node at (5,0) {$\displaystyle
    A = 
    \left(\begin{array}{cccc}
	0&1&1&1\\
	1&0&1&1\\
	1&1&0&1\\
	1&1&1&0
    \end{array} \right).
  $};
  \end{tikzpicture}
\end{center}
\[
  \begin{array}{c|c|c}
      \ell&\text{\#~$\ell$-walks~$v_1$ to~$v_1$}&\text{\# closed~$\ell$-walks}\\\hline
      0&1&4\\
      1&0&0\\
      2&3&12\\
      3&3\cdot2\cdot1=6&24\\
      4&\text{?}&\text{?}
  \end{array}
\]
In general, the adjacency matrix for~$K_p$ is
\[
A = J-I
\]
where~$J$ is the~$p\times p$ matrix with~$J_{ij}=1$ for all~$i,j$, and~$I$ is
the~$p\times p$ identity matrix.
\medskip

{\bf Lemma.} The eigenvalues for~$J$ are~$0$ (multiplicity~$p-1$)
and~$p$.

\begin{proof}
 Letting~$e_i$ denote the~$i$-th standard basis vector
 for~$\R^p$, we have that 
 \[
   \left\{ e_i-e_p:i=1,\dots,p-1 \right\}
 \]
 are eigenvectors for~$J$ with eigenvalue~$0$, and~$e_1+\cdots+e_p$ is an
 eigenvector with eigenvalue~$p$.
\end{proof}

{\bf Proposition.} The eigenvalues for~$K_p$ are~$-1$ (multiplicity~$p-1$)
and~$p-1$.

\begin{proof}
 By the lemma, the characteristic polynomial for~$J$ is
 \[
   p_J(x)=\det(J-Ix)=\prod_{i=1}^p\left( \lambda_i-x \right)=\pm x^{p-1}(x-p).
 \]
 The characteristic polynomial for~$A=J-I$ is
 \begin{align*}
   p_A(x)&=\det(A-Ix)=\det(J-I-Ix)=\det(J-I(x+1))\\[5pt]
   &= p_J(x+1)=\pm (x+1)^{p-1}(x+1-p)\\[5pt]
   &= \pm (x+1)^{p-1}(x-(p-1)).
 \end{align*}
 The result follows.
\end{proof}

As an immediate consequence, we get:
\medskip

{\bf Corollary.} 
\begin{enumerate}
  \item The number of closed~$\ell$-walks in~$K_p$ is
    \[
      (p-1)(-1)^{\ell}+(p-1)^{\ell}.
    \]
  \item For each~$i$, the number of closed~$\ell$-walks from~$v_i$ to itself is
    \[
      \frac{1}{p}\left((p-1)(-1)^{\ell}+(p-1)^{\ell}\right).
    \]
\end{enumerate}
The second part follows by symmetry: the number of closed $\ell$-walks at each vertex
is the same.
\medskip

\medskip

{\bf Proposition.} The number of~$\ell$-walks in~$K_p$ from~$v_a$ to~$v_b$ when~$a\neq
b$ is
\[
  \frac{1}{p}\left( (p-1)^{\ell}-(-1)^{\ell} \right).
\]
\smallskip

\begin{proof}
 One may do the count by directly computing the~$i,j$-entry of~$A^{\ell}$ as shown in
 the text using the binomial theorem.  We will give another argument (hinted at
 in the text).  First note that the total number of~$\ell$-walks
 is~$p(p-1)^{\ell}$.  (There are~$p$ starting points, and from each vertex
 reached in a walk, there are~$p-1$ choices for an edge along which the walk
 could continue.)  Using the previous corollary and symmetry, we have
 \begin{align*}
   p(p-1)^{\ell} &=  \sum_{i,j=1}^p(A^{\ell})_{ij}\\[5pt]
   &= \sum_{i=1}^p(A^{\ell})_{ii}+\sum_{i\neq j}(A^{\ell}_{ij})\\[5pt]
   &= p\left( \frac{1}{p}\left( (p-1)(-1)^{\ell}+(p-1)^{\ell} \right)
   \right)+p(p-1)\tau
 \end{align*}
 where~$\tau$ is the number of walks from~$v_i$ to~$v_j$ for any fixed~$i\neq j$.
 (The last summand has this form since there are~$p$ choices for vertex~$v_i$
 and~$p-1$ choices for vertex~$v_j$, and the number of walks between them is the
 same for all~$i\neq j$.)  Solving for~$\tau$ gives the formula we are looking
 for.
\end{proof}

\begin{proof}[Combinatorial proof]
  By the previous corollary, the number of closed walks of length $\ell+1$
  starting at~$v_{a}$ is
  \[
    \frac{1}{p}\left((p-1)(-1)^{\ell+1}+(p-1)^{\ell+1}\right).
  \]
  Each of these walks is in bijective correspondence with a walk of
  length~$\ell$ starting at~$v_{a}$: stop at the penultimate vertex of the walk, just
  before returning to $v_{a}$.  There are $p-1$ choices for the penultimate
  vertex, and the number of walks of length $\ell$ from~$v_{a}$ to any vertex
  $v_{b}\neq v_{a}$ is independent of the $p-1$ choices for~$b$.  So fixing a
  particular~$b$, the number of walks from $v_{a}$ to $v_{b}$ is
  \[
   \frac{1}{p-1}
   \left(\frac{1}{p}\left((p-1)(-1)^{\ell+1}+(p-1)^{\ell+1}\right)\right),
  \]
  and the result follows.
\end{proof}
\end{document}


