%! TEX root = SGT.tex
% vim: tw=80
% 05/05/2025 11AM
%
\begin{notation}
  \glssymboldefn{q}%
  Define $Q_M : l^2(\Omega) \to \Cbb$ by $Q_M(f) = \langle f, Mf \rangle =
  \sum_{x, y} f(x) M(x, y) f(y)$.

  Define $q_m(f) = \frac{Q_M(f)}{Q_I(f)}$.
\end{notation}

\begin{fclemma}
  $\lambda_1(M) = \min_{f \neq 0} \q_M(f)$ and it is attained only on
  eigenfunctions of $\lambda_1$.
\end{fclemma}

\begin{proof}
  Let $f = \sum_i \alpha_i \varphi_i$ and $Mf = \sum_i \alpha_i \lambda_i
  \varphi_i$.
  Then
  \begin{align*}
    \Q_M(f)
    &= \langle f, M f \rangle \\
    \sum_{i, j} \alpha_i \alpha_j \lambda_i \langle \varphi_i, \varphi_j \rangle
    \\
    &= \sum_i \alpha_i^2 \lambda_i
  \end{align*}
  and
  \[
    \q_M(f)
    = \frac{\sum_i \alpha_i^2 \lambda_i}{\sum_i \alpha_i^2}
    \ge \lambda_i
  .\]
  Equality occurs here if and only if $\sum_i (\lambda_1 - \lambda_i) \alpha_i^2
  = 0$.
  So $\alpha_i = 0$ whenever $\lambda_i > \lambda_1$.
\end{proof}

\begin{fclemma}
  Assuming:
  - $\varphi_1$ is an eigenfunction of $\lambda_1$.
  Then:
  $\lambda_2(M) = \min_{\substack{f \perp \varphi_1 \\ f \neq 0}} \q_M(f)$, and
  it is attained only on eigenfunctions of $\lambda_2(M)$.
\end{fclemma}

\begin{proof}
  \[
    \q_M(f)
    = \frac{\sum_i \alpha_i^2 \lambda_i}{\sum_i \alpha_i^2}
    \ge \frac{\alpha_1^2 \lambda_1 + \left( \sum_{i \ge 2} \alpha_i^2 \right)
    \lambda_2}{\sum_i \alpha_i^2}
  .\]
  So
  \[
    \min_{\substack{f \perp \varphi_i \\ f \neq 0}} \q_M(f)
    \ge \lambda_2
  .\]
  Deal with the equality case similarly to before.
\end{proof}

In general:
\[
  \lambda_k(M)
  = \min_{\substack{f \perp \varphi_1, \ldots, \varphi_{k - 1} \\ f \neq 0}}
  \q_M(f)
.\]
(and equality case is similar to before).
Also,
\begin{align*}
  \lambda_n(M)
  &= \max_{f \neq 0} \q_M(f) \\
  \lambda_{n - k}(M)
  &= \max_{\substack{f \perp \varphi_n, \ldots, \varphi_{n - k + 1} \\ f \neq
  0}} \q_M(f)
\end{align*}
(and equality case is similar to before).

\newpage
\section{Graphs and some of their matrices}

Graph $G = (V, E)$: set of vertices $V$, $|V| = n$, $E$ is a set of (unordered)
pairs of vertices.

\begin{fcdefn}[Adjacency matrix]
  \glssymboldefn{adjm}%
  The \emph{adjacency matrix} of a graph $G$ is the matrix $A_G : V \times V \to
  \Rbb$ defined by
  \[
    A_G(x, y)
    = \begin{cases}
      1
      &\{x, y\} \in E(G) \\
      0
      &\{x, y\} \notin E(G)
    \end{cases}
  \]
\end{fcdefn}

\begin{fcdefn}[Degree matrix]
  \glssymboldefn{degm}%
  The \emph{degree matrix} of a graph $G$ is the matrix $D_G : V \times V \to
  \Rbb$ defined by
  \[
    D_G(x, y)
    = \begin{cases}
      \deg(x)
      &x = y \\
      0
      &\text{otherwise}
    \end{cases}
  \]
\end{fcdefn}

\begin{fcdefn}[Laplacian matrix]
  \glssymboldefn{lapm}%
  The \emph{Laplacian matrix} of a graph $G$ is defined by $L_G = \degm -
  \adjm$.
\end{fcdefn}

We can now calculate:
\begin{align*}
  \Q_{\adjm}(f)
  &= \sum_{x, y} f(x) \adjm(x, y) f(y) \\
  &= 2\sum_{x \sim y} f(x) f(y) \\
  \Q_\degm(f)
  &= \sum_{x, y} f(x) \degm(x, y) f(y) \\
  &= \sum_x f(x)^2 \deg(x) \\
  &= \sum_x f(x)^2 \sum_y \adjm(x, y) \\
  &= \sum_{x, y} f(x)^2 \adjm(x, y) \\
  &= \half \sum_{x, y} (f(x)^2 + f(y)^2) \adjm(x, y) \\
  &= \sum_{x \sim y} (f(x)^2 + f(y)^2) \\
  \Q_\lapm(f)
  &= \Q_{\degm - \adjm}(f) \\
  &= \Q_\degm(f) - \Q_\adjm(f) \\
  &= \sum_{x \sim y} (f(x)^2 + f(y)^2 - 2f(x)f(y)) \\
  &= \sum_{x \sim y} (f(x) - f(y))^2 \\
  &\ge 0
\end{align*}

\begin{fccoro}[]
  For any graph $G$, $\lapm_G$ is \cloze{a positive semi definite matrix with
  eigenvector $1$, which has eigenvalue $1$}.
\end{fccoro}

\begin{proof}
  Since $\Q_\lapm(f) = \sum_{x \sim y} (f(x) - f(y))^2$, we see that
  $\Q_\lapm(f) \ge 0$, with equality when $f$ is constant.
\end{proof}

\begin{fcprop}[]
  \begin{iffc}
    \lhs
    $\lambda_2(\lapm_g) > 0$
    \rhs
    $G$ is connected.
  \end{iffc}
  \begin{iffc}
    \lhs
    $\lambda_k(\lapm_G) = 0$
    \rhs
    $G$ has at least $k$ connected components.
  \end{iffc}
\end{fcprop}

\begin{proof}
  \[
    \lambda_2
    = \min_{\substack{f \perp 1 \\ f \neq 0}} \frac{\sum_{x \sim y} (f(x) -
    f(y))^2}{\langle f, f \rangle}
    \ge 0
  \]
  Equality happens if and only if $\Q_\lapm(f) = 0$, which happens if and only
  if $f$ is constant on connected components.
  The dimension of $\{f : \text{constant on connected components}\}$ is the
  number of connected components of $G$.

  TODO?
\end{proof}

TODO
